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

Recursive anchors crash extension #897

Closed
1 of 4 tasks
lemonyte opened this issue Apr 4, 2023 · 0 comments · Fixed by #899
Closed
1 of 4 tasks

Recursive anchors crash extension #897

lemonyte opened this issue Apr 4, 2023 · 0 comments · Fixed by #899
Assignees
Labels

Comments

@lemonyte
Copy link

lemonyte commented Apr 4, 2023

Describe the bug

When using a recursive anchor, the extension outputs the following error and linting/validation stops working.

Request textDocument/foldingRange failed.
  Message: Request textDocument/foldingRange failed with message: Maximum call stack size exceeded
  Code: -32603

YAML:

# Arbitrary schema
# yaml-language-server: $schema=https://json.schemastore.org/github-action.json
&root
prop:
  sub: *root

The yaml package and Ajv have no problem parsing and applying the recursive anchor.

Output of YAML.parse():

<ref *1> { prop: { sub: [Circular *1] } }

Expected Behavior

Linting and validation should continue working.

Current Behavior

The extension crashes with the error indicated above.

Without recursive anchor, works as intended:
image

With recursive anchor, does not work:
image

Steps to Reproduce

  1. Create a new YAML file
  2. Paste the provided example content, and indicate an arbitrary schema to try validating the content
  3. Remove the recursive *root reference, and notice that validation works as intended
  4. Add the *root reference back, and notice that the extension stops working

Environment

  • Windows
  • Mac
  • Linux
  • other (please specify)

Notes

I may be able to open a PR fixing this if that becomes necessary.

If this issue should be under https://github.com/redhat-developer/yaml-language-server please transfer it.

@gorkem gorkem added the bug label Jun 18, 2023
@gorkem gorkem transferred this issue from redhat-developer/vscode-yaml Jun 18, 2023
@gorkem gorkem self-assigned this Jun 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants