From e5c6efa749a8916e723c585c5422546a3e3291b9 Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Fri, 29 Mar 2019 21:08:46 -0700 Subject: [PATCH] Misc --- Build.md | 8 ++++---- Debugging.md | 17 ++++------------- FAQ.md | 15 ++++++++++++++- 3 files changed, 22 insertions(+), 18 deletions(-) diff --git a/Build.md b/Build.md index 275b685..dcfd94b 100644 --- a/Build.md +++ b/Build.md @@ -91,11 +91,11 @@ are installed into the standard locations for our system, `CMAKE_PREFIX_PATH` is not required. A simple `cmake -GNinja -H. -BRelease` (remove `-GNinja` if you don't use -Ninja) works for at least the following distributions: +Ninja) works for many distributions. The required system packages are: -* Arch Linux -* Fedora Linux -* Gentoo Linux +* Arch Linux: `clang` `llvm` +* Fedora Linux: `clang` `clang-devel` `llvm-devel` +* Gentoo Linux: `clang` * Void Linux ### Prebuilt Clang+LLVM binaries diff --git a/Debugging.md b/Debugging.md index 72473e6..ecee40c 100644 --- a/Debugging.md +++ b/Debugging.md @@ -36,20 +36,11 @@ done indexing. However, for many other issues, such as project file loading (`project.cc`) and C/C++ parsing and indexing `indexer.cc`, you need to set an early breakpoint to be able to trace the code. -It is simplest to use [[LC-neovim]] for debugging (even if you use Emacs or -VSCode) because it can be started with simple shell command. +Export the environment variable `CCLS_TRACEME=1` or `CCLS_TRACEME=s` before starting ccls. +Consider using a [shell script wrapper](Install#shell-script-wrapper). -```vim -# vimrc -nn ,al :LanguageClientStart -``` - -```sh -rm -r /tmp/ccls && CCLS_TRACEME=1 nvim a.cc +'normal ,al' -``` - -The Neovim buffer will hang there because `CCLS_TRACEME=1` causes the `ccls` -process to SIGTSTP itself. In another shell, `gdb -p $(pgrep -fn debug/ccls)` +`CCLS_TRACEME=1` or `s` causes the `ccls` process to SIGTSTP/SIGSTOP itself. +In another shell, `gdb -p $(pgrep -fn ccls)` ### Poor man's breakpoint diff --git a/FAQ.md b/FAQ.md index 28d5798..8f8cf28 100644 --- a/FAQ.md +++ b/FAQ.md @@ -296,7 +296,7 @@ Specify `hierarchy:true` to enable hierarchical view. ## [`$ccls/member`](https://github.com/MaskRay/ccls/blob/master/src/messages/ccls_member.cc) -Recursively list member variables of a record type. 😂 nobody has implemented vscode-ccls UI for the feature. Help wanted! +Recursively list member variables of a record type. * struct A:B{void f()override;}; lists `B` or `B::f()` @@ -304,6 +304,19 @@ If parameter `kind:3` is specified, list member functions/functions in a namespa * struct A{void f();}; lists `A::f()` +Sample requests: + +```javascript +// member variables / variables in namespaces: kind:0 (default) +{"jsonrpc":"2.0","id":1,"method":"$ccls/member","params":{"textDocument":{"uri":"file:///tmp/c/a.cc"},"position":{"line":0,"character":7}}} + +// member functions / functions in namespaces: kind:3 +{"jsonrpc":"2.0","id":2,"method":"$ccls/member","params":{"textDocument":{"uri":"file:///tmp/c/a.cc"},"position":{"line":0,"character":7},"kind":3}} + +// nested classes / types in namespaces: kind:2 +{"jsonrpc":"2.0","id":3,"method":"$ccls/member","params":{"textDocument":{"uri":"file:///tmp/c/a.cc"},"position":{"line":0,"character":7},"kind":2}} +``` + ## Cases On a laptop with one (i7-6600U CPU @ 2.60GHz, hyper-threading, `nproc`=4), 4