[Bug] vim-ccls: nvim-lspconfig error: no result from ccls
pidgeon777 opened this issue ยท 11 comments
In my Neovim 0.5.0 setup configured with ccls as LSP for C, the following seem to work:
- Diagnostic
- Go to definition
- Go to references
- Hover
- ....
e.g.:
vim.cmd("nnoremap <silent> gd <cmd>lua vim.lsp.buf.definition()<CR>")
vim.cmd("nnoremap <silent> gD <cmd>lua vim.lsp.buf.declaration()<CR>")
vim.cmd("nnoremap <silent> gr <cmd>lua vim.lsp.buf.references()<CR>")
vim.cmd("nnoremap <silent> gi <cmd>lua vim.lsp.buf.implementation()<CR>")
....
and most of the remaining ccls capabilities.
But those mappings/commands:
vim.cmd("nnoremap <silent> g1 <cmd>lua vim.lsp.buf.incoming_calls()<CR>")
vim.cmd("nnoremap <silent> g2 <cmd>lua vim.lsp.buf.outgoing_calls()<CR>")
doesn't seem to work. Neovim reports:
method textDocument/prepareCallHierarchy is not supported by any of the servers registered for the current buffer
Anyway, vim-ccls reports for all of its commands:
vim-ccls: nvim-lspconfig error: no result from ccls
when executing them (with or without a word under the cursor).
Neovim version:
NVIM v0.5.0-dev+1384-gf2906a466
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Compilation: C:/Program Files (x86)/Microsoft Visual Studio/2017/Enterprise/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x64/cl.exe /DWIN32 /D_WINDOWS /W3 /MD /Zi /O2 /Ob1 /DNDEBUG /W3 -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE -DWIN32 -D_WIN32_WINNT=0x0600 -DINCLUDE_GENERATED_DECLARATIONS -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -ID:/a/neovim/neovim/build/config -ID:/a/neovim/neovim/src -ID:/a/neovim/neovim/nvim-deps/usr/include -ID:/a/neovim/neovim/build/src/nvim/auto -ID:/a/neovim/neovim/build/include
Compilato da runneradmin@fv-az152-886
Features: -acl +iconv +tui
See ":help feature-compile"
file vimrc di sistema: "$VIM\sysinit.vim"
$VIM di riserva: "C:/Program Files/nvim/share/nvim"
Run :checkhealth for more info
LspInfo output:
Configured servers: graphql, html, rust_analyzer, yamlls, svelte, vhdl_tool, ccls, efm, ahk_lsp, terraformls, angularls, texlab, pyright, cssls, vimls, vhdl_ls, solargraph, elixirls, intelephense, dockerls, elmls, dartls, vuels, gopls, bashls, kotlin_language_server, jsonls, tsserver, sumneko_lua, emmet_ls
Neovim logs at: C:\Users\Username\AppData\Local\Temp\nvim/lsp.log
1 client(s) attached to this buffer: ccls
Client: ccls (id 1)
root: C:\Work\Projects\Git\ACounter\testlut
filetypes: c, cpp, objc, objcpp
cmd: ccls --log-file=ccls.log -v=1
1 active client(s):
Client: ccls (id 1)
root: C:\Work\Projects\Git\ACounter\testlut
filetypes: c, cpp, objc, objcpp
cmd: ccls --log-file=ccls.log -v=1
Clients that match the filetype cpp:
Config: ccls
cmd: ccls --log-file=ccls.log -v=1
cmd is executable: True
identified root: C:\Work\Projects\Git\ACounter\testlut
custom handlers:
compile_commands.json:
[
{
"directory": "C:/Work/Projects/Git/ACounter/testlut/Build_Unix",
"command": "C:/msys64/mingw64/bin/c++.exe -std=gnu++17 -Weverything -o CMakeFiles/testlut.dir/main.cpp.obj -c C:/Work/Projects/Git/ACounter/testlut/main.cpp",
"file": "C:/Work/Projects/Git/ACounter/testlut/main.cpp"
}
]
LSP Config .lua setting:
require'lspconfig'.ccls.setup {
cmd = {"ccls", "--log-file=ccls.log", "-v=1"},
root_dir = require('lspconfig/util').root_pattern("compile_commands.json", "compile_flags.txt", ".ccls"),
on_attach = require'lsp'.common_on_attach,
}
ccls_log_file_content:
07/06/2021 16:30:00 | ["Outgoing", {"method": "$ccls/inheritance", "handler": "<SNR>133_handle_locations", "params": {"derived": false, "hierarchy": false, "textDocument": {"uri": "file://C:/Work/Projects/Git/ACounter/testlut/main.cpp"}, "position": {"character": 11, "line": 45}}}]
07/06/2021 16:30:05 | ["Outgoing", {"method": "$ccls/inheritance", "handler": "<SNR>133_handle_tree", "params": {"levels": 1, "derived": false, "hierarchy": true, "textDocument": {"uri": "file://C:/Work/Projects/Git/ACounter/testlut/main.cpp"}, "position": {"character": 11, "line": 45}}}]
07/06/2021 16:30:09 | ["Outgoing", {"method": "$ccls/call", "handler": "<SNR>133_handle_tree", "params": {"levels": 1, "callee": false, "hierarchy": true, "textDocument": {"uri": "file://C:/Work/Projects/Git/ACounter/testlut/main.cpp"}, "position": {"character": 11, "line": 45}}}]
07/06/2021 16:30:25 | ["Outgoing", {"method": "$ccls/inheritance", "handler": "<SNR>133_handle_locations", "params": {"derived": false, "hierarchy": false, "textDocument": {"uri": "file://C:/Work/Projects/Git/ACounter/testlut/main.cpp"}, "position": {"character": 23, "line": 758}}}]
07/06/2021 16:30:28 | ["Outgoing", {"method": "$ccls/inheritance", "handler": "<SNR>133_handle_tree", "params": {"levels": 1, "derived": false, "hierarchy": true, "textDocument": {"uri": "file://C:/Work/Projects/Git/ACounter/testlut/main.cpp"}, "position": {"character": 23, "line": 758}}}]
07/06/2021 16:30:32 | ["Outgoing", {"method": "$ccls/call", "handler": "<SNR>133_handle_tree", "params": {"levels": 1, "callee": false, "hierarchy": true, "textDocument": {"uri": "file://C:/Work/Projects/Git/ACounter/testlut/main.cpp"}, "position": {"character": 23, "line": 758}}}]
07/06/2021 16:30:35 | ["Outgoing", {"method": "$ccls/call", "handler": "<SNR>133_handle_tree", "params": {"levels": 1, "callee": true, "hierarchy": true, "textDocument": {"uri": "file://C:/Work/Projects/Git/ACounter/testlut/main.cpp"}, "position": {"character": 23, "line": 758}}}]
07/06/2021 16:30:38 | ["Outgoing", {"method": "$ccls/call", "handler": "<SNR>133_handle_locations", "params": {"callee": true, "hierarchy": false, "textDocument": {"uri": "file://C:/Work/Projects/Git/ACounter/testlut/main.cpp"}, "position": {"character": 23, "line": 758}}}]
07/06/2021 16:30:41 | ["Outgoing", {"method": "$ccls/call", "handler": "<SNR>133_handle_locations", "params": {"callee": false, "hierarchy": false, "textDocument": {"uri": "file://C:/Work/Projects/Git/ACounter/testlut/main.cpp"}, "position": {"character": 23, "line": 758}}}]
07/06/2021 16:30:45 | ["Outgoing", {"method": "$ccls/inheritance", "handler": "<SNR>133_handle_locations", "params": {"derived": true, "hierarchy": false, "textDocument": {"uri": "file://C:/Work/Projects/Git/ACounter/testlut/main.cpp"}, "position": {"character": 23, "line": 758}}}]
07/06/2021 16:47:16 | ["Outgoing", {"method": "$ccls/inheritance", "handler": "<SNR>136_handle_locations", "params": {"derived": false, "hierarchy": false, "textDocument": {"uri": "file://C:/Work/Projects/Git/ACounter/testlut/main.cpp"}, "position": {"character": 13, "line": 295}}}]
07/06/2021 16:47:22 | ["Outgoing", {"method": "$ccls/call", "handler": "<SNR>136_handle_tree", "params": {"levels": 1, "callee": false, "hierarchy": true, "textDocument": {"uri": "file://C:/Work/Projects/Git/ACounter/testlut/main.cpp"}, "position": {"character": 16, "line": 296}}}]
07/06/2021 16:56:04 | ["Outgoing", {"method": "$ccls/inheritance", "handler": "<SNR>139_handle_locations", "params": {"derived": false, "hierarchy": false, "textDocument": {"uri": "file://C:/Work/Projects/Git/ACounter/testlut/main.cpp"}, "position": {"character": 21, "line": 296}}}]
07/06/2021 16:58:05 | ["Outgoing", {"method": "$ccls/call", "handler": "<SNR>139_handle_locations", "params": {"callee": false, "hierarchy": false, "textDocument": {"uri": "file://C:/Work/Projects/Git/ACounter/testlut/main.cpp"}, "position": {"character": 18, "line": 295}}}]
ccls log file:
16:50:14 D:\CodeBlocks\ccls\src\messages\initialize.cc:274 I initialize in directory C:/Work/Projects/Git/ACounter/testlut with uri file:///C:/Work/Projects/Git/ACounter/testlut
16:50:14 D:\CodeBlocks\ccls\src\messages\initialize.cc:297 I initializationOptions: {"compilationDatabaseCommand":"","compilationDatabaseDirectory":"","cache":{"directory":".ccls-cache","format":"binary","hierarchicalPath":false,"retainInMemory":2},"capabilities":{"documentOnTypeFormattingProvider":{"firstTriggerCharacter":"}","moreTriggerCharacter":[]},"foldingRangeProvider":true,"workspace":{"workspaceFolders":{"supported":true,"changeNotifications":true}}},"clang":{"excludeArgs":[],"extraArgs":[],"pathMappings":[],"resourceDir":""},"client":{"diagnosticsRelatedInformation":true,"hierarchicalDocumentSymbolSupport":true,"linkSupport":true,"snippetSupport":true},"codeLens":{"localVariables":true},"completion":{"caseSensitivity":2,"detailedLabel":true,"dropOldRequests":true,"duplicateOptional":true,"filterAndSort":true,"include":{"blacklist":[],"maxPathSize":30,"suffixWhitelist":[".h",".hpp",".hh",".inc"],"whitelist":[]},"maxNum":100,"placeholder":true},"diagnostics":{"blacklist":[],"onChange":1000,"onOpen":0,"onSave":0,"spellChecking":true,"whitelist":[]},"highlight":{"largeFileSize":2097152,"lsRanges":false,"blacklist":[],"whitelist":[]},"index":{"blacklist":[],"comments":2,"initialNoLinkage":false,"initialBlacklist":[],"initialWhitelist":[],"maxInitializerLines":5,"multiVersion":0,"multiVersionBlacklist":[],"multiVersionWhitelist":[],"name":{"suppressUnwrittenScope":false},"onChange":false,"parametersInDeclarations":true,"threads":0,"trackDependency":2,"whitelist":[]},"request":{"timeout":5000},"session":{"maxNum":10},"workspaceSymbol":{"caseSensitivity":1,"maxNum":1000,"sort":true},"xref":{"maxNum":2000}}
16:50:14 D:\CodeBlocks\ccls\src\messages\initialize.cc:329 I use -resource-dir=D:\CodeBlocks\llvm-11.0.1-install\lib\clang\11.0.1
16:50:14 D:\CodeBlocks\ccls\src\messages\initialize.cc:361 I workspace folder: C:/Work/Projects/Git/ACounter/testlut/
16:50:14 D:\CodeBlocks\ccls\src\project.cc:426 I loaded C:/Work/Projects/Git/ACounter/testlut/compile_commands.json
16:50:14 D:\CodeBlocks\ccls\src\messages\initialize.cc:386 I start 8 indexers
16:50:14 D:\CodeBlocks\ccls\src\messages\initialize.cc:394 I dispatch initial index requests
16:50:14 D:\CodeBlocks\ccls\src\pipeline.cc:493 I loaded project. Refresh semantic highlight for all working file.
16:50:14 D:\CodeBlocks\ccls\src\pipeline.cc:298 I load cache for C:/Work/Projects/Git/ACounter/testlut/main.cpp
16:50:14 D:\CodeBlocks\ccls\src\sema_manager.cc:763 I create session for C:/Work/Projects/Git/ACounter/testlut/main.cpp
C:/msys64/mingw64/bin/c++.exe --driver-mode=g++ -std=gnu++17 -Weverything -o CMakeFiles/testlut.dir/main.cpp.obj -c C:/Work/Projects/Git/ACounter/testlut/main.cpp -working-directory=C:/Work/Projects/Git/ACounter/testlut/Build_Unix
Neovim LSP log file:
[ START ] 2021-06-07T16:49:11+0200 ] LSP logging initiated
[ START ] 2021-06-07T16:50:07+0200 ] LSP logging initiated
[ WARN ] 2021-06-07T16:50:26+0200 ] ...\MEGA\Portable\Neovim\share\nvim\runtime\lua\vim\lsp.lua:86 ] "method textDocument/prepareCallHierarchy is not supported by any of the servers registered for the current buffer"
[ WARN ] 2021-06-07T16:50:28+0200 ] ...\MEGA\Portable\Neovim\share\nvim\runtime\lua\vim\lsp.lua:86 ] "method textDocument/prepareCallHierarchy is not supported by any of the servers registered for the current buffer"
Did you try :CclsCallHierarchy
, my guess is this isn't implemented with a standard request for CCLS.
Yes I tried it, this is what I obtain:
vim-ccls: nvim-lspconfig error: no result from ccls
My mappings:
vim.cmd("nnoremap <silent> g1 <cmd>lua vim.lsp.buf.incoming_calls()<CR>")
vim.cmd("nnoremap <silent> g2 <cmd>lua vim.lsp.buf.outgoing_calls()<CR>")
Also those two commands above report errors, no matter of vim-ccls plugin:
method textDocument/prepareCallHierarchy is not supported by any of the servers registered for the current buffer
There is one thing I don't understand though, someone here seems to have a similar issue about ccls and call hierarchies:
This seems to be fixed, thus it should prove that current Neovim LSP and ccls should be able to provide call hierarchy.
I'm really trying to understand if there is an issue in my config because I'm quite sure that other users are currently able to use ccls in Neovim, with vim-ccls plugin also.
@pidgeon777 Hi, thanks for reporting this issue and for all the details.
Short explanation: I think vim.lsp.buf.incoming_calls()
is unrelated to this. ccls
has a non-standard method ($ccls/call
) to provide call hierarchies. This because the standard callHierarchy
methods are a recent addition to the LSP, while ccls had already support for this a few years before it was added to the official protocol specification.
I am a bit out of touch with the development of both ccls and neovim's built-in LSP client (I see there has been a lot of improvements lately), so I need to check if there has been any change in the API.
You should give Neovim's built-in LSP client a try, it is very good indeed.
Also, this is worth a look:
https://github.com/neovim/nvim-lspconfig
Well, I'll wait for your updates, then!
Hi!
Some preliminary clarification
I read the details of this issue and I see some confusion, so I should start by clarifying the scope of this project (vim-ccls
).
The following functions
lua vim.lsp.buf.incoming_calls()
lua vim.lsp.buf.outgoing_calls()
that you mention above:
- are provided by Neovim itself to request a call list from the language server
- use standard LSP
callHierarchy
methods to communicate with the server, - are not used by and have nothing to do with
vim-ccls
(i.e. the particular vim plugin implemented in this repository).
The commands exposed by vim-ccls
are listed in the README.md an in the documentation. If you want to show a call hierarchy with vim-ccls
, you should use the CclsCallHierarchy
command (and similar, you can refer to the README and the documentation for details and examples of usage).
As far as I know, ccls
does not support the callHierarchy LSP methods and it uses its custom API instead (which predates standard LSP call hierarchy support), so you cannot use
lua vim.lsp.buf.incoming_calls()
lua vim.lsp.buf.outgoing_calls()
with ccls
(and concerning that issue, requests for support belong to the ccls project itself, not here).
The purpose of vim-ccls
is to provide a vim/neovim interface to the non-standard API of ccls
, so if you want to get a call hierarchy using vim-ccls
you should not use the Lua bindings from Neovim (vim.lsp.buf.incoming_calls()
etc.) but rather :CclsCallHierarchy
.
The actual issue
That said, I can help with troubleshooting :CclsCallHierarchy
. I had a look at the log you posted and it seems there is a problem with handling of Windows paths (Windows support was outdated and pretty much untested). I opened a PR that should address the issue, it would be great if you could test it and see if it works for you.
You should give Neovim's built-in LSP client a try, it is very good indeed.
Also, this is worth a look:
This plugin already supports Neovim's built-in LSP client and nvim-lspconfig
as LSP client backend. I am already familiar with both, obviously (I implemented support for them in vim-ccls
...), but I don't use them on a daily basis.
First of all, thanks for the great description. That explains a lot.
I did this:
C:\>cd C:\Users\myUsername\AppData\Local\nvim-data\site\pack\packer\opt\vim-ccls
C:\Users\myUsername\AppData\Local\nvim-data\site\pack\packer\opt\vim-ccls>gh pr checkout 49
Switched to a new branch 'refactor-windows-path-handling'
When I execute :CclsCallHierarchy
placing the cursor at the create_remap_table
function, now it seems to correctly open the panel:
but when I press Enter
on the main
element, a new tab is wrongly created:
It is as if when opening the code location, the proper Windows slashes are not kept into account.
PWD where of the main.cpp
file where I executed the command, is of the form C:\Work\Projects\Git\<EditA>\<EditB>
.
Ok, thanks for the feedback! Now it seems that path -> URI conversion is working, but the other way around is still broken. I probably need to try this out on an actual Windows machine. It would also help if you could record a ccls log (I would like to see how the URIs from ccls look like before conversion).
Also, could you please check what values you get from these commands in Neovim on your platform?
:echo has('win32')
:echo has('win64')
:echo has('win32unix')
There is another issue now. For an unknown reason, your plugin doesn't seem to identify the ccls client attached to the buffer:
Configured servers: vuels, dartls, dockerls, ccls, ahk_lsp, vhdl_ls, kotlin_language_server, ghdl_ls, intelephense, sumneko_lua, emmet_ls, rust_analyzer, vhdl_tool, elmls, elixirls, angularls, cssls, efm, yamlls, terraformls, vimls, solargraph, svelte, tsserver, texlab, pyright, gopls, html, graphql, hdl_checker, bashls, jsonls
Neovim logs at: C:\Users\UserName\AppData\Local\Temp\nvim/lsp.log
1 client(s) attached to this buffer: ccls
Client: ccls (id 2)
root: C:\Work\Projects\Git\ACounter\testlut
filetypes: c, cpp, objc, objcpp
cmd: ccls --log-file=ccls.log -v=1
1 active client(s):
Client: ccls (id 2)
root: C:\Work\Projects\Git\ACounter\testlut
filetypes: c, cpp, objc, objcpp
cmd: ccls --log-file=ccls.log -v=1
Clients that match the filetype cpp:
Config: ccls
cmd: ccls --log-file=ccls.log -v=1
cmd is executable: True
identified root: C:\Work\Projects\Git\ACounter\testlut
custom handlers:
When executing commands such as CclsCallHierarchy
, your plugin reports:
vim-ccls: nvim-lspconfig error: ccls unavailable for buffer 14
ccls.log:
10:42:44 D:\CodeBlocks\ccls\src\messages\initialize.cc:274 I initialize in directory C:/Work/Projects/Git/ACounter/testlut with uri file:///C:/Work/Projects/Git/ACounter/testlut
10:42:44 D:\CodeBlocks\ccls\src\messages\initialize.cc:297 I initializationOptions: {"compilationDatabaseCommand":"","compilationDatabaseDirectory":"","cache":{"directory":".ccls-cache","format":"binary","hierarchicalPath":false,"retainInMemory":2},"capabilities":{"documentOnTypeFormattingProvider":{"firstTriggerCharacter":"}","moreTriggerCharacter":[]},"foldingRangeProvider":true,"workspace":{"workspaceFolders":{"supported":true,"changeNotifications":true}}},"clang":{"excludeArgs":[],"extraArgs":[],"pathMappings":[],"resourceDir":""},"client":{"diagnosticsRelatedInformation":true,"hierarchicalDocumentSymbolSupport":true,"linkSupport":true,"snippetSupport":true},"codeLens":{"localVariables":true},"completion":{"caseSensitivity":2,"detailedLabel":true,"dropOldRequests":true,"duplicateOptional":true,"filterAndSort":false,"include":{"blacklist":[],"maxPathSize":30,"suffixWhitelist":[".h",".hpp",".hh",".inc"],"whitelist":[]},"maxNum":100,"placeholder":true},"diagnostics":{"blacklist":[],"onChange":1000,"onOpen":0,"onSave":0,"spellChecking":true,"whitelist":[]},"highlight":{"largeFileSize":2097152,"lsRanges":false,"blacklist":[],"whitelist":[]},"index":{"blacklist":[],"comments":0,"initialNoLinkage":false,"initialBlacklist":[],"initialWhitelist":[],"maxInitializerLines":5,"multiVersion":0,"multiVersionBlacklist":[],"multiVersionWhitelist":[],"name":{"suppressUnwrittenScope":false},"onChange":false,"parametersInDeclarations":true,"threads":0,"trackDependency":2,"whitelist":[]},"request":{"timeout":5000},"session":{"maxNum":10},"workspaceSymbol":{"caseSensitivity":1,"maxNum":1000,"sort":true},"xref":{"maxNum":2000}}
10:42:44 D:\CodeBlocks\ccls\src\messages\initialize.cc:329 I use -resource-dir=D:\CodeBlocks\llvm-11.0.1-install\lib\clang\11.0.1
10:42:44 D:\CodeBlocks\ccls\src\messages\initialize.cc:361 I workspace folder: C:/Work/Projects/Git/ACounter/testlut/
10:42:44 D:\CodeBlocks\ccls\src\project.cc:426 I loaded C:/Work/Projects/Git/ACounter/testlut/compile_commands.json
10:42:44 D:\CodeBlocks\ccls\src\messages\initialize.cc:386 I start 8 indexers
10:42:44 D:\CodeBlocks\ccls\src\messages\initialize.cc:394 I dispatch initial index requests
10:42:44 D:\CodeBlocks\ccls\src\pipeline.cc:493 I loaded project. Refresh semantic highlight for all working file.
10:42:44 D:\CodeBlocks\ccls\src\sema_manager.cc:763 I create session for C:/Work/Projects/Git/ACounter/testlut/main.cpp
C:/msys64/mingw64/bin/c++.exe --driver-mode=g++ -std=gnu++17 -Weverything -o CMakeFiles/testlut.dir/main.cpp.obj -c C:/Work/Projects/Git/ACounter/testlut/main.cpp -working-directory=C:/Work/Projects/Git/ACounter/testlut/Build_Unix
10:42:44 D:\CodeBlocks\ccls\src\pipeline.cc:298 I load cache for C:/Work/Projects/Git/ACounter/testlut/main.cpp
my_log_file_vim_ccls.txt:
16/06/2021 10:53:43 | ["Outgoing", {"method": "$ccls/call", "handler": "<SNR>133_handle_tree", "params": {"levels": 1, "callee": false, "hierarchy": true, "textDocument": {"uri": "file://C:/Work/Projects/Git/ACounter/testlut/main.cpp"}, "position": {"character": 5, "line": 668}}}]
16/06/2021 10:53:44 | ["Outgoing", {"method": "$ccls/call", "handler": "<SNR>133_handle_locations", "params": {"callee": false, "hierarchy": false, "textDocument": {"uri": "file://C:/Work/Projects/Git/ACounter/testlut/main.cpp"}, "position": {"character": 5, "line": 668}}}]
16/06/2021 10:53:45 | ["Outgoing", {"method": "$ccls/call", "handler": "<SNR>133_handle_tree", "params": {"levels": 1, "callee": true, "hierarchy": true, "textDocument": {"uri": "file://C:/Work/Projects/Git/ACounter/testlut/main.cpp"}, "position": {"character": 5, "line": 668}}}]
16/06/2021 10:53:46 | ["Outgoing", {"method": "$ccls/call", "handler": "<SNR>133_handle_locations", "params": {"callee": true, "hierarchy": false, "textDocument": {"uri": "file://C:/Work/Projects/Git/ACounter/testlut/main.cpp"}, "position": {"character": 5, "line": 668}}}]
Also:
:echo has('win32')
1
:echo has('win64')
1
:echo has('win32unix')
0
@pidgeon777 Thanks for the additional info. I managed to find some time to set up neovim and build ccls on a Windows machine to reproduce this.
but when I press Enter on the main element, a new tab is wrongly created:
I found the cause of this issue and pushed a new commit to the PR branch to fix it, feel free to try it out and see if it works for you.
There is another issue now. For an unknown reason, your plugin doesn't seem to identify the ccls client attached to the buffer
I have not been able to reproduce this. Are you standing in the right buffer at the moment you call :CclsCallHierarchy
? The command tries to fetch a hierarchy for the symbol under the cursor in the current buffer, so you will get an error if the currently active buffer is not the source file (e.g. if you call the command while standing in the call hierarchy view or in some other buffer).
If this other issue happens again, could you please:
-
Double-check the buffer number of the source file. So for instance, if you are trying to call
:CclsCallHierarchy
for a symbol infoo.cpp
, you could execute:echo bufnr('foo.cpp')
to print the buffer number of the buffer holdingfoo.cpp
, and check if it matches the number in the error message.You can also run
:ls
to see a list of open buffers, where the leftmost number in each row is the buffer number, so you can see what buffer the number in the error message corresponds to, and execute:bx
(wherex
is the buffer number) to switch to that buffer. -
Check (and possibly attach here) the result of
:lua print(vim.inspect(vim.lsp.buf_get_clients(x)))
after replacing
x
with the buffer number shown in the error message, so for instance if you get an errorvim-ccls: nvim-lspconfig error: ccls unavailable for buffer 14
you should call
:lua print(vim.inspect(vim.lsp.buf_get_clients(14)))
This command prints a dump of the language server objects for a given buffer number.
So far, after testing your PR, everything seems to work. Congratulations!
The buffer not attached error was mainly due to two things:
- Source file paths were wrong in my
compile_commands.json
file. - All of the project files in its subdirectories were also sourced, too. See this.
I'll test your plugin more in-depth and let you know about the outcome.
Great! Then I will merge the PR and close this issue. Of course feel free to open a new issue in case you encounter any problem (there are relatively few Windows users, so feedback is highly valuable).