Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/jpeach/cscope-lsp

cscope line interface for cquery
https://github.com/jpeach/cscope-lsp

cscope language-server-protocol lsp vim

Last synced: 13 days ago
JSON representation

cscope line interface for cquery

Awesome Lists containing this project

README

        

# cscope-lsp

cscope line interface for a [Language Server](https://langserver.org).

## Vim Integration

To use `cscope-lsp` in your vim session, you need to do a bit of
configuration:

```vim
" Return the current cursor position as "file:line:col"
function! s:position()
return expand('%') . ':' . line('.') . ':' . col('.')
endfunction

if has("cscope")

:execute ':set cscopeprg=cscope-lsp'

" The file argument to 'add' is ignored by cscope-lsp but
" required by the vim cscope integration. Any file name
" will do here.
:execute ':cs add .gitignore'

" cs: Find symbol
map cs :cs find s =position()

" cg: Find definition
map cg :cs find g =position()

" cc: Find callers
map cc :cs find c =position()

" cd: Find callees
map cd :cs find d =position()

" ct: Find text string
map ct :cs find t =position()

" ce: Find egrep pattern
map ce :cs find e =position()

" cf: Find file
map cf :cs find f =position()

" ci: Find files #including this
map ci :cs find i =position()

endif
```

It can be hard to understand the interaction between `cscope-lsp`
and [cquery](https://github.com/cquery-project/cquery), but trace
mode can be helpful here. To enable tracing, add the `--trace`
option to the `cscope-lsp` argument, like this:

```vim
:execute ':cs add compile_commands.json . --trace=/tmp/cscope.trace'
```