Skip to content
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

Cannot include another grammar's pattern in an includeOnlyRule #105

Closed
matter123 opened this issue Aug 14, 2019 · 2 comments
Closed

Cannot include another grammar's pattern in an includeOnlyRule #105

matter123 opened this issue Aug 14, 2019 · 2 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug

Comments

@matter123
Copy link

Reference repository: https://github.com/matter123/vscode-textmate-include-nested

If a pattern in the grammars repository includes a pattern from another grammar, and a pattern includes that pattern, the other grammar's pattern is not applied.

In the reference repository, grammarA has the pattern #test2 that matches some test pattern. grammarB has the pattern #test2 that includes source.test#test2 (grammarA's pattern). When grammarB includes #test2 (from #test), the grammar does not match some_test_pattern.

@alexdima
Copy link
Member

I think the problem lies in the way grammarB includes the rule from grammarA.

Specifically, vscode-textmate expects a patterns property in order to include something:
grammarB.tmLanguage.json:
image

@alexdima alexdima added the info-needed Issue requires more information from poster label Aug 15, 2019
@alexdima alexdima self-assigned this Aug 15, 2019
@matter123
Copy link
Author

Textmate sets the scope of some test pattern when grammarB includes source.test#test2 directly.

Screen Shot 2019-08-15 at 12 05 31

GrammarB:

{	patterns = (
		{	include = '#test'; },
		{	include = '#embedded'; },
	);
	repository = {
		test = {
			begin = 'testStart';
			end = 'testEnd';
			patterns = ( { include = '#test2'; } );
		};
		'test2' = { include = 'source.test#test2'; };
	};
}

@alexdima alexdima added bug Issue identified by VS Code Team member as probable bug and removed info-needed Issue requires more information from poster labels Aug 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue identified by VS Code Team member as probable bug
Projects
None yet
Development

No branches or pull requests

2 participants