refactor(lsp)!: use vim.lsp.config; drop generic LSP features - #10
Merged
Merged
Conversation
Replace lua/iwe/lsp.lua (manual vim.lsp.start + LspAttach handling) with a minimal lsp/iwes.lua (vim.lsp.Config) enabled via vim.lsp.enable('iwes').
Why remove the generic LSP bits — they are not IWE-specific:
- inlay hints: toggling inlay hints is generic LSP functionality. If IWE ships its own toggle, every LSP plugin could ship its own — bloated. Users can toggle inlay hints per buffer themselves (see `:h vim.lsp.inlay_hint.enable()`.
- folding: likewise generic. Users should choose LSP folding, Treesitter folding, or indent folding themselves; a plugin shouldn't ship code to force one. Dedicated plugins already do this well, e.g. nvim-origami (LSP folds with Treesitter fallback, then indent).
- format-on-save: handled by dedicated plugins such as conform.nvim, or a few lines of user LspAttach autocmd; IWE should not configure it.
Cleanup mapping:
| Before | After |
| --------------------------------- | ---------------------------------------------------------------- |
| `lua/iwe/lsp.lua` `vim.lsp.start` | `lsp/iwes.lua` (`vim.lsp.Config`) |
| `FileType` autocmd + catch-up | `vim.lsp.enable('iwes')` in `setup()` |
| `:IWE lsp start/stop/restart` | `:lsp enable/disable/restart` |
| `:IWE lsp toggle_inlay_hints` | `vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled())` |
| inlay/folding/format-on-save | user `LspAttach` / nvim-origami / conform.nvim |
| `config.lsp.*` (6 options) | removed |
| `start_lsp()` / `lsp_available()` | removed |
- add workspace_required to lsp/iwes.lua so iwes only attaches inside .iwe projects instead of starting in single-file mode for any markdown file - raise the version guard to nvim-0.11.2 (workspace_required and the vim.lsp.enable() catch-up for already-open buffers both landed in 0.11.2) and warn instead of silently skipping LSP on older versions - warn once when the removed lsp setup options are passed and strip them from the merged config - add a Neovim version health check - docs: state the 0.11.2 minimum, note that :lsp commands are 0.12+, show the vim.lsp.enable() equivalents, and add a migration section (iwe-lsp-migration) covering format-on-save, folding, inlay hints, and vim.lsp.config overrides - update CLAUDE.md for the new lsp/iwes.lua layout
Contributor
|
Hey @mxlnmist, thank you for the PR! Much appreciated. I added some review changes as an additional commit here. Happy to merge if the change looks good to you. |
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follows this discussion in reddit
These are breaaking changes. I'll add some backward capativity later, if possible.
Replace lua/iwe/lsp.lua (manual vim.lsp.start + LspAttach handling) with a minimal lsp/iwes.lua (vim.lsp.Config) enabled via vim.lsp.enable('iwes').
Why remove the generic LSP bits — they are not IWE-specific:
:h vim.lsp.inlay_hint.enable().Cleanup mapping:
lua/iwe/lsp.luavim.lsp.startlsp/iwes.lua(vim.lsp.Config)FileTypeautocmd + catch-upvim.lsp.enable('iwes')insetup():IWE lsp start/stop/restart:lsp enable/disable/restart:IWE lsp toggle_inlay_hintsvim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled())LspAttach/ nvim-origami / conform.nvimconfig.lsp.*(6 options)start_lsp()/lsp_available()