-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Protocol extensions #15
Comments
Semantic Highlighting is not official spec so I would not be planning implement it but... Protocol extensions can be implemented but I don't plan it. |
command! LampClangdSwitchSourceHeader call s:clangd_switch_source_header()
function! s:clangd_switch_source_header() abort
if &filetype !=# 'cpp'
return
endif
let l:server = lamp#server#registry#get_by_name('clangd name')
if empty(l:server)
echomsg 'clangd does not exists'
return
endif
let l:header = lamp#sync(l:server.request('textDocument/switchSourceHeader', {
'textDocument': lamp#protocol#document#identifier(bufnr('%'))
});
if strlen(l:header) == 0
echomsg 'source header does not found.'
return
endif
execute printf('edit %s', fnameescape(lamp#protocol#document#decode_uri(l:header)))
endfunction |
semantic highlights is bit interesting. |
Oh... clangd is strange... https://github.com/micchy326/vim-lsp-clangd-switch/blob/master/autoload/lsp_clangd_switch.vim#L23 It seems we should change to command! LampClangdSwitchSourceHeader call s:clangd_switch_source_header()
function! s:clangd_switch_source_header() abort
if &filetype !=# 'cpp'
return
endif
let l:server = lamp#server#registry#get_by_name('clangd')
if empty(l:server)
echomsg 'clangd does not exists'
return
endif
let l:header = lamp#sync(l:server.request('textDocument/switchSourceHeader', {
\ 'uri': lamp#protocol#document#identifier(bufnr('%'))
\ }))
if strlen(l:header) == 0
echomsg 'source header does not found.'
return
endif
execute printf('edit %s', fnameescape(lamp#protocol#document#decode_uri(l:header)))
endfunction Could you test this on your environment? |
Of course! |
OK, I will install clangd. |
Sorry, it was simple mistake 😅 command! LampClangdSwitchSourceHeader call s:clangd_switch_source_header()
function! s:clangd_switch_source_header() abort
if &filetype !=# 'c'
return
endif
let l:server = lamp#server#registry#get_by_name('clangd')
if empty(l:server)
echomsg 'clangd does not exists'
return
endif
let l:header = lamp#sync(l:server.request('textDocument/switchSourceHeader', {
\ 'uri': lamp#protocol#document#identifier(bufnr('%')).uri
\ }))
if strlen(l:header) == 0
echomsg 'source header does not found.'
return
endif
execute printf('edit %s', fnameescape(lamp#protocol#document#decode_uri(l:header)))
endfunction |
😅 Thank you a lot! It works. Maybe include this into plugin? It will be very helpful for C++ developers. Maybe as an option? |
If we provide it, we should create separated plugin. But I can't think of it's name. vim-lamp-ext? |
Personally, I like this variant more because it more self-explanatory :) Or just |
Is vim-lamp-extensions good for you? I'm japanese so I worry to naming everytime. |
As for me yes, but I'm not native speaker too, I'm Ukrainian :) |
llvm/llvm-project@71177ac#diff-bc83abf3e556418f438c09a672856449 The clangd seems supported |
This is not the same as semantic highlighting? It looks like it was added 17 days ago and will be released in clangd 11. |
The semanticTokens is an official spec candidate but the sementicHighlights is not. And the sementicHighlights is heavy in vim because all tokens are encoded to base64. |
Nice ti hear. Will wait for the implementation :) |
I have a question. vim-lsp have Highlight references feature. It just add semi-transparent rectangle on reference under cursor by default: |
No. |
I found a solution to have fast |
Are you planning on implementing protocol extensions?
I would like to suggest to add Semantic highlighting. It's implemented in vim-lsp(hove some performance issues!) and LanguageClient-neovim. Also It is supported in other editors (in VSCode, for example). This is very useful, and I think it could become the standard.
Also I would like to suggest to add Switch between source/header extension. It's already implemented in vim-lsp-clangd-switch. This is needed only for C / C++, but very convenient.
The text was updated successfully, but these errors were encountered: