m-pilia / vim-ccls Goto Github PK
View Code? Open in Web Editor NEWVim plugin for the ccls language server
License: MIT License
Vim plugin for the ccls language server
License: MIT License
The current test strategy uses mocks of the LSP client APIs. This provides a controlled environment and helps preventing regressions, but it is not enough to prevent issues due to breaking changes in the dependencies (e.g. #39).
The purpose of this issue is to implement a full integration test that involves the latest version of the dependencies. The rough plan is:
Make the README more compact yet more informative by replacing the three screenshots with a single animated gif.
This would duplicate the functionality from Vista, however I prefer the vim-ccls float window implementation for most purposes. I tried getting this to work but I can't figure out the a:data
parameter that vim-yggdrasil requires. CocRequest
for textDocument/documentSymbol
gives back a vim list. Some data massaging will have to be done to get it in the right form. That or vim-yggdrasil has to learn how to accept lists.
Create an abstraction layer around the LS calls, allowing to use multiple LS clients as Language Server backends.
Thank you!
Neovim's built-in LSP API has been recently merged into master.
Add covimerage support to measure test coverage.
Hi,
I've increased this value to 3.
let g:ccls_levels = 3
but it still shows only one thing whenever pressing 'o'.
What I want is, just show full call path by pressing 'o' only once.
Is it possible? Or am I missing something?
In my Neovim 0.5.0 setup configured with ccls as LSP for C, the following seem to work:
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"
Allow to use LanguageClient-neovim as LS client backend.
Add CI, and run the tests automatically on a per-commit basis.
Hello,
The package nvim-lsp changed its name into lspconfig a few days ago (neovim/nvim-lspconfig@ddcd9e6). So I get the message "No LSP plugin found" when trying to do a call hierarchy.
I found a quick workaround to be able to use call hierarchies again:
diff --git a/autoload/ccls/lsp.vim b/autoload/ccls/lsp.vim
index ff8d7c6..3a7b31c 100644
--- a/autoload/ccls/lsp.vim
+++ b/autoload/ccls/lsp.vim
@@ -95,7 +95,7 @@ function! ccls#lsp#request(bufnr, method, params, handler) abort
catch
call ccls#util#warning('LSP error')
endtry
Hi,
I appreciate your great work.
However I feel uncomfortable when I'm using vimdiff.
Whenever I launch vimdiff, it tries to run ccls in the background.
And sometimes I feel that it gets sluggish in my big project. Thus I wonder if there is a method how to disable this plugin from working on runtime. I think it would be nice to provide an API eg CclsDisable
Allow to use vim-lsc as a Language Server back-end.
Add an alternative to use a floating window, when available, to display the tree, as opposed to a split window.
I use NVIM v0.6.0-dev.
I found that is capabilities of nvim-lspconfig whith ccls is not enaugh to manage big c++ project. And this plugin is very helpful.
When I trying to call CclsDerivedHierarchy, I get this error.
Error executing vim.schedule lua callback: /home/serhii/.vim/plugged/vim-ccls/lua/vim_ccls/init.lua:27: Vim(let):E716: Key not present in Dictionary: "location.uri)"
maybe it is related to nvim update? How to solve this issue?
Thanks
the node is expanded on the next level
node is not expanded
NVIM v0.4.3
Build type: Release
LuaJIT 2.0.5
Compilation: /usr/bin/cc -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -O2 -DNDEBUG -DMIN_LOG_LEVEL=3 -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fdiagnostics-color=always -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -I/build/neovim/src/build/config -I/build/neovim/src/neovim-0.4.3/src -I/usr/include -I/build/neovim/src/build/src/nvim/auto -I/build/neovim/src/build/include
Compiled by builduser
Features: +acl +iconv +tui
health#LanguageClient#check
========================================================================
- OK: binary found: /home/xbob/.config/nvim/plugged/LanguageClient-neovim/bin/languageclient
- OK: languageclient 0.1.155
- OK: Floating window is supported and will be used for hover
## Python 3 provider (optional)
- INFO: Using: g:python3_host_prog = "/home/xbob/.env/python/neovim/bin/python"
- INFO: Executable: /home/xbob/.env/python/neovim/bin/python
- INFO: Python version: 3.7.4
- INFO: pynvim version: 0.3.1 (outdated; from ~/.env/python/neovim/lib/python3.7/site-packages/neovim)
- WARNING: Latest pynvim is NOT installed: 0.4.0
The hierarchy commands start with a top-level node indicating where the command was initiated from. In basically call cases, it would be useful to expand at least the first layer, since any user would need to open that to get info they don't already have.
For member hierarchy, it might be worth just expanding recursively all direct members (ie not pointers or references), although I'm not sure if it is worth expanding stuff in std::
or other lib namespaces, so it isn't as obvious that it is desirable to auto-open more than the first layer.
Currently, tests cover only the Yggdrasil API. Add tests to cover the LSP ccls API.
Jump to the location of the definition for the symbol in the root node.
No jump happens.
This line:
vim-ccls/lua/vim_ccls/init.lua
Line 7 in 93ac5db
Should be changed to:
for _, v in pairs(clients) do
otherwise ccls
won't be detected anymore for a given buffer, when starting another LSP server on a different buffer.
My modification has been tested and it always works. Some possible explanations:
Hi,
Whenever I hit Entery key in a quickfix window whatever it is local or global,
it tries to run CclsMemberHierachy. But I don't want to do this but want to do the original behavior - jump to the location where it indicates as intended.
Could you tell me how I get it, please?
Turn autoload#ccls#lsp
in a pure LSP library, and make it independent from the view and from anything that is not directly related to the LSP.
autoload#ccls#lsp
directly reusable outside this project.How to enable FixIts/code action with coc nvim and ccls?? nmap <leader>qf <Plug>(coc-fix-current)
does not work at the moment with ccls, it works with coc-clangd.
I currently use YouCompleteMe + ccls. It would be great if this plugin can support YouCompleteMe.
CCLS offers the $ccls/member
message with a parameter kind
and values 2
, 3
, and 4
representing types, functions and variables. You currently have CclsMembers
only getting vars. I think it would be useful to have this expanded to the other 2 permutations.
More very useful keybindings to be used in the treeview panel/popup:
*for this it would also be very good to add an automatic preview option: when navigating the popup/panel treeview items, when placing the cursor on them, the corresponding line should be shown in the buffer or, eventually, on a completely new small preview box as done in other plugins.
Pretty simple idea -- if you're in a vim-ccls pane and hit p
it'll toggle showing a preview in a vsplit
of the location of the current highlighted line.
class Base {}
class Sub1 : public Base {}
case Sub2 : public Base {}
Calling CclsDerivedHierarchy
on Base
will yield
V Base
* Sub1
* Sub2 <---- cursor
and with the cursor on Sub2
it'll call vsplit lib/File/Sub2.cpp
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.