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

Added html language implementation #385

Merged
merged 10 commits into from
Dec 16, 2021
Merged

Added html language implementation #385

merged 10 commits into from
Dec 16, 2021

Conversation

AndreasArvidsson
Copy link
Member

No description provided.

Copy link
Member

@pokey pokey left a comment

Choose a reason for hiding this comment

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

This looks good with a couple minor comments.

  • Also would be good to add a test to make sure that plaintext tag angle pair works the same as in html

@@ -0,0 +1,29 @@
languageId: html
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if "clear" should leave the angles. Can't decide

Copy link
Member Author

Choose a reason for hiding this comment

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

Take and clear always have the same range so far. I don't want to change that

@AndreasArvidsson
Copy link
Member Author

I added a plaintext version as well
Clear bounds does not work correctly in plaintext
<hr/> => hr
</body> => /body

@pokey
Copy link
Member

pokey commented Dec 15, 2021

I added a plaintext version as well Clear bounds does not work correctly in plaintext <hr/> => hr </body> => /body

yeah was worried about that. what happens if you switch the order like this?

Copy link
Member

@pokey pokey left a comment

Choose a reason for hiding this comment

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

Ok looks great. I left one more thing. Also thought of one more quick test case:

  • test having parens inside a string to make sure it properly reverts to text-based when inside a string
  • Also parens inside a comment

@pokey pokey added this to the 0.24.0 milestone Dec 16, 2021
Copy link
Member

@pokey pokey left a comment

Choose a reason for hiding this comment

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

Ok looks good with one last question

node: SyntaxNode,
selection: SelectionWithEditor
) {
if (node.type === "attribute_value") {
Copy link
Member

Choose a reason for hiding this comment

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

Will an attribute value always be a string?

Copy link
Member Author

Choose a reason for hiding this comment

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

No. But it's the only type that can contain other matching pairs

Copy link
Member

Choose a reason for hiding this comment

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

Ok so this is a hack, then, right? Because there might be things that are children that are not strings? It's ok if it's a hack, we should just document that in a comment

Copy link
Member

Choose a reason for hiding this comment

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

You could also just check node parent type as well maybe?

Copy link
Member

Choose a reason for hiding this comment

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

Or check that it has first and last child of type "?

Copy link
Member Author

@AndreasArvidsson AndreasArvidsson Dec 16, 2021

Choose a reason for hiding this comment

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

I wouldn't say it's a hack. It is a type that can contain text based matching pairs. But I can't contain any children in the tree sitter as far as I know. I tried with few different values and it all behaved as expected.

@AndreasArvidsson AndreasArvidsson merged commit ff74551 into main Dec 16, 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 this pull request may close these issues.

2 participants