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

Provide anchor references as links #541

Closed
remcohaszing opened this issue Sep 17, 2021 · 0 comments · Fixed by #581
Closed

Provide anchor references as links #541

remcohaszing opened this issue Sep 17, 2021 · 0 comments · Fixed by #581
Milestone

Comments

@remcohaszing
Copy link
Contributor

Is your enhancement related to a problem? Please describe.

yaml-language-server turns JSON pointer references into links based on vscode-json-languageservice. YAML has a native support to references though: anchors. It makes sense to support anchors instead of or in addition to JSON pointers.

Describe the solution you would like

The links provider should provide links for anchors. The solution is fairly simple. In src/languageservice/services/yamlLinks.ts:

  • Iterate over the AST
  • Register an anchor by name if found
  • Create a link to an anchor when an anchor id is found

Do this for every SingleYAMLDocument.

Describe alternatives you have considered

N/A

Additional context

I tried this. yaml-language-server-parser supports anchors, but the conversion to the vscode-json-languageservice compatible AST removes all anchors and anchor references. I tried adding it, but it doesn’t really have a good place inside this AST format.

It’s probably best to wait for the new AST format introduced in #442

@evidolob evidolob added this to the 1.1.0 milestone Oct 20, 2021
@evidolob evidolob modified the milestones: 1.1.0, 1.2.0 Nov 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants