Skip to content

Fix JSON surrounding pairs#370

Merged
AndreasArvidsson merged 8 commits intomainfrom
fix-json-surrounding-pairs
Dec 8, 2021
Merged

Fix JSON surrounding pairs#370
AndreasArvidsson merged 8 commits intomainfrom
fix-json-surrounding-pairs

Conversation

@pokey
Copy link
Copy Markdown
Member

@pokey pokey commented Dec 7, 2021

Closes #364
Closes #355

@pokey pokey force-pushed the fix-json-surrounding-pairs branch from f9a250c to 277303e Compare December 8, 2021 15:16
@@ -0,0 +1,99 @@
import { SyntaxNode } from "web-tree-sitter";
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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