-
Notifications
You must be signed in to change notification settings - Fork 58
Refactor scoping to better match the TextMate guidelines #63
Refactor scoping to better match the TextMate guidelines #63
Conversation
Due your PR I realised that we need {
'match': '\\{|\\}'
'name': 'punctuation.other.bracket.curly.go'
} Same for comma: {
'match': ','
'name': 'punctuation.other.comma.go'
} Also most of languages use
I suppose Sublime use
Do you mean Go Programming Language Specification? TextMate manual mentions about it:
However I disagree with second part of statement:
I personally like same color for The second reason why these symbols should be
So I think these symbols should be |
Updated the PR after discussing with @MaximSokolov on Slack... |
@MaximSokolov as you seem to be the only one that reviewed this one... Are you now OK with merging this? I updated the |
unaryOpers = | ||
'keyword.operator.address.go': ['*var', '&var'] | ||
'keyword.operator.arithmetic.go': ['+var', '-var', '^var'] | ||
'keyword.operator.logical.go': ['!var'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
var
should be keyword.variable.go
Otherwise styles for keyword.operator
can affect on "var" symbol
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 will update the PR accordingly...
I want to check that fixing variable matching wouldn't affect on syntax highlighting. I notify when I would be sure about it. The rest seems good to me 👍 |
'keyword.package.go': ['package'] | ||
'keyword.struct.go': ['struct'] | ||
'keyword.type.go': ['type'] | ||
'keyword.variable.go': ['var'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sub-scope should be var
instead of variable
because it match "var" symbol. var
is not a variable. In addition 'keyword.var.go'
will not cause misunderstanding because of variable
root group.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check... I will update the PR so the scope names match the exact keyword (e.g. keyword.func.go
, keyword.chan.go
, keyword.var.go
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am wrong. Since storage.type.function
is used for function
, ->
, etc. keyword.function.go
, keyword.channel.go
, keyword.variable.go
are correct scopes too. Actually it can be keyword.variable.<token>.go
i.e. keyword.variable.var.go
but it looks excessively.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That was my initial reasoning too... So I'll keep this as is.
- Improve scope names used - Improve regexps to better match the language specs descriptions - Prevent that everything that is not matched, is matched as a variable - Update existing tests - Add more tests
Using One Dark syntax theme for this code(which wouldn't compile): package main
func main() {
t = template.Must(t.ParseGlob("templates/*.tmpl"))
err := t.Execute(os.Stdout, nil)
if err != nil {
log.Fatalf("template execution: %s", err)
}
}
|
Yep, it does change the highlighting (as I would expect). But I believe it does so for the better... It makes what we currently can scope more correct (it doesn't just assign everything the So if nothing else, I would like to proceed and merge this one for now... Of course that doesn't mean it's now a 100% done and dusted, but we made a step in the right direction 😉 |
👍 |
Check... Thanks for all the (Slack) discussion 😉 and here goes... |
Refactor scoping to better match the TextMate guidelines
Now |
@betawaffle do you have an example? |
In One Dark syntax theme for example. |
|
@betawaffle thanks for reporting this! Should be fixed in version 0.39.0 (just released)... |
Even through functions are still scoped as
keyword.function.go
and not asstorage.type.function.go
, this PR still fixes issue #62 IMO. I've looked again and again at the language specs and also at other existing syntax highlighting packages for Go, and they all (Sublime, Emacs, Vim) seem to threat these (chan
,const
,func
,interface
,map
,struct
,type
andvar
) askeywords
instead ofsupport.types
that are used for these in most other languages.So I think and believe that most (if not all) Go developers would feel alienated if we changed that for Atom. And to do that only because it seems to be closer to the TextMate guidelines feels a little weird. Next to it being questionable when looking at the language specs. So in the end I decided to keep these specific ones as
keywords
which should give Go developers the experience they expect and are used to.