Closed tonyma closed 2 years ago
I downloaded your config. One issue I saw is require("config.impatient")
It through lots of errors even without navigator.
After I disable impatient, every thing looks fine.
If you still failed to map. Please run LspKeymaps
and check if navigator loaded or not
Also check your output of LspInfo
and make sure your lsp is installed and loaded.
If you using sumneko_lua, make sure lua-language-server
is installed in $PATH
Here is the LspInfo output, I am testing with typescript:
Language client log: /Users/tony/.cache/nvim/lsp.log
Detected filetype: typescript
4 client(s) attached to this buffer:
Client: null-ls (id: 1, pid: 5001, bufnr: [16])
filetypes: javascript, markdown, typescriptreact, html, solidity, javascriptreact, graphql, css, json, yaml, less, typescript, scss, python, lua
autostart: false
root directory: /Users/tony/Desktop/Development/quadpay-merchant-portal
cmd: nvim
Client: cssmodules_ls (id: 2, pid: 70250, bufnr: [16])
filetypes: javascript, javascriptreact, typescript, typescriptreact
autostart: true
root directory: /Users/tony/Desktop/Development/quadpay-merchant-portal
cmd: cssmodules-language-server
Client: eslint (id: 3, pid: 70251, bufnr: [16])
filetypes: javascript, javascriptreact, javascript.jsx, typescript, typescriptreact, typescript.tsx, vue
autostart: true
root directory: /Users/tony/Desktop/Development/quadpay-merchant-portal
cmd: vscode-eslint-language-server --stdio
Client: tsserver (id: 4, pid: 70252, bufnr: [16])
filetypes: javascript, javascriptreact, javascript.jsx, typescript, typescriptreact, typescript.tsx
autostart: true
root directory: /Users/tony/Desktop/Development/quadpay-merchant-portal
cmd: typescript-language-server --stdio
Configured servers list: pylsp, bashls, dockerls, eslint, gopls, flow, julials, cmake, sqlls, sqls, rust_analyzer, terraformls, texlab, volar, vuels, html, sumneko_lua, vimls, yamlls, angularls, ccls, clangd, clojure_lsp, csharp_ls, cssls, cssmodules_ls, dartls, denols, dotls, r_language_server, fsautocomplete, svelte, phpactor, jdtls, jedi_language_server, intelephense, solargraph, kotlin_language_server, nimls, jsonls, omnisharp, tsserver, graphql, pyright
Got this error when run LspKeymaps:
Please update your plugin. The issue you saw should have been fixed.
After I updated the plugins, I got this screen when run LspKeymaps:
I also tested with your minimal lua configure, it also didn't work for me. should I clean the packer start folder when testing with your minimal configure?
It seems the setup function did not run.
What will happen if you run lua require'navigator
.setup{}and re-run
LspKeymaps`
Got the same result after ran:
lua require'navigator'.setup()
LspKeymaps
I added print message statement in to the navigator configure file. I can confirm the configure file is loaded and executed.
local status_ok, navigator = pcall(require, "navigator")
if not status_ok then
print("navigator is not loaded")
return
end
print("navigator loaded")
I saw the deprecated messages, so setup should have been run. LspInfo looks fine as well. I feel it something related to the impatient.nvim could you remove the plugin and clean up cache?
after removing impatient.nvim, I am still getting the same result. gd worked but not other shortcut keys.
I forked your repo https://github.com/ray-x/dotfiles-1 and did some updates. It works fine in my environment Are you using window? which neovim version you are using?
Environment detail:
System: macOS Monterey version 12.1
Chip Apple M1 Max
NVIM v0.6.0 (via brew install)
Build type: Release
LuaJIT 2.1.0-beta3
I am getting a quick-fix pane for the reference list is at the bottom of the window. shouldn't be a floating window? is this expected behaviour for gr?
I don't think it's working for me yet. I may re-visit it later and stick with my current configure for now. Thanks for your help. You may close this issue for now.
I am using Mac as well, but not sure if M1 work out of box (with ffi).
gr
is a keymap to lua require('navigator.reference').reference()
So you can simply run :lua require('navigator.reference').reference()
when cursor stop on a symbol.
It seems to relate to a particular setup. As I can not reproduce, close it for now.
@ray-x It seems that you don't set gd map in https://github.com/ray-x/navigator.lua/blob/master/lua/navigator/lspclient/mapping.lua#L15
I add gd
into the custom keymap to solve the problem
I am also having this issue
Is the lsp running in background?
Is the lsp running in background?
yes
After some testing it does work, but the keybinds are not being registered
I added codes to map gd
in latest version. Hope it works for you
I added codes to map
gd
in latest version. Hope it works for you
That did not fix the issue
What is the output of LspKeymaps
Also if you run lua require('navigator.definition').definition()
when your cursor is parking on a symble, is it works?
What is the output of
LspKeymaps
Also if you run
lua require('navigator.definition').definition()
when your cursor is parking on a symble, is it works?
yes
There is no keymap bind for navigator. Seems navigator was not setup correctly. or you disable the keymaps by default_mapping=false
Did you try minium vimrc init.lua
in playground folder? nvim -u init.lua
Or can you share your minium vimrc?
There is no keymap bind for navigator. Seems navigator was not setup correctly. or you disable the keymaps by
default_mapping=false
Did you try minium vimrc
init.lua
in playground folder?nvim -u init.lua
Or can you share your minium vimrc?
My current vimrc has very little customization but I'll work on a minimal one mimicking most of my setup
-- general setup
vim.api.nvim_set_keymap("n", " ", "", {})
vim.g.mapleader = " "
vim.wo.number = true
vim.wo.relativenumber = true
vim.opt.termguicolors = true
vim.opt.clipboard = "unnamedplus"
vim.g.coq_settings = {
["auto_start"] = "shut-up",
}
-- packer
local fn = vim.fn
local install_path = fn.stdpath("data") .. "/site/pack/packer/start/packer.nvim"
if fn.empty(fn.glob(install_path)) > 0 then
packer_bootstrap = fn.system({
"git",
"clone",
"--depth",
"1",
"https://github.com/wbthomason/packer.nvim",
install_path,
})
end
require("packer").startup(function(use)
use("neovim/nvim-lspconfig")
use("williamboman/nvim-lsp-installer")
use("ray-x/navigator.lua")
-- -- COQ (Autocompletion)
use("ms-jpq/coq_nvim")
use("ms-jpq/coq.artifacts")
use("ms-jpq/coq.thirdparty")
if packer_bootstrap then
require("packer").sync()
end
end)
-- null ls setup
local nullls = require("null-ls")
local builtins = nullls.builtins
nullls.setup({
sources = {
builtins.formatting.stylua,
},
})
-- navigator/LSP setup
require("navigator").setup({
lsp_installer = true,
})
local lsp_installer = require("nvim-lsp-installer")
local coq = require("coq")
local enhance_server_opts = {
["sumneko_lua"] = function(options)
options.settings = {
Lua = {
diagnostics = {
globals = { "vim" },
},
},
}
end,
["tsserver"] = function(options)
options.on_attach = function(client)
client.resolved_capabilities.document_formatting = false
end
end,
}
lsp_installer.on_server_ready(function(server)
local options = {}
if enhance_server_opts[server.name] then
enhance_server_opts[server.name](options)
end
server:setup(coq.lsp_ensure_capabilities(options))
end)
this should be the minimum init.lua file. Install an lsp via lsp installer n stuff
@ray-x
Your init.lua does not work for me. It was updated:
vim.cmd([[set runtimepath=$VIMRUNTIME]])
vim.cmd([[set packpath=/tmp/nvim/site]])
local package_root = '/tmp/nvim/site/pack'
local install_path = package_root .. '/packer/start/packer.nvim'
vim.g.coq_settings = {
['auto_start'] = 'shut-up',
}
local function load_plugins()
require('packer').startup({
function(use)
use('wbthomason/packer.nvim')
use('neovim/nvim-lspconfig')
use('williamboman/nvim-lsp-installer')
use('ray-x/navigator.lua')
use('ray-x/guihua.lua')
-- -- COQ (Autocompletion)
use('ms-jpq/coq_nvim')
use('ms-jpq/coq.artifacts')
use('ms-jpq/coq.thirdparty')
end,
config = {
package_root = package_root,
compile_path = install_path .. '/plugin/packer_compiled.lua',
},
})
-- navigator/LSP setup
require('navigator').setup({
lsp_installer = true,
})
local lsp_installer = require('nvim-lsp-installer')
local coq = require('coq')
local enhance_server_opts = {
['sumneko_lua'] = function(options)
options.settings = {
Lua = {
diagnostics = {
globals = { 'vim' },
},
},
}
end,
['tsserver'] = function(options)
options.on_attach = function(client)
client.resolved_capabilities.document_formatting = false
end
end,
}
lsp_installer.on_server_ready(function(server)
local options = {}
if enhance_server_opts[server.name] then
enhance_server_opts[server.name](options)
end
server:setup(coq.lsp_ensure_capabilities(options))
end)
end
if vim.fn.isdirectory(install_path) == 0 then
vim.fn.system({
'git',
'clone',
'https://github.com/wbthomason/packer.nvim',
install_path,
})
load_plugins()
require('packer').sync()
else
load_plugins()
end
Update to the lastest it should work.
@ray-x after running a packersync with my current setup it still did not fix the issues
check out my full config at https://github.com/Suyashtnt/nvim file with the lsp configuration stuff is lua/configs/lsp.lua
Sorry. I can not use your setup as it will blow up mine. How about the init.lua
@Suyashtnt looking into your setup
["sumneko_lua"] = function(options)
options.settings = {
Lua = {
diagnostics = {
globals = { "vim" },
},
},
}
end,
["tsserver"] = function(options)
options.on_attach = function(client)
client.resolved_capabilities.document_formatting = false
end
end,
One different between lua server and tsserver is tsserver has an on_attach. That might be why the mapping not working. As lspinstaller will override the navigator on_attach depending on the sequence.
It would be good to do this:
["sumneko_lua"] = function(options)
options.on_attach = function(client, bufnr)
require('navigator.lspclient.mapping').setup({
client = client,
bufnr = bufnr,
cap = capabilities,
})
end
options.settings = {
Lua = {
diagnostics = {
globals = { "vim" },
},
},
}
end,
["tsserver"] = function(options)
options.on_attach = function(client, bufnr)
client.resolved_capabilities.document_formatting = false
require('navigator.lspclient.mapping').setup({
client = client,
bufnr = bufnr,
cap = capabilities,
})
end
end,
@Suyashtnt looking into your setup
["sumneko_lua"] = function(options) options.settings = { Lua = { diagnostics = { globals = { "vim" }, }, }, } end, ["tsserver"] = function(options) options.on_attach = function(client) client.resolved_capabilities.document_formatting = false end end,
One different between lua server and tsserver is tsserver has an on_attach.
That might be why the mapping not working.
As lspinstaller will override the navigator on_attach depending on the sequence.
It would be good to do this:
["sumneko_lua"] = function(options) options.on_attach = function(client, bufnr) require('navigator.lspclient.mapping').setup({ client = client, bufnr = bufnr, cap = capabilities, }) end options.settings = { Lua = { diagnostics = { globals = { "vim" }, }, }, } end, ["tsserver"] = function(options) options.on_attach = function(client, bufnr) client.resolved_capabilities.document_formatting = false require('navigator.lspclient.mapping').setup({ client = client, bufnr = bufnr, cap = capabilities, }) end end,
I'll try this when I get home
@ray-x i forgot to say but it did indeed fix the issues. @tonyma check if this might be your issue
Environment detail:
gd worked for me but all other shortcut keys aren't working for me.
Here are my configures: init.lua: https://github.com/tonyma/dotfiles/blob/main/nvim/.config/nvim/init.lua plugin: https://github.com/tonyma/dotfiles/blob/main/nvim/.config/nvim/lua/plugins.lua navigator config (mostly default configure copied from this repo): https://github.com/tonyma/dotfiles/blob/main/nvim/.config/nvim/lua/config/navigator.lua
I also tried with the minimal sample configuration in the playground folder but got the same result. When I press gr, it triggers the native vim replace character command. Let me know if more details I can provide.