Skip to content

refactor(lsp)!: use vim.lsp.config; drop generic LSP features - #10

Merged
gimalay merged 2 commits into
iwe-org:mainfrom
mxlnmist:refactor/lsp-vim-lsp-config
Aug 16, 2026
Merged

gimalay merged 2 commits into
iwe-org:mainfrom
mxlnmist:refactor/lsp-vim-lsp-config

Conversation

@mxlnmist

Copy link
Copy Markdown
Contributor

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:

  • 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

mxlnmist and others added 2 commits August 17, 2026 02:38
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
@gimalay

gimalay commented Aug 16, 2026

Copy link
Copy Markdown
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.

@mxlnmist

Copy link
Copy Markdown
Contributor Author

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.

@gimalay Thanks. These changes works for me.

@gimalay
gimalay merged commit dae7667 into iwe-org:main Aug 16, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants