Skip to content

Commit 6222da8

Browse files
ray-xCopilot
andauthored
breaking changes for nvim 0.11 (#320)
* changes for nvim 0.11 * deprecate mason lspconfig setting, use LspAttach instead * github action updates * update treesitter spec * github action * update minium.vim * remove minimal_init * force check nvim 0.11 * updates for preview context * use lsp.Methods * change 'client.request to client:request' for nvim 0.11 * Update README.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * bugfix for typos * gopls updates * warning msg updates * warn func revert * key mapping updates * backward compatible nvim 0.10 * fix logs * backward comp with nvim 010 * load config from 'lsp' folder * updates warnings, readme * update key mpas and warnings * add warning of old key mappings * doc updates for code_action_prompt --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 97cb006 commit 6222da8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+834
-1067
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ jobs:
1919
manager: sudo snap
2020
packages: go
2121
- os: ubuntu-22.04
22-
url: https://github.com/neovim/neovim/releases/download/v0.10.4/nvim-linux-x86_64.tar.gz
22+
url: https://github.com/neovim/neovim/releases/download/v0.11.0/nvim-linux-x86_64.tar.gz
2323
manager: sudo snap
2424
packages: go
2525
steps:
2626
- uses: actions/checkout@v4
2727
- uses: actions/setup-go@v5
2828
with:
29-
go-version: "^1.21.0" # The Go version to download (if necessary) and use.
29+
go-version: "^1.24.0" # The Go version to download (if necessary) and use.
3030
- run: date +%F > todays-date
3131
- name: Restore cache for today's nightly.
3232
uses: actions/cache@v4

Makefile

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,25 @@
1+
PACKER_DIR = ~/.local/share/nvim/site/pack/vendor/start
2+
localtestsetup:
3+
@mkdir -p $(PACKER_DIR)
4+
@mkdir -p ~/tmp
5+
6+
@test -d $(PACKER_DIR)/plenary.nvim ||\
7+
git clone --depth 1 https://github.com/nvim-lua/plenary.nvim $(PACKER_DIR)/plenary.nvim
8+
9+
@test -d $(PACKER_DIR)/nvim-lspconfig ||\
10+
git clone --depth 1 https://github.com/neovim/nvim-lspconfig $(PACKER_DIR)/nvim-lspconfig
11+
12+
@test -d $(PACKER_DIR)/guihua.lua ||\
13+
git clone --depth 1 https://github.com/ray-x/guihua.lua $(PACKER_DIR)/guihua.lua
14+
15+
@test -d $(PACKER_DIR)/nvim-treesitter ||\
16+
git clone --depth 1 https://github.com/nvim-treesitter/nvim-treesitter $(PACKER_DIR)/nvim-treesitter
17+
18+
@test -d $(PACKER_DIR)/navigator.lua || ln -s ${shell pwd} $(PACKER_DIR)
19+
20+
21+
localtestts: localtestsetup
22+
nvim --headless --noplugin -u tests/minimal.vim -c "PlenaryBustedFile tests/treesitter_spec.lua"
23+
124
test:
225
nvim --headless --noplugin -u tests/minimal.vim -c "PlenaryBustedDirectory tests/ "

README.md

Lines changed: 18 additions & 137 deletions
Original file line numberDiff line numberDiff line change
@@ -239,14 +239,8 @@ require'navigator'.setup({
239239
preview_height = 0.35, -- max height of preview windows
240240
border = {"", "", "", "", "", "", "", ""}, -- border style, can be one of 'none', 'single', 'double',
241241
-- 'shadow', or a list of chars which defines the border
242-
on_attach = function(client, bufnr)
243-
-- your hook
242+
on_attach = function(client, bufnr) -- no longer supported for nvim > 0.11 use your own LspAttach autocmd
244243
end,
245-
-- put a on_attach of your own here, e.g
246-
-- function(client, bufnr)
247-
-- -- the on_attach will be called at end of navigator on_attach
248-
-- end,
249-
-- The attach code will apply to all LSP clients
250244

251245
ts_fold = {
252246
enable = false,
@@ -284,7 +278,7 @@ require'navigator'.setup({
284278
separator = '', -- e.g. shows  3 lines 
285279
},
286280
},
287-
mason = false, -- set to true if you would like use the lsp installed by williamboman/mason
281+
mason = false, -- Deprecated, mason no longer supported as setup lsp changed in nvim 0.11
288282
lsp = {
289283
enable = true, -- skip lsp setup, and only use treesitter in navigator.
290284
-- Use this if you are not using LSP servers, and only want to enable treesitter support.
@@ -351,42 +345,23 @@ require'navigator'.setup({
351345
diagnostic_update_in_insert = false, -- update diagnostic message in insert mode
352346
display_diagnostic_qf = true, -- always show quickfix if there are diagnostic errors, set to false if you want to ignore it
353347
-- set to 'trouble' to show diagnostcs in Trouble
354-
ts_ls = {
355-
filetypes = {'typescript'} -- disable javascript etc,
356-
-- set to {} to disable the lspclient for all filetypes
357-
},
358348
ctags ={
359349
cmd = 'ctags',
360350
tagfile = 'tags',
361351
options = '-R --exclude=.git --exclude=node_modules --exclude=test --exclude=vendor --excmd=number',
362352
},
363-
gopls = { -- gopls setting
364-
on_attach = function(client, bufnr) -- on_attach for gopls
365-
-- your special on attach here
366-
-- e.g. disable gopls format because a known issue https://github.com/golang/go/issues/45732
367-
print("i am a hook, I will disable document format")
368-
client.resolved_capabilities.document_formatting = false
369-
end,
370-
settings = {
371-
gopls = {gofumpt = false} -- disable gofumpt etc,
372-
}
353+
-- lsp setup and config no longer supported for nvim 0.11
354+
-- refer to nvim 0.11 lsp setup doc and lspconfig for more info
355+
ts_ls = { -- no longer supported for nvim 0.11
356+
},
357+
gopls = { -- no longer supported for nvim 0.11
373358
},
374359
-- the lsp setup can be a function, .e.g
375-
gopls = function()
376-
local go = pcall(require, "go")
377-
if go then
378-
local cfg = require("go.lsp").config()
379-
cfg.on_attach = function(client)
380-
client.server_capabilities.documentFormattingProvider = false -- efm/null-ls
381-
end
382-
return cfg
383-
end
360+
gopls = function() -- no longer supported for nvim 0.11
384361
end,
385362

386-
lua_ls = {
387-
sumneko_root_path = vim.fn.expand("$HOME") .. "/github/sumneko/lua-language-server",
388-
sumneko_binary = vim.fn.expand("$HOME") .. "/github/sumneko/lua-language-server/bin/macOS/lua-language-server",
389-
},
363+
lua_ls = { }, -- no longer supported
364+
390365
servers = {'cmake', 'ltex'}, -- by default empty, and it should load all LSP clients available based on filetype
391366
-- but if you want navigator load e.g. `cmake` and `ltex` for you , you
392367
-- can put them in the `servers` list and navigator will auto load them.
@@ -569,107 +544,13 @@ Terminal nerdfont and emoji capacity. I am using Kitty with nerdfont (Victor Mon
569544

570545
## Integrate with williamboman/mason.nvim
571546

572-
If you are using mason and would like to use the lsp servers installed by mason. Please set
573-
574-
```lua
575-
mason = true -- mason user
576-
```
577-
578-
In the config. Also please setup the lsp server from installer setup with `server:setup{opts}`
579-
580-
for mason
547+
Note: mason lspconfig no longger support as of navigator nvim 0.11 branch The only change you need in in LspAttach event
548+
add if you prefer to use mason lspconfig
581549

582550
```lua
583-
use("williamboman/mason.nvim")
584-
use({
585-
"williamboman/mason-lspconfig.nvim",
586-
config = function()
587-
require("mason").setup()
588-
require("mason-lspconfig").setup({})
589-
end,
590-
})
591-
592-
use({
593-
"ray-x/navigator.lua",
594-
requires = {
595-
{ "ray-x/guihua.lua", run = "cd lua/fzy && make" },
596-
{ "neovim/nvim-lspconfig" },
597-
{ "nvim-treesitter/nvim-treesitter" },
598-
},
599-
config = function()
600-
require("navigator").setup({
601-
mason = true,
602-
})
603-
end,
604-
})
605-
```
606-
607-
Another way to setup mason is disable navigator lsp setup and using mason setup handlers, pylsp for example
608-
609-
```lua
610-
use("williamboman/mason.nvim")
611-
use({
612-
"williamboman/mason-lspconfig.nvim",
613-
config = function()
614-
require("mason").setup()
615-
require("mason-lspconfig").setup_handlers({
616-
["pylsp"] = function()
617-
require("lspconfig").pylsp.setup({
618-
on_attach = function(client, bufnr)
619-
require("navigator.lspclient.mapping").setup({ client = client, bufnr = bufnr }) -- setup navigator keymaps here,
620-
require("navigator.dochighlight").documentHighlight(bufnr)
621-
require("navigator.codeAction").code_action_prompt(client, bufnr)
622-
end,
623-
})
624-
end,
625-
})
626-
require("mason-lspconfig").setup({})
627-
end,
628-
})
629-
630-
use({
631-
"navigator.lua",
632-
requires = {
633-
{ "ray-x/guihua.lua", run = "cd lua/fzy && make" },
634-
{ "nvim-lspconfig" },
635-
{ "nvim-treesitter/nvim-treesitter" },
636-
},
637-
config = function()
638-
require("navigator").setup({
639-
mason = true,
640-
lsp = { disable_lsp = { "pylsp" } }, -- disable pylsp setup from navigator
641-
})
642-
end,
643-
})
644-
```
645-
646-
Alternatively, Navigator can be used to startup the server installed by mason. as it will override the navigator setup
647-
648-
To start LSP installed by mason, please use following setups
649-
650-
```lua
651-
require'navigator'.setup({
652-
-- mason = false -- default value is false
653-
lsp = {
654-
ts_ls = { cmd = {'your typescript-language-server installed by mason'} }
655-
-- e.g. ts_ls = { cmd = {'/home/username/.local/share/nvim/mason/packages/typescript-language-server/node_modules/typescript/bin/typescript-language-server'} }
656-
657-
}
658-
})
659-
```
660-
661-
example cmd setup (mac) for pyright :
662-
663-
```lua
664-
require'navigator'.setup({
665-
-- mason = false -- default value is false
666-
667-
lsp = {
668-
pyright = {
669-
cmd = { "/Users/username/.local/share/nvim/lsp_servers/python/node_modules/.bin/pyright-langserver", "--stdio" }
670-
}
671-
}
672-
}
551+
require("navigator.lspclient.mapping").setup({ client = client, bufnr = bufnr }) -- setup navigator keymaps here,
552+
require("navigator.dochighlight").documentHighlight(bufnr)
553+
require("navigator.codeAction").code_action_prompt(client, bufnr)
673554
```
674555

675556
### Integration with other lsp plugins (e.g. rust-tools, go.nvim, clangd extension)
@@ -697,7 +578,7 @@ use {"ray-x/navigator.lua",
697578
}
698579
```
699580

700-
- Here is an example to setup rust with rust-tools
581+
- Here is an example to setup rust with rust-tools (nvim < 0.11)
701582

702583
```lua
703584
require('rust-tools').setup({
@@ -706,7 +587,7 @@ require('rust-tools').setup({
706587
require('navigator.lspclient.mapping').setup({client=client, bufnr=bufnr}) -- setup navigator keymaps here,
707588

708589
require("navigator.dochighlight").documentHighlight(bufnr)
709-
require('navigator.codeAction').code_action_prompt(bufnr)
590+
require('navigator.codeAction').code_action_prompt(client, bufnr)
710591
-- otherwise, you can define your own commands to call navigator functions
711592
end,
712593
}
@@ -717,7 +598,7 @@ require("clangd_extensions").setup {
717598
on_attach = function(client, bufnr)
718599
require('navigator.lspclient.mapping').setup({client=client, bufnr=bufnr}) -- setup navigator keymaps here,
719600
require("navigator.dochighlight").documentHighlight(bufnr)
720-
require('navigator.codeAction').code_action_prompt(bufnr)
601+
require('navigator.codeAction').code_action_prompt(client, bufnr)
721602
-- otherwise, you can define your own commands to call navigator functions
722603
end,
723604
}

doc/navigator.txt

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -331,21 +331,6 @@ Nondefault configuration example:
331331
tagfile = 'tags'
332332
options = '-R --exclude=.git --exclude=node_modules --exclude=test --exclude=vendor --excmd=number'
333333
}
334-
gopls = { -- gopls setting
335-
on_attach = function(client, bufnr) -- on_attach for gopls
336-
-- your special on attach here
337-
-- e.g. disable gopls format because a known issue https://github.com/golang/go/issues/45732
338-
print("i am a hook, I will disable document format")
339-
client.resolved_capabilities.document_formatting = false
340-
end,
341-
settings = {
342-
gopls = {gofumpt = false} -- disable gofumpt etc,
343-
}
344-
},
345-
lua_ls = {
346-
sumneko_root_path = vim.fn.expand("$HOME") .. "/github/sumneko/lua-language-server",
347-
sumneko_binary = vim.fn.expand("$HOME") .. "/github/sumneko/lua-language-server/bin/macOS/lua-language-server",
348-
},
349334
servers = {'cmake', 'ltex'}, -- by default empty, and it should load all LSP clients avalible based on filetype
350335
-- but if you whant navigator load e.g. `cmake` and `ltex` for you , you
351336
-- can put them in the `servers` list and navigator will auto load them.

lsp/ccls.lua

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
return {
2+
init_options = {
3+
compilationDatabaseDirectory = 'build',
4+
root_dir =
5+
[[ util.root_pattern("compile_commands.json", "compile_flags.txt", "CMakeLists.txt", "Makefile", ".git") or util.path.dirname ]],
6+
index = { threads = 2 },
7+
clang = { excludeArgs = { '-frounding-math' } },
8+
},
9+
flags = { allow_incremental_sync = true },
10+
}

lsp/clangd.lua

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
return {
2+
flags = { allow_incremental_sync = true, debounce_text_changes = 500 },
3+
cmd = {
4+
'clangd',
5+
'--background-index',
6+
'--suggest-missing-includes',
7+
'--clang-tidy',
8+
'--header-insertion=iwyu',
9+
'--enable-config',
10+
'--offset-encoding=utf-16',
11+
'--clang-tidy-checks=-*,llvm-*,clang-analyzer-*',
12+
'--cross-file-rename',
13+
},
14+
filetypes = { 'c', 'cpp', 'objc', 'objcpp' },
15+
}

lsp/gopls.lua

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
local util = require('lspconfig').util
2+
local hasgo = pcall(require 'go')
3+
if hasgo then
4+
return require('go.lsp').config()
5+
end
6+
return {
7+
-- capabilities = cap,
8+
filetypes = { 'go', 'gomod', 'gohtmltmpl', 'gotexttmpl' },
9+
message_level = vim.lsp.protocol.MessageType.Error,
10+
cmd = {
11+
'gopls', -- share the gopls instance if there is one already
12+
'-remote=auto', --[[ debug options ]] --
13+
-- "-logfile=auto",
14+
-- "-debug=:0",
15+
'-remote.debug=:0',
16+
-- "-rpc.trace",
17+
},
18+
19+
flags = { allow_incremental_sync = true, debounce_text_changes = 1000 },
20+
settings = {
21+
gopls = {
22+
-- more settings: https://github.com/golang/tools/blob/master/gopls/doc/settings.md
23+
-- flags = {allow_incremental_sync = true, debounce_text_changes = 500},
24+
-- not supported
25+
analyses = { unusedparams = true, unreachable = false },
26+
codelenses = {
27+
generate = true, -- show the `go generate` lens.
28+
gc_details = true, -- // Show a code lens toggling the display of gc's choices.
29+
test = true,
30+
tidy = true,
31+
},
32+
usePlaceholders = true,
33+
completeUnimported = true,
34+
staticcheck = true,
35+
matcher = 'fuzzy',
36+
diagnosticsDelay = '500ms',
37+
symbolMatcher = 'fuzzy',
38+
gofumpt = false, -- true, -- turn on for new repos, gofmpt is good but also create code turmoils
39+
buildFlags = { '-tags', 'integration' },
40+
-- buildFlags = {"-tags", "functional"}
41+
semanticTokens = false,
42+
},
43+
},
44+
}

lsp/jdtls.lua

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
return {
2+
settings = {
3+
java = {
4+
signatureHelp = { enabled = true },
5+
contentProvider = { preferred = 'fernflower' },
6+
},
7+
},
8+
}

0 commit comments

Comments
 (0)