question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Behavior of $base and $self in injection grammars

See original GitHub issue

As far as I can tell, $base and $self currently do not work as expected in external injection grammars. Both seem to resolve to the injection grammar itself.

Instead, here’s how I think they should work:

$base in an injection grammar should always be resolved to root grammar (it should have the same behavior as using $base in a normal grammar file that is included from another grammar)

The expected behavior of $self is less clear. I think it would make most sense for $self to resolve to the grammar being targeted by the injection, although you could argue that it could be resolved to the injection grammar itself

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
texastolandcommented, Sep 16, 2021

@jeff-hykin Thanks for your explanation of the reasoning! In any case $base has no effect in my current injection grammar.

I follow your logic about explicit scope names. I’d argue very little about TextMate grammars is documented or even consistent. I’ve been writing regexes for 15 years yet struggling for more than a week to fix a bug I expected to spend a half day on.

There are more bugs I could track here but I’d really prefer some update on https://github.com/microsoft/vscode/issues/216#issuecomment-913872371 (I know you’re even more invested in that topic).

0reactions
jeff-hykincommented, Sep 16, 2021

@texastoland I’ll continue the topic over here since this is off topic from the original issue

https://github.com/jeff-hykin/fsharp-injections-demo/issues/1

Read more comments on GitHub >

github_iconTop Results From Across the Web

Writing a TextMate Grammar: Some Lessons Learned
The value of an include rule can also be $self , meaning the whole current grammar, or $base , the grammar inside which...
Read more >
Normal forms for Context-Free Grammars - Computer Science
Basis : Every Symbol of T is obviously generating; it generates itself. Induction: If we have a production A → a, and every...
Read more >
Testing Web Applications - The Fuzzing Book
We set up a (vulnerable) Web server and demonstrate how to systematically explore its behavior – first with hand-written grammars, then with grammars...
Read more >
the use of physical restraint in the treatment of self-injury and ...
DESCRIPTORS: self-injurious behavior, restraint, lemon-juice treatment, distrac- tion, toy play, retardates ... Self-injury increased to its previous base-.
Read more >
Target Behavior Documentation
Target Behavior Documentation Date. You can tally this information, Yes or No this information, and change the target behaviors ... Self-Selected. Reading.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found