Feel-ix-343 / markdown-oxide

Editor Agnostic PKM: you bring the text editor and we bring the PKM - inspired by and compatible with Obsidian
GNU General Public License v3.0
684 stars 10 forks source link

Slow exit(:q) time in Neovim #110

Closed arthurbdev closed 1 month ago

arthurbdev commented 1 month ago

Hey, thank you for your work.

I noticed there is a noticeable(2-3s) delay when exiting(:q) neovim from a markdown file with your lsp launched. However, if i switch to a different file, lua for example, there is no delay

Installed through :Mason

Neovim version

❯ nvim --version
NVIM v0.10.0-dev-3087+gbb032d952b
Build type: RelWithDebInfo
LuaJIT 2.1.1713773202

Let me know if you need more details

Feel-ix-343 commented 1 month ago

Hey thanks for the contribution!

I don't have this issue as my neovim closes instantly.

Would you mind disabling markdown oxide :LspStop then quitting and seeing if there is still a delay?

arthurbdev commented 1 month ago

After some debugging I realized it was a configuration bug on my part:

vim.api.nvim_create_autocmd("LspDetach", {
            group = vim.api.nvim_create_augroup("kickstart-lsp-detach", { clear = true }),
            callback = function(event)
                vim.lsp.buf.clear_references()
                vim.lsp.codelens.clear()
                vim.lsp.inlay_hint.enable(false)

                -- this line after doing :LspStop outputs an error 
                               vim.api.nvim_clear_autocmds({ group = "kickstart-lsp-highlight", buffer = event.buf })

                               vim.api.nvim_clear_autocmds({ group = "custom-lsp-codelens", buffer = event.buf })
            end,
        })

Sorry for disturbance and thank you for a great LSP!

Feel-ix-343 commented 1 month ago

Thank you! Feel free to open issues for anything else!