Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork4
Garbage collector that stops inactive LSP clients to free RAM
License
Zeioth/garbage-day.nvim
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Garbage collector that stops inactive LSP clients to free RAM
In many scenarios, unmanaged LSP clients running on background can take several Gb of RAM. So I wrote this LSP garbage collector forNormalNvim to auto free it. But you can use it on any distro.
Add this to lazy
{"zeioth/garbage-day.nvim",dependencies="neovim/nvim-lspconfig",event="VeryLazy",opts= {-- your options here }},We also support changing opts on execution time like:let g:garbage_day_config['option']='value'
| Name | Default | Description |
|---|---|---|
aggressive_mode | false | Set it totrue to stop all lsp clients except the current buffer, every time you enter a buffer.aggressive_mode ignoresgrace_period, and it only triggers when entering a buffer with a different filetype than the current buffer. Ensures the maximum RAM save. |
excluded_lsp_clients | here | Table of LSP clients that should never be stopped. Useful for LSP clients that miss behave. |
grace_period | 60*15 | Seconds to wait before stopping all LSP clients after neovim loses focus. |
wakeup_delay | 0 | Milliseconds to wait before restoring LSP after the mouse re-enters nvim. Useful to avoid waking up the LSP clients by accident when passing the mouse over it. |
You can tweak them in case some particular LSP client don't start/stop correctly on your machine.
| Name | Default | Description |
|---|---|---|
aggressive_mode_ignore | here | Buffers to ignore onaggressive_mode. |
notifications | false | Set it totrue to get a notification every time LSP garbage collection triggers. |
retries | 3 | Times to try to start a LSP client before giving up. |
timeout | 1000 | Milliseconds that will take forretries to complete. Example: by default we try 3 retries for 1000ms. |
IMPORTANT: If you change the default values, make sure the value ofgrace_period is always bigger thantimeout/1000. This ensures you are leaving enough time betweenstop_lsp()/start_lsp(), so they don't overlap.
If it doesn't workThis plugin has been tested with neovim 0.10 and 0.11. If you are in a neovim version superior to nvim 0.11, and it doesn't work, pleaseopen a issue tagging me and I will fix it.Can I manually trigger garbage collection?Yes, you can do it like
require("garbage-day.utils").stop_lsp()-- stop all lsp clients.require("garbage-day.utils").start_lsp()-- start lsp clients for the current buffer.
If you want to help me, please star this repository to increase the visibility of the project.
- lsp-timeout: Recommended for nvim versions
<=0.8
About
Garbage collector that stops inactive LSP clients to free RAM
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Sponsor this project
Uh oh!
There was an error while loading.Please reload this page.
Packages0
Uh oh!
There was an error while loading.Please reload this page.
