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

Fix JSON surrounding pairs #370

Merged
merged 8 commits into from
Dec 8, 2021
Merged

Conversation

pokey
Copy link
Member

@pokey pokey commented Dec 7, 2021

Closes #364
Closes #355

@@ -0,0 +1,99 @@
import { SyntaxNode } from "web-tree-sitter";
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved stuff out of index.ts

!ALLOWABLE_ANGLE_BRACKET_PARENTS.includes(
delimiterNode.parent?.type!
)
inferDelimiterSide(delimiterNode) !== delimiterInfo.side
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this approach will be more robust

- type: primitive
modifier: {type: surroundingPair, delimiter: parentheses}
initialState:
documentContents: // (hello)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that we support comments in json now because we fallback to text-based if we're in a parse-tree error node

@pokey pokey marked this pull request as ready for review December 8, 2021 16:49
@AndreasArvidsson AndreasArvidsson merged commit 4150c58 into main Dec 8, 2021
@AndreasArvidsson AndreasArvidsson deleted the fix-json-surrounding-pairs branch December 8, 2021 17:21
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 this pull request may close these issues.

Text-based surrounding pair doesn't work in json strings Fix Typescript text-based surrounding pairs
2 participants