Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Garbage collector that stops inactive LSP clients to free RAM

License

NotificationsYou must be signed in to change notification settings

Zeioth/garbage-day.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Garbage collector that stops inactive LSP clients to free RAM

screenshot_2023-11-08_08-12-12_851558101

Discord

Why

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.

How to setup

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'

Available options

NameDefaultDescription
aggressive_modefalseSet 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_clientshereTable of LSP clients that should never be stopped. Useful for LSP clients that miss behave.
grace_period60*15Seconds to wait before stopping all LSP clients after neovim loses focus.
wakeup_delay0Milliseconds 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.

Debug options

You can tweak them in case some particular LSP client don't start/stop correctly on your machine.

NameDefaultDescription
aggressive_mode_ignorehereBuffers to ignore onaggressive_mode.
notificationsfalseSet it totrue to get a notification every time LSP garbage collection triggers.
retries3Times to try to start a LSP client before giving up.
timeout1000Milliseconds 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.

FAQ

  • If it doesn't work This 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.

🌟 Support the project

If you want to help me, please star this repository to increase the visibility of the project.

Stargazers over time

Where do that cheesy name come from?

Other alternatives

About

Garbage collector that stops inactive LSP clients to free RAM

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp