fix project settings regression
This commit is contained in:
parent
976949c6f4
commit
71beb0fb78
4 changed files with 184 additions and 26 deletions
24
.github/copilot-instructions.md
vendored
24
.github/copilot-instructions.md
vendored
|
|
@ -29,23 +29,35 @@ Modern Lua-first Neovim configuration using lazy.nvim, currently in active migra
|
|||
### 1. LSP Configuration (Phase 3 Complete)
|
||||
**Modern API (Neovim 0.11+)**: Uses `vim.lsp.config()` + `vim.lsp.enable()`, NOT `require('lspconfig')[server].setup()`.
|
||||
|
||||
**CRITICAL (2025-12-07)**: Neovim 0.11+ does NOT support `on_new_config` callback. Use `LspAttach` autocmd instead.
|
||||
|
||||
```lua
|
||||
-- lua/plugins/lsp.lua pattern:
|
||||
-- Define config
|
||||
vim.lsp.config(server_name, {
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
on_new_config = function(new_config, root_dir)
|
||||
-- Load project settings from root_dir/.nvim.lua
|
||||
-- NO on_attach here, NO on_new_config here
|
||||
})
|
||||
|
||||
-- Enable server
|
||||
vim.lsp.enable({ "lua_ls", "intelephense", ... })
|
||||
|
||||
-- Load project settings via LspAttach autocmd
|
||||
vim.api.nvim_create_autocmd('LspAttach', {
|
||||
callback = function(args)
|
||||
local client = vim.lsp.get_client_by_id(args.data.client_id)
|
||||
-- Load .nvim.lua from client.root_dir
|
||||
-- Merge into client.settings
|
||||
-- Send workspace/didChangeConfiguration notification
|
||||
end,
|
||||
})
|
||||
vim.lsp.enable({ "lua_ls", "intelephense", ... })
|
||||
```
|
||||
|
||||
**Key decisions**:
|
||||
- No neoconf (incompatible with Neovim 0.11+, issue #116)
|
||||
- Native `exrc` + `secure` for project config (see settings.lua)
|
||||
- `on_new_config` hook loads from actual `root_dir`, not cwd
|
||||
- `workspace/didChangeConfiguration` sent in `on_attach` for servers like intelephense
|
||||
- Project settings loaded via `LspAttach` autocmd (NOT `on_new_config` which is deprecated)
|
||||
- `workspace/didChangeConfiguration` sent after merging settings into `client.settings`
|
||||
|
||||
### 2. Project-Local Configuration
|
||||
**Format**: `.nvim.lua` at project root, returns:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue