-
-
Notifications
You must be signed in to change notification settings - Fork 130
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
Lower-case-ing the heredoc language #554
base: master
Are you sure you want to change the base?
Conversation
Typically the |
@savetheclocktower just wanted to be sure what do you think about the |
Doesn't |
Not really, it was only highlighting around the doc, not the contents |
So |
Hang on. This feedback still needs to be addressed:
|
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.
Need to apply scope to heredoc_content
or heredoc_body
, not both.
Didn't realize further changes needed to be addressed
Ok, @savetheclocktower, it seems that it's better to apply only to |
@@ -100,8 +99,7 @@ | |||
|
|||
; "Bar" in `Foo::Bar`. | |||
(scope_resolution | |||
name: (constant) @support.other.class.ruby | |||
(#set! test.final "true")) | |||
name: (constant) @support.other.class.ruby) |
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.
The reason I had for doing test.final
here — and it's more of a feeling than anything — is that I felt we didn't really gain anything from tagging one range as both support.other.class.ruby
and constant.ruby
.
There are places where it makes sense to do stuff like that, but if we apply both scopes, we end up leaving it to the syntax theme to decide which styles win out, and often that's not an intentional decision by the theme author as much as it's just an accident of CSS specificity and ordering of selectors. It also brings ordering in the SCM file into play — since constant.ruby
is declared later in the file, that scope name will be in the inner span
, and that also has an effect on which styles win out.
Technically, lots of things are marked as constant
in tree-sitter-ruby
, just as lots of things are marked as identifier
, and I'm not certain that we give the user much useful information by scoping each one as constant
even when it serves a more specific function.
I've tended to assign a constant
scope only for (a) number literals, (b) built-in language constants like booleans and null
, and (c) declarations that LOOK_LIKE_CONSTANTS
and don't serve other functions. Lots of TM-style themes go even more conservative than that — using constant
for A and B but using the variable
scope for C.
I'm not arguing that any of this is necessarily wrong, and I'm happy to see how it shakes out, but that was the thinking behind the original decision.
(#match? @string.quoted.other.interpolated.ruby "^%Q") | ||
(#set! test.final true)) | ||
|
||
|
||
( | ||
(string | ||
"\"" @punctuation.definition.string.begin.ruby | ||
(string_content)? | ||
"\"" @punctuation.definition.string.end.ruby) | ||
@string.quoted.other.ruby |
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.
Was this section not needed?
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.
There were some misbehaviors on the string matching - some interpolated strings were being detected as non-interpolated, and vice-versa. When I fixed these, I extracted most of the changes into specific matches.
In this specific case, I did not remove the match of double-quoted strings - I just removed the restriction on the previous rule (https://github.com/pulsar-edit/pulsar/pull/554/files#diff-82574a2099439cbee59d5f974dbe593145214402078d948cf9f49378d9637e40R264-L266) and that basically became the exact same match that we have here :D
Perhaps this PR can be updated since we've had quite a lot of Tree-Sitter related fixes implemented since this was originally opened? |
Two small fixes here: