Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(lsp)!: deprecate lvim.lsp.diagnostics #3916

Merged
merged 11 commits into from
May 2, 2023
Merged

Conversation

cpea2506
Copy link
Member

@cpea2506 cpea2506 commented Mar 3, 2023

Description

  • There is no need to maintain lvim.lsp.diagnostics anymore as vim.diagnostic.config is easier to point to with regards to documentation.
  • Provide a more intuitive way for users to change or disable custom handlers.

fixes #3874, resolves #2344

How Has This Been Tested?

@cpea2506 cpea2506 requested a review from LostNeophyte March 3, 2023 07:11
@LostNeophyte
Copy link
Member

we can use lvim.lsp.float for this purpose, no need to deprecate it.

  • lsp/config.lua

    +-- set to nil to disable overriding lsp handlers
     lvim.lsp.float = { ... }
  • handlers.lua

    +if lvim.lsp.float then
       vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, lvim.lsp.float)
       vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, lvim.lsp.float)
    +end

@cpea2506
Copy link
Member Author

cpea2506 commented Mar 3, 2023

we can use lvim.lsp.float for this purpose, no need to deprecate it.

  • lsp/config.lua
    +-- set to nil to disable overriding lsp handlers
     lvim.lsp.float = { ... }
  • handlers.lua
    +if lvim.lsp.float then
       vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, lvim.lsp.float)
       vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, lvim.lsp.float)
    +end

lvim.lsp.float seems hard for user to know what it does and where it was put unless they dive into lsp source code

@LostNeophyte
Copy link
Member

lvim.lsp.float seems hard for user to know what it does and where it was put unless they dive into lsp source code

I agree, float isn't that descriptive

@LostNeophyte LostNeophyte requested a review from kylo252 March 3, 2023 07:29
@mamaraddio
Copy link
Contributor

Hi guys, as a user that faced this issue I can say it could be great if you could put a line in the Lunarvim docs explaining how to use it and make it settable from config.lua just like other options instead of changing lsp configuration code

@LostNeophyte
Copy link
Member

Hi guys, as a user that faced this issue I can say it could be great if you could put a line in the Lunarvim docs explaining how to use it and make it settable from config.lua just like other options instead of changing lsp configuration code

that's what this pr is doing

Copy link
Collaborator

@kylo252 kylo252 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that it's time to change this since it was limited, but I'm not sure if it's wise to introduce even more obscure variables. Please take a look at #2344

The ideal solution is to mimic how vim.lsp works:

  • create a table that exactly matches the entries passed to vim.lsp.config
  • override handlers using a public re-usable API, e.g. lvim.lsp.handlers

(Important!) make sure all of the above is set once at startup

@kylo252 kylo252 marked this pull request as draft March 8, 2023 09:06
@kylo252 kylo252 added the LSP LSP Related issues label Mar 8, 2023
@cpea2506
Copy link
Member Author

cpea2506 commented Apr 9, 2023

The ideal solution is to mimic how vim.lsp works:

  • create a table that exactly matches the entries passed to vim.lsp.config
  • override handlers using a public re-usable API, e.g. lvim.lsp.handlers

(Important!) make sure all of the above is set once at startup

Sorry for the late response!

  • Should I create a new lsp/diagnostics.lua file to load the default config for vim.diagnostics.config or handle it in handlers.lua as is?
  • For the handler I think I should simply remove the override_config inside.

@cpea2506 cpea2506 force-pushed the feat/handlers-override branch from 8f86ae0 to 2e52e5e Compare April 10, 2023 23:43
@cpea2506 cpea2506 changed the title refactor(lsp): allow to disable custom handlers config refactor(lsp)!: deprecate lvim.lsp.diagnostics Apr 10, 2023
@cpea2506 cpea2506 marked this pull request as ready for review April 10, 2023 23:54
lua/lvim/config/_deprecated.lua Outdated Show resolved Hide resolved
lua/lvim/config/_deprecated.lua Outdated Show resolved Hide resolved
lua/lvim/lsp/handlers.lua Outdated Show resolved Hide resolved
lua/lvim/lsp/init.lua Outdated Show resolved Hide resolved
lua/lvim/lsp/handlers.lua Outdated Show resolved Hide resolved
@cpea2506 cpea2506 force-pushed the feat/handlers-override branch 2 times, most recently from 31a11d0 to 583a042 Compare April 21, 2023 07:08
@cpea2506 cpea2506 force-pushed the feat/handlers-override branch from 583a042 to e695966 Compare April 24, 2023 12:26
Copy link
Collaborator

@kylo252 kylo252 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cpea2506, I made some minor changes to clean up a few things, and also make the deprecation message clearer with regards to how to handle it.

image

Just need you guys to test it, otherwise LGTM! 🚀

@kylo252 kylo252 merged commit 9e86655 into master May 2, 2023
@kylo252 kylo252 deleted the feat/handlers-override branch May 2, 2023 07:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
LSP LSP Related issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

add option to not override lsp handlers Deprecate redundant lvim.lsp.diagnostics
6 participants