Comments (9)
Yeah, right now we don't terminate idle daemons, but it's a good idea. Perhaps we can coordinate with @mantoni to see if they'd be interested in having that feature as part of core_d (something like CORE_D_MAX_IDLE_TIME
). To be 100% precise we may need to make some changes in the client too to ensure that it retries/reconnects if the server shuts down right before it can send a request.
If this doesn't make sense within core_d, we can implement it just for prettierd.
from prettierd.
That is something being requested for eslint_d
as well here: mantoni/eslint_d.js#236
It makes sense to put the core functionality into core_d
so that it can be shared with this project too.
I don't have the time right now to do the leg work, but I'd happily assist, review and integrate.
from prettierd.
I have this workaround, that I've been using for a long while, that you can use until this feature is provided in core_d
.
Start by registering an autocmd
for a ExitPre
event. The callback of the autocmd
executes a detached script.
This is how I've set it up:
-- Stop Neovim Daemons.
autocmd('ExitPre', {
group = augroups.StopNeovimDaemons,
callback = function()
vim.fn.jobstart(
vim.fn.expand('$SCRIPTS') .. '/nvim/stop-nvim-daemons.sh',
{ detach = true }
)
end,
})
Next you need to create the stop-nvim-daemons
script. This script stops all listed daemons after a set amount of time (in our case 5 minutes).
This is my script that kill both eslint_d
and prettierd
:
https://github.com/sQVe/scripts/blob/14c628dcdfaca4c1e11208c78e124dbcf52c956e/nvim/stop-nvim-daemons.sh#L1-L33
from prettierd.
Or you can have a 5 line simple autocmd with a
killall
jobvim.api.nvim_create_autocmd("VimLeavePre", { callback = function() vim.fn.jobstart("killall prettierd eslint_d", { detach = true }) end, })
That is not a good idea as it'll kill all instances of prettierd regardless of whether or not it was created by the current instance of the editor.
If it works for you, great :D but we can't add it to the readme.
from prettierd.
This is the whole point behind prettierd
and other similar CLIs. It's a daemonized prettier version, which improves performance substantially since it removes the node startup time.
from prettierd.
@sQVe thank you for reply!
I can understand that, it can improve startup/initialization time and as far as I understood this is some kind of caching mechanism. But in other hand I'm not sure if it is normal to have multiple prettierd
processes in memory created couple of days ago. Is there a way to add some job to check how much time passed and kill "stale" processes?
from prettierd.
totally forgotten.
from prettierd.
Or you can have a 5 line simple autocmd with a killall
job
vim.api.nvim_create_autocmd("VimLeavePre", {
callback = function()
vim.fn.jobstart("killall prettierd eslint_d", { detach = true })
end,
})
from prettierd.
That is not a good idea as it'll kill all instances of prettierd regardless of whether or not it was created by the current instance of the editor.
Yeah I understand, when I need to work on multiple projects at once I don't close separate nvim instances, so it works for me. This is just how I workaround this, maybe it will be useful to someone else :)
from prettierd.
Related Issues (20)
- Local configuration changes takes a long time to take effect HOT 5
- 0.23.* releases are not working with Neovim nor Zed HOT 4
- Enter insert mode ,exit insert mode,copy code indefinitely in Typescript. HOT 1
- `prettierd` doesn't seem to work after a new plugin is added to config file HOT 1
- There are processes running even after `prettierd stop` was executed HOT 1
- Overrides do not work in default config. HOT 5
- Does not respect `prefer-file`
- prettier 3.0 support HOT 1
- prettierd ignores .editorconfig file HOT 4
- v0.24.1 causes prettier to not follow project config HOT 5
- Add a test suite to catch regressions
- prettierd fails with prettier-plugin-astro HOT 2
- bug: The import statements are ordered when enabling the prettier formatter HOT 1
- Errors should be written to stderr not stdout HOT 8
- prettierd not reading the config file with tailwindcss plugin HOT 4
- The "list" argument must be an instance of Array. Received null HOT 13
- 1488 HOT 12
- ERR_MODULE_NOT_FOUND with prettier-plugin-astro HOT 2
- Prettier config JS file changes ignored HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from prettierd.