Skip to content
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

lsp documentation recommends to override <c-]> #13217

Closed
jecaro opened this issue Nov 3, 2020 · 3 comments
Closed

lsp documentation recommends to override <c-]> #13217

jecaro opened this issue Nov 3, 2020 · 3 comments

Comments

@jecaro
Copy link

jecaro commented Nov 3, 2020

lsp.txt gives as a configuration example this statement:

nnoremap <silent> <c-]> <cmd>lua vim.lsp.buf.definition()<CR>

If applied, it is not possible to navigate througt the help anymore with <c-]>. When used in the help to jump to a tag, nvim complains with:

E5108: Error executing lua /usr/share/nvim/runtime/lua/vim/lsp/callbacks.lua:338: RPC[Error] code_name = MethodNotFound, message = "method textDocument/definition is not 
supported by any of the servers registered for the current buffer"

I think the document should not give an example of key bindings which override such an important shortcut. Alternatively the documentation should show how to set this binding for buffers with lsp only (not sure if it's possible though).

@DevonMorris
Copy link
Sponsor

I believe this is because you are remapping this globally. You should only remap it in buffers where you have lsp running. Maybe this should be mentioned in lsp.txt

@clason
Copy link
Member

clason commented Nov 3, 2020

Yes, the documentation for LSP is in need of overhaul before release (it mostly hasn't been touched since the initial merge last December). This particular bit will be improved as part of #12655 (such mappings should indeed be set as part of the on_attach function, not globally).

@jecaro
Copy link
Author

jecaro commented Nov 3, 2020

Thank you. I reported the problem as I find it difficult to find a proper example of a working configuration. But the documentation in #12655 fixes this. Closing then.

@jecaro jecaro closed this as completed Nov 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants