atom / language-go

Go language package for Atom
Other
106 stars 65 forks source link

fixed go's function declaration syntax rule #167

Closed pouyakary closed 5 years ago

pouyakary commented 5 years ago

NOTE
This PR is actually the #142. I lost it on the issues lists for almost 2 years! and now that I'm back I couldn't find the base repo that I had for making this PR and therefore I closed the previous one and made a new PR. Hope it's not that confusing :D

The grammar used to highlight function declaration syntax is designed to support only formatted code, which works great:

screen shot 2017-11-02 at 11 57 37 pm

But for people who may prefer custom coding style or for when they're only typing not well formatted code the declaration syntax is not working because the optional white spacing is forgotten between function name and left parentheses as such:

screen shot 2017-11-02 at 11 57 14 pm

This PR adds a tiny \s* in between of function name and the ending lookahead phrase to make sure all codes render right

rsese commented 5 years ago

Thanks @pmkary - let me know if I'm misunderstanding but this seems like it's not a problem anymore? This is what I see in 1.34.0 on macOS 10.12.6:

go-function

Did you check if you have Tree-sitter enabled at Settings > Core > Use Tree Sitter Parsers?

pouyakary commented 5 years ago

Hi Robert! Thanks a lot for checking it out.

To be honest I have no idea about the grammar in Atom. VS Code directly uses this package to handle Go and since it was broken there I had to fix it here.

It’s awesome that Atom can handle the definitions without the spacing in the grammar but I added this small change to have vscode work right (and probably any other TextMate-like editor).

rsese commented 5 years ago

Ahh ok - just to share some context, for languages like Go where we do have a Tree-sitter grammar, we've migrated from our old first-mate grammar engine to the new Tree-sitter engine. This enables a number of new features, more consistent syntax highlighting, and better performance, among other benefits.

But in order to free up our limited resources, we have decided to stop maintaining the first-mate grammar when there is a built-in Tree-sitter grammar available. Since this issue applies only to the first-mate grammar, we are going to close it.

I believe in some cases, the VS Code folks have their own fork for certain languages but you would have to check with them if that's the case for Go.