Skip to content

breaking changes for nvim 0.11 #320

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

Open
wants to merge 31 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
6a32f32
changes for nvim 0.11
ray-x Mar 28, 2025
d7a9615
deprecate mason lspconfig setting, use LspAttach instead
ray-x Mar 30, 2025
9bc2cc7
github action updates
ray-x Mar 30, 2025
3b9eac9
update treesitter spec
ray-x Mar 30, 2025
41084e8
github action
ray-x Mar 30, 2025
4e24d5b
update minium.vim
ray-x Mar 30, 2025
b0a0814
remove minimal_init
ray-x Mar 30, 2025
083602a
force check nvim 0.11
ray-x Mar 30, 2025
ef2464e
merge master
ray-x Mar 30, 2025
e5d3d7e
updates for preview context
ray-x Mar 31, 2025
a7718bb
Merge branch 'master' into nvim_0.11
ray-x Mar 31, 2025
4e20874
Merge branch 'master' into nvim_0.11
ray-x Apr 1, 2025
96db708
Merge branch 'master' into nvim_0.11
ray-x Apr 1, 2025
b18a29b
Merge branch 'master' into nvim_0.11
ray-x Apr 1, 2025
bb7afea
use lsp.Methods
ray-x Apr 1, 2025
9dae84f
Merge branch 'master' into nvim_0.11
ray-x Apr 1, 2025
9784326
change 'client.request to client:request' for nvim 0.11
ray-x Apr 1, 2025
251f11d
Update README.md
ray-x Apr 2, 2025
9a2ec45
bugfix for typos
ray-x Apr 2, 2025
9bc5e1a
Merge branch 'nvim_0.11' of github.com:ray-x/navigator.lua into nvim_…
ray-x Apr 2, 2025
283342c
gopls updates
ray-x Apr 4, 2025
20ac4c6
warning msg updates
ray-x Apr 7, 2025
03d476b
warn func revert
ray-x Apr 7, 2025
64a7ac6
Merge branch 'master' into nvim_0.11
ray-x Apr 20, 2025
fc5a696
key mapping updates
ray-x Apr 21, 2025
bbd5d59
backward compatible nvim 0.10
ray-x Apr 28, 2025
0440408
fix logs
ray-x Apr 28, 2025
296ab98
backward comp with nvim 010
ray-x Apr 28, 2025
1cdb5e5
load config from 'lsp' folder
ray-x Apr 28, 2025
032fe55
updates warnings, readme
ray-x Apr 29, 2025
e9bc036
update key mpas and warnings
ray-x Apr 29, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ jobs:
manager: sudo snap
packages: go
- os: ubuntu-22.04
url: https://github.com/neovim/neovim/releases/download/v0.10.4/nvim-linux-x86_64.tar.gz
url: https://github.com/neovim/neovim/releases/download/v0.11.0/nvim-linux-x86_64.tar.gz
manager: sudo snap
packages: go
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "^1.21.0" # The Go version to download (if necessary) and use.
go-version: "^1.24.0" # The Go version to download (if necessary) and use.
- run: date +%F > todays-date
- name: Restore cache for today's nightly.
uses: actions/cache@v4
Expand Down
23 changes: 23 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,2 +1,25 @@
PACKER_DIR = ~/.local/share/nvim/site/pack/vendor/start
localtestsetup:
@mkdir -p $(PACKER_DIR)
@mkdir -p ~/tmp

@test -d $(PACKER_DIR)/plenary.nvim ||\
git clone --depth 1 https://github.com/nvim-lua/plenary.nvim $(PACKER_DIR)/plenary.nvim

@test -d $(PACKER_DIR)/nvim-lspconfig ||\
git clone --depth 1 https://github.com/neovim/nvim-lspconfig $(PACKER_DIR)/nvim-lspconfig

@test -d $(PACKER_DIR)/guihua.lua ||\
git clone --depth 1 https://github.com/ray-x/guihua.lua $(PACKER_DIR)/guihua.lua

@test -d $(PACKER_DIR)/nvim-treesitter ||\
git clone --depth 1 https://github.com/nvim-treesitter/nvim-treesitter $(PACKER_DIR)/nvim-treesitter

@test -d $(PACKER_DIR)/navigator.lua || ln -s ${shell pwd} $(PACKER_DIR)


localtestts: localtestsetup
nvim --headless --noplugin -u tests/minimal.vim -c "PlenaryBustedFile tests/treesitter_spec.lua"

test:
nvim --headless --noplugin -u tests/minimal.vim -c "PlenaryBustedDirectory tests/ "
151 changes: 16 additions & 135 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -239,14 +239,8 @@ require'navigator'.setup({
preview_height = 0.35, -- max height of preview windows
border = {"╭", "─", "╮", "│", "╯", "─", "╰", "│"}, -- border style, can be one of 'none', 'single', 'double',
-- 'shadow', or a list of chars which defines the border
on_attach = function(client, bufnr)
-- your hook
on_attach = function(client, bufnr) -- no longer supported for nvim > 0.11 use your own LspAttach autocmd
end,
-- put a on_attach of your own here, e.g
-- function(client, bufnr)
-- -- the on_attach will be called at end of navigator on_attach
-- end,
-- The attach code will apply to all LSP clients

ts_fold = {
enable = false,
Expand Down Expand Up @@ -284,7 +278,7 @@ require'navigator'.setup({
separator = '', -- e.g. shows  3 lines 
},
},
mason = false, -- set to true if you would like use the lsp installed by williamboman/mason
mason = false, -- Deprecated, mason no longer supported as setup lsp changed in nvim 0.11
lsp = {
enable = true, -- skip lsp setup, and only use treesitter in navigator.
-- Use this if you are not using LSP servers, and only want to enable treesitter support.
Expand Down Expand Up @@ -351,42 +345,23 @@ require'navigator'.setup({
diagnostic_update_in_insert = false, -- update diagnostic message in insert mode
display_diagnostic_qf = true, -- always show quickfix if there are diagnostic errors, set to false if you want to ignore it
-- set to 'trouble' to show diagnostcs in Trouble
ts_ls = {
filetypes = {'typescript'} -- disable javascript etc,
-- set to {} to disable the lspclient for all filetypes
},
ctags ={
cmd = 'ctags',
tagfile = 'tags',
options = '-R --exclude=.git --exclude=node_modules --exclude=test --exclude=vendor --excmd=number',
},
gopls = { -- gopls setting
on_attach = function(client, bufnr) -- on_attach for gopls
-- your special on attach here
-- e.g. disable gopls format because a known issue https://github.com/golang/go/issues/45732
print("i am a hook, I will disable document format")
client.resolved_capabilities.document_formatting = false
end,
settings = {
gopls = {gofumpt = false} -- disable gofumpt etc,
}
-- lsp setup and config no longer supported for nvim 0.11
-- refer to nvim 0.11 lsp setup doc and lspconfig for more info
ts_ls = { -- no longer supported for nvim 0.11
},
gopls = { -- no longer supported for nvim 0.11
},
-- the lsp setup can be a function, .e.g
gopls = function()
local go = pcall(require, "go")
if go then
local cfg = require("go.lsp").config()
cfg.on_attach = function(client)
client.server_capabilities.documentFormattingProvider = false -- efm/null-ls
end
return cfg
end
gopls = function() -- no longer supported for nvim 0.11
end,

lua_ls = {
sumneko_root_path = vim.fn.expand("$HOME") .. "/github/sumneko/lua-language-server",
sumneko_binary = vim.fn.expand("$HOME") .. "/github/sumneko/lua-language-server/bin/macOS/lua-language-server",
},
lua_ls = { }, -- no longer supported

servers = {'cmake', 'ltex'}, -- by default empty, and it should load all LSP clients available based on filetype
-- but if you want navigator load e.g. `cmake` and `ltex` for you , you
-- can put them in the `servers` list and navigator will auto load them.
Expand Down Expand Up @@ -569,107 +544,13 @@ Terminal nerdfont and emoji capacity. I am using Kitty with nerdfont (Victor Mon

## Integrate with williamboman/mason.nvim

If you are using mason and would like to use the lsp servers installed by mason. Please set

```lua
mason = true -- mason user
```

In the config. Also please setup the lsp server from installer setup with `server:setup{opts}`

for mason
Note: mason lspconfig no longger support as of navigator nvim 0.11 branch The only change you need in in LspAttach event
add if you prefer to use mason lspconfig

```lua
use("williamboman/mason.nvim")
use({
"williamboman/mason-lspconfig.nvim",
config = function()
require("mason").setup()
require("mason-lspconfig").setup({})
end,
})

use({
"ray-x/navigator.lua",
requires = {
{ "ray-x/guihua.lua", run = "cd lua/fzy && make" },
{ "neovim/nvim-lspconfig" },
{ "nvim-treesitter/nvim-treesitter" },
},
config = function()
require("navigator").setup({
mason = true,
})
end,
})
```

Another way to setup mason is disable navigator lsp setup and using mason setup handlers, pylsp for example

```lua
use("williamboman/mason.nvim")
use({
"williamboman/mason-lspconfig.nvim",
config = function()
require("mason").setup()
require("mason-lspconfig").setup_handlers({
["pylsp"] = function()
require("lspconfig").pylsp.setup({
on_attach = function(client, bufnr)
require("navigator.lspclient.mapping").setup({ client = client, bufnr = bufnr }) -- setup navigator keymaps here,
require("navigator.dochighlight").documentHighlight(bufnr)
require("navigator.codeAction").code_action_prompt(bufnr)
end,
})
end,
})
require("mason-lspconfig").setup({})
end,
})

use({
"navigator.lua",
requires = {
{ "ray-x/guihua.lua", run = "cd lua/fzy && make" },
{ "nvim-lspconfig" },
{ "nvim-treesitter/nvim-treesitter" },
},
config = function()
require("navigator").setup({
mason = true,
lsp = { disable_lsp = { "pylsp" } }, -- disable pylsp setup from navigator
})
end,
})
```

Alternatively, Navigator can be used to startup the server installed by mason. as it will override the navigator setup

To start LSP installed by mason, please use following setups

```lua
require'navigator'.setup({
-- mason = false -- default value is false
lsp = {
ts_ls = { cmd = {'your typescript-language-server installed by mason'} }
-- e.g. ts_ls = { cmd = {'/home/username/.local/share/nvim/mason/packages/typescript-language-server/node_modules/typescript/bin/typescript-language-server'} }

}
})
```

example cmd setup (mac) for pyright :

```lua
require'navigator'.setup({
-- mason = false -- default value is false

lsp = {
pyright = {
cmd = { "/Users/username/.local/share/nvim/lsp_servers/python/node_modules/.bin/pyright-langserver", "--stdio" }
}
}
}
require("navigator.lspclient.mapping").setup({ client = client, bufnr = bufnr }) -- setup navigator keymaps here,
require("navigator.dochighlight").documentHighlight(bufnr)
require("navigator.codeAction").code_action_prompt(bufnr)
```

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

- Here is an example to setup rust with rust-tools
- Here is an example to setup rust with rust-tools (nvim < 0.11)

```lua
require('rust-tools').setup({
Expand Down
15 changes: 0 additions & 15 deletions doc/navigator.txt
Original file line number Diff line number Diff line change
Expand Up @@ -331,21 +331,6 @@ Nondefault configuration example:
tagfile = 'tags'
options = '-R --exclude=.git --exclude=node_modules --exclude=test --exclude=vendor --excmd=number'
}
gopls = { -- gopls setting
on_attach = function(client, bufnr) -- on_attach for gopls
-- your special on attach here
-- e.g. disable gopls format because a known issue https://github.com/golang/go/issues/45732
print("i am a hook, I will disable document format")
client.resolved_capabilities.document_formatting = false
end,
settings = {
gopls = {gofumpt = false} -- disable gofumpt etc,
}
},
lua_ls = {
sumneko_root_path = vim.fn.expand("$HOME") .. "/github/sumneko/lua-language-server",
sumneko_binary = vim.fn.expand("$HOME") .. "/github/sumneko/lua-language-server/bin/macOS/lua-language-server",
},
servers = {'cmake', 'ltex'}, -- by default empty, and it should load all LSP clients avalible based on filetype
-- but if you whant navigator load e.g. `cmake` and `ltex` for you , you
-- can put them in the `servers` list and navigator will auto load them.
Expand Down
10 changes: 10 additions & 0 deletions lsp/ccls.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
return {
init_options = {
compilationDatabaseDirectory = 'build',
root_dir =
[[ util.root_pattern("compile_commands.json", "compile_flags.txt", "CMakeLists.txt", "Makefile", ".git") or util.path.dirname ]],
index = { threads = 2 },
clang = { excludeArgs = { '-frounding-math' } },
},
flags = { allow_incremental_sync = true },
}
15 changes: 15 additions & 0 deletions lsp/clangd.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
return {
flags = { allow_incremental_sync = true, debounce_text_changes = 500 },
cmd = {
'clangd',
'--background-index',
'--suggest-missing-includes',
'--clang-tidy',
'--header-insertion=iwyu',
'--enable-config',
'--offset-encoding=utf-16',
'--clang-tidy-checks=-*,llvm-*,clang-analyzer-*',
'--cross-file-rename',
},
filetypes = { 'c', 'cpp', 'objc', 'objcpp' },
}
44 changes: 44 additions & 0 deletions lsp/gopls.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
local util = require('lspconfig').util
local hasgo = pcall(require 'go')
if hasgo then
return require('go.lsp').config()
end
return {
-- capabilities = cap,
filetypes = { 'go', 'gomod', 'gohtmltmpl', 'gotexttmpl' },
message_level = vim.lsp.protocol.MessageType.Error,
cmd = {
'gopls', -- share the gopls instance if there is one already
'-remote=auto', --[[ debug options ]] --
-- "-logfile=auto",
-- "-debug=:0",
'-remote.debug=:0',
-- "-rpc.trace",
},

flags = { allow_incremental_sync = true, debounce_text_changes = 1000 },
settings = {
gopls = {
-- more settings: https://github.com/golang/tools/blob/master/gopls/doc/settings.md
-- flags = {allow_incremental_sync = true, debounce_text_changes = 500},
-- not supported
analyses = { unusedparams = true, unreachable = false },
codelenses = {
generate = true, -- show the `go generate` lens.
gc_details = true, -- // Show a code lens toggling the display of gc's choices.
test = true,
tidy = true,
},
usePlaceholders = true,
completeUnimported = true,
staticcheck = true,
matcher = 'fuzzy',
diagnosticsDelay = '500ms',
symbolMatcher = 'fuzzy',
gofumpt = false, -- true, -- turn on for new repos, gofmpt is good but also create code turmoils
buildFlags = { '-tags', 'integration' },
-- buildFlags = {"-tags", "functional"}
semanticTokens = false,
},
},
}
8 changes: 8 additions & 0 deletions lsp/jdtls.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
return {
settings = {
java = {
signatureHelp = { enabled = true },
contentProvider = { preferred = 'fernflower' },
},
},
}
Loading
Loading