-
Notifications
You must be signed in to change notification settings - Fork 25
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
Feature Request - goto definition for YAML alias/anchors #18
Comments
The parser doesn't break the symbols in `*` `&` from the name of anchors/aliases. So go to definition doesn't work, but highlight of usage does :D Test with ```yaml Defaults: &defaults Company: foo Item: 123 Computer: <<: *defaults <<: *defaults Price: 3000 ``` Ref nvim-treesitter/nvim-treesitter-refactor#18
This needs to be changed in locals.scm (nvim-treesitter/nvim-treesitter#1172) and in the parser itself (parse the name of the anchor/alias and the |
The parser doesn't break the symbols in `*` `&` from the name of anchors/aliases. So go to definition doesn't work, but highlight of usage does :D Test with ```yaml Defaults: &defaults Company: foo Item: 123 Computer: <<: *defaults <<: *defaults Price: 3000 ``` Ref nvim-treesitter/nvim-treesitter-refactor#18
Cool. Thanks for your work! |
Isn't fully working yet, yeah. ikatyang/tree-sitter-yaml#23 needs to be addressed. |
The parser doesn't break the symbols in `*` `&` from the name of anchors/aliases. So go to definition doesn't work, but highlight of usage does :D Test with ```yaml Defaults: &defaults Company: foo Item: 123 Computer: <<: *defaults <<: *defaults Price: 3000 ``` Ref nvim-treesitter/nvim-treesitter-refactor#18
Do I need to do something to make it work? Except of updating all treesitter plugins? |
You need to update the plugins and the parser |
I have everything most up to date, and with this configuration: navigation = {
enable = true,
keymaps = {
goto_definition_lsp_fallback = "<C-]>"
}
} and vim.api.nvim_buf_set_keymap(0, "n", "<C-]>", "<cmd>lua vim.lsp.buf.definition()<CR>", {noremap = true, silent = true}) pressing |
Hi, this is my config require'nvim-treesitter.configs'.setup {
ensure_installed = "all",
refactor = {
navigation = {
enable = true,
keymaps = {
goto_definition = "gd",
},
},
},
} Make sure you have the latest version of the yaml parser installed This is the file I'm testing with Defaults: &defaults
Company: foo
Item: 123
Computer:
<<: *defaults
<<: *defaults
Price: 3000 Setting the cursor under I can see this doesn't work with |
@cloggier this should fix the lsp fallback #19 |
Is your feature request related to a problem? Please describe.
Working with large YAML files (e.g. some continuous integration configurations), anchors are a typical feature. It is a typical scenario that you are at an alias that merges an anchor and you want to now how the content looks the anchor refers to. As anchors are usually references multiple times in the same document, it is annoying to use tools like
*
or similar.Describe the solution you'd like
I would be cool if you could use
goto_definition
on an alias to jump to the related anchor.Describe alternatives you've considered
Using
*
many times (also causes trouble for anchors names that are not a single word likemy-anchor
)Using include search like
[ <CTR-I
(also suffers from word boundaries and must not be accurate/correct)The YAML language server apparently does not support such "definition" jumps as well.
The text was updated successfully, but these errors were encountered: