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

Add more scopes to the tree-sitter go grammar #158

Merged
merged 6 commits into from Oct 29, 2018

Conversation

Projects
None yet
2 participants
@Ben3eeE
Member

Ben3eeE commented Oct 29, 2018

TODO

  • default in this program does not get parsed with an anonymous node and is not highlighted
  • true and false is not highlighted. They are constant.language.go in textmate
  • The % part of interpreted_string_literal is not highlighted differently. It's constant.other.placeholder.go in textmate:
fmt.Printf("Don't know type %T\n", t)

textmate:
image
tree-sitter:
image

  • Test everything

Changes

  • Scope go as keyword.control
  • Scope imaginary_literal as constant.numeric.integer
  • Scope float_literal as constant.numeric.float
  • Scope all operators as keyword.operator

/cc: @maxbrunsfeld

Ben3eeE added some commits Oct 29, 2018

@maxbrunsfeld

This comment has been minimized.

Contributor

maxbrunsfeld commented Oct 29, 2018

I pushed an update to tree-sitter-go that addresses some issues:

  • There should now be an anonymous default node, so default in switch statements should get colored.
  • There are now separate true and false nodes
@maxbrunsfeld

I would say we should probably merge this even without the % changes. I want to do something about those, but I'm not exactly sure what yet. They're a bit like the word TODO in a comment - something that's not really part of the language's syntax, so is maybe suitable for an injection. But like TODO, it seems like we need some lighter-weight kind of injection, which doesn't involve creating an entirely separate parser.

@Ben3eeE Ben3eeE merged commit b4ac7f5 into master Oct 29, 2018

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@Ben3eeE Ben3eeE deleted the b3-tree-sitter-scopes branch Oct 29, 2018

@Ben3eeE

This comment has been minimized.

Member

Ben3eeE commented Oct 29, 2018

Nice, yeah it seems like we have this problem in other languages as well. The %. Like in Python {} is not highlighted in a string /cc: atom/language-python#281 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment