vscode-textmate icon indicating copy to clipboard operation
vscode-textmate copied to clipboard

Absolute rule reference use local scope

Open hediet opened this issue 3 years ago • 2 comments

I think this line: https://github.com/microsoft/vscode-textmate/blob/9157c7f869219dbaf9a5a5607f099c00fe694a29/src/grammar.ts#L147

should rather be this:

collectSpecificDependencies(result, baseGrammar, baseGrammar, includedName, baseGrammar.repository);

Also, this line: https://github.com/microsoft/vscode-textmate/blob/9157c7f869219dbaf9a5a5607f099c00fe694a29/src/grammar.ts#L149

should be this:

collectSpecificDependencies(result, baseGrammar, selfGrammar, includedName, selfGrammar.repository);

Let's say source.md embeds source.css and a rule in source.css references source.md#link. Then with the logic in main, a rule in source.css referencing source.md#link would look up link in its local repository (first repositories of this rule or parent rules, then the repository of source.css), but not in the repository of source.md.

hediet avatar May 02 '22 10:05 hediet

I'm cant seem to picture what you're trying to explain can you provide an example please?

I think we can agree that source.md#link should always include the #link key from inside source.md and never anywhere else Even if called from source.css or source.md

But if source.css tries to include #link, it should look inside its own repo first; before searching out in source.md?

source.mdsource.md#linksource.css  └ source.css#link

RedCMD avatar May 15 '22 01:05 RedCMD

This is the failing test case (marked as skipped):

https://github.com/microsoft/vscode-textmate/blob/e8d1fc5d04b2fc91384c7a895f6c9ff296a38ac8/src/tests/grammar.test.ts#L108-L142

hediet avatar May 16 '22 11:05 hediet