Comments (15)
Ok I got a quick dirty fix:
-- ignore some filetypes if vim.tbl_contains(config.excluded_filetypes, vim.bo.filetype) then return end if current_filetype == "" then return end -- this is the fix.That seems to do the trick, I'm gonna refine a bit more and see if I can communicate the new feature effectively.
yeah, this seems to be a cleaner solution to exist.
will be waiting for the update to be pushed.
from garbage-day.nvim.
I am fine with a fork.
But in my testing
if vim.tbl_contains(config.excluded_filetypes, vim.bo.filetype) or vim.tbl_contains(config.excluded_filetypes, new_filetype) then
return
end
This Snippet is working as expected for me
have added in my fork. (if this seems to be an acceptable solution, then tell will merge.)
from garbage-day.nvim.
This option was removed in v1.0.6 in favor of the option excluded_lsp_clients
, which is the same but provides you more control.
Aditionally, please ensure you have a plugin like noice.nvim
to see what lsp clients you are executing.
from garbage-day.nvim.
If you stop having diagnostics, it means a LSP server you need has been stopped, which it should never happen for the buffer you have focused.
from garbage-day.nvim.
return {
-- TODO: if fork merged fix the url
"Zeioth/garbage-day.nvim",
-- dir = "~/repos/garbage-day.nvim/",
dependencies = "neovim/nvim-lspconfig",
event = "VeryLazy",
opts = {
aggressive_mode = true,
notifications = true,
-- grace_period = 3,
excluded_lsp_clients = {
"NvimTree",
},
},
}
Here is my config
and what i expect is that if i open NvimTree
window (either in floating mode or any how)`
it should not stop any of lsp that is running.
from garbage-day.nvim.
Ok I understand you case of use now:
Because aggresive mode stop LSP when you change to a different filetype, it is stopping lsp when you change to NvimTree.
You want to avoid this because garbage collection would trigger excessively.
from garbage-day.nvim.
Ok I understand you case of use now:
Because aggresive mode stop LSP when you change to a different filetype, it is stopping lsp when you change to NvimTree.
You want to avoid this because garbage collection would trigger excessively.
Yep exactly.
from garbage-day.nvim.
So you will be considering the pr?
Or will be extending the functionality of excluded_lsp_clients
?
from garbage-day.nvim.
@niksingh710 I tested it last night.
The PR works fine when you keep the sidebar open. But if you close/open it, garbage collection triggers and I'm trying to figure out why.
from garbage-day.nvim.
@niksingh710 I tested it last night.
The PR works fine when you keep the sidebar open. But if you close/open it, garbage collection triggers and I'm trying to figure out why.
aah this seems to be an issue.
just faced as you mentioned.
ig it is happening because I have only implemented the check if the new_filetype
is in the ignore_ft
table.
so what happens is
when going from lua file to NvimTree (Opening Nvim Tree)
currbuf_ft(lua) -> switched_to(NvimTree)
current_filetype -> new_filetype (garbage collection ignored as new_filetype in ignore_ft)
when going from NvimTree to lua file (Closing Nvim Tree)
currbuf_ft(NvimTree) -> switched_to(Lua)
current_filetype -> new_filetype (garbage collection activated as new_filetype is not in ignore_ft)
Now have to resolve this issue.
Not getting a clean solution at the top of my head.
from garbage-day.nvim.
The latest commit in my pr should resolve this issue.
also have to use event="BufEnter"
in lazy instead of event="VeryLazy"
as lazy loading garbage-day was causing the issue once, then everything was as expected
from garbage-day.nvim.
@niksingh710 I'm starting to find all kind of unfixable border cases for this feature:
For example, if we implement it like:
-- ignore some filetypes
if vim.tbl_contains(config.excluded_filetypes, vim.bo.filetype) then
was_prev_ignored = true
-- BUG: If you close the ignored buffer in this point it will trigger gc.
return
end
if was_prev_ignored then
was_prev_ignored = false
return
end
So I think we are leaving it out.
Why
Aggressive_mode was never designed to be the main mode. It was included because it can be used successfully in most languages. That's not the case for neodev, where loading LSP is very slow and it would trigger constant reloads.
Alternatives
I advice disabling aggressive_mode
in your scenario. If you need, you can use the API we expose to stop lsp clients more often that garbage-day.nvim
does by default.
Example
vim.api.nvim_create_autocmd("BufEnter", {
callback = function()
if my_condition then
require("garbage-day.utils").stop_lsp() -- stop all lsp clients.
require("garbage-day.utils").start_lsp() -- start lsp clients for the current buffer.
end
end,
})
from garbage-day.nvim.
It's also cool to fork it and modify it.
I undertand the feature is convenient, but the priority is that anything we ship is 100% reliable.
from garbage-day.nvim.
@niksingh710 I found the solution to all issues in the previous solution without the need to add a new option, using a single line.
if vim.bo.buftype == "nofile" or vim.bo.buftype == "" then return end
I guess I was tired the other day. Preparing new version.
from garbage-day.nvim.
@niksingh710 I found the solution to all issues in the previous solution without the need to add a new option, using a single line.
if vim.bo.buftype == "nofile" or vim.bo.buftype == "" then return endI guess I was tired the other day. Preparing new version.
vim.bo.buftype for lua type file is also returning ""
didn't got the time to test but will test it.
from garbage-day.nvim.
Related Issues (9)
- Error when leaving neovim in background for grace period HOT 6
- Option to allow notifications to be displayed with fidget HOT 1
- [Bug] attempt to call field 'get_clients' (a nil value) (nvim 0.9.5) HOT 3
- null-ls is unreliable - solution proposal HOT 2
- [request] manually tell garbage-day when to start/stop (or pass it user autocmd events to respond to?) HOT 1
- Still detecting `null-ls`? HOT 2
- Handle `lspconfig.autostart` HOT 2
- Plugin.config is deprecated warning 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 garbage-day.nvim.