-
-
Notifications
You must be signed in to change notification settings - Fork 143
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
Fix the matching of $'...'
strings.
#776
Fix the matching of $'...'
strings.
#776
Conversation
Thanks a ton for contributing! Love to see this one put together! I'm going ahead right now to give this one a test, and make sure it's resolve the issue you've described, so fingers crossed! |
Alright, so I've gone ahead and tested the Windows binary built via your PR. As well as I'm using the example of the broken text from here:
With that said, unfortunately I don't think this fixes it. Here's my results: TextMate (Should be working, not effected by this PR)Legacy Tree-Sitter This is what this PR attempts to fixModern Tree-Sitter (Not effected by this PR)So we can see the only grammar where this does work properly is TextMate. So it seems that there must be something broken in the upstream Lastly I did check for any errors shown in the console and I'm seeing none. So it's prudent to ask @savetheclocktower any ideas here? Could this be in our implementation? Or is more than likely it's an error upstream? |
Although what is interesting, is according to the original error report, it made sense that this would be the fix, and using But I can also confirm no scopes at all are being applied: Although beyond this is really where my TreeSitter knowledge ends, I hate to say |
@confused-Techie Just to be clear, in the bug report I noted the output of "Log Cursor Syntax Tree Scope" and not "Log Cursor Scope." Here's both of those, for me (in 1.110.0; I still haven't gotten my own build working, alas): BTW I didn't know about |
Ok, having finally gotten a local build working (see https://github.com/orgs/pulsar-edit/discussions/225), I can now sadly confirm that this PR doesn't actually seem to do anything to address the problem. :( |
BTW, I hadn't realized I was only (ostensibly) addressing the non-modern tree-sitter implementation with my original commit: I searched the codebase for something that looked anything like In any case, I just added a new commit to this PR that really-actually-i-tested-it-even gets However, I have a question: In the "STRINGS" section of Incidentally, though double-quoted strings get punctuation scopes, it doesn't look like single-quoted strings do. I also tried adding extra rules for that case and was met with a similar completely-scopeless fate. One final note: It took me a while to figure out that neither |
One mystery solved: The version of So my original commit would only make sense if the non-modern setup switched the version of |
…tup. This is how `tree-sitter-bash` marks `$'...'` strings.
@danfuzz I'm glad you were able to get a fix! And get the fix in for Modern Tree-Sitter (As that is our current focus) So super awesome all around! We very well should still fix this for Legacy Tree-Sitter which it looks like could be fixed by updating our version of And if your new set of changes are actually fixing things I'm happy to hear it and will try and test soon (Unless someone else beats me). As for writing the queries, I'll be honest that's not my area of expertise. Hopefully @savetheclocktower could point out what may be going on, but besides that, here's the documentation they wrote when they created this behavior. So maybe that can be of some help? |
3b31d38
to
b906f01
Compare
Just force-pushed to remove the original commit. |
Though I don't know why the original delimiter-matching patterns caused catastrophic failure, I was able to figure out something that worked, based on the tree-sitter docs, and I used the same form to also add delimiter-matching for single-quoted strings. One more question: The modern tree-sitter uses string scope names Thanks for all the help! |
@danfuzz A few things to address here.
If you make a change that results in a syntax error in a file — like if your parentheses are unbalanced — Pulsar should beep and show an error message in the console. So this must've been something else. If you remember exactly what change you tried to make, I could try to reproduce your outcome on my machine; that sounds like a bad outcome that we should try to prevent.
You shouldn't need to do any of this to see changes reflected when you change a When Pulsar is run in dev mode, all changes to query files take effect immediately once a query file is saved. When you do a @confused-Techie It doesn't quite explain your screenshots, but just for reference: the Log Cursor Scope command shows the scopes at the position to the immediate right of the cursor. If you want to check for the presence of a The PR looks good; let me try to verify it myself. @danfuzz, your tenacity in the face of lack of documentation is inspiring to me. |
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.
One suggested change (suggested by @danfuzz himself!) and then this is good to go.
Thanks so much for this PR, and for expending so much effort for such a small change!
packages/language-shellscript/grammars/tree-sitter/highlights.scm
Outdated
Show resolved
Hide resolved
Co-authored-by: Andrew Dupont <[email protected]>
One of my attempts to address non-
Understood. I intentionally wasn't trying to use
Ah, it wasn't clear from the instructions (that I saw) that I didn't even have to run
Thanks! I'll give that a whirl. |
Turns out that's what happens when you say
So, I guess there's something else (perhaps) which is responsible for copying modified files from locally-defined modules into |
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.
Thanks again for this PR!
Requirements for Contributing a Bug Fix
Please see "Verification Process" below for caveat on this PR.Identify the Bug
#775
Description of the Change
[Update: Replaced with new description]
Added rules to
highlights.scm
:ansi_c_string
(which is what$'...'
is categorized as).raw_string
(which is what'...'
is categorized as).Alternate Designs
[UPDATE: Replaced with new description]
It seems like there are several possible ways to mark the punctuation, but the overall shape of the code is going to be about the same.
Possible Drawbacks
None, pretty sure.
Verification Process
[Update: Now verified!]
NOT ACTUALLY VERIFIED. Very sorry.As I write this, I am attempting to get a Pulsar build environment set up (on macOS), and it is not exactly straightforward. I figured it'd be most expedient to get this simple fix in the pipeline sooner rather than later. Apologies in advance if you would have preferred me to 100% validate.Release Notes
Fixed scoping/highlighting of single-quoted (
'...'
) and C-style ($'...'
) strings in shell scripts.