Absolute rule reference use local scope
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.
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.md
├ source.md#link
└ source.css
└ source.css#link
This is the failing test case (marked as skipped):
https://github.com/microsoft/vscode-textmate/blob/e8d1fc5d04b2fc91384c7a895f6c9ff296a38ac8/src/tests/grammar.test.ts#L108-L142