microsoft / microsoft/vscode-textmate

Repository works only when it defined at top level of grammar file

Open
#140 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature-request
Dominant language
TypeScript
Stars
678
Forks
135
Avg merge
1d 14h
Merged PRs (30d)
2

Description

In textmate you can define repositroy within a specific rule and it works fine.

I created this grammar file for test

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>fileTypes</key>
	<array>
		<string>qwe</string>
	</array>
	<key>name</key>
	<string>Qwe</string>
	<key>patterns</key>
	<array>
		<dict>
			<key>begin</key>
			<string>begin</string>
			<key>beginCaptures</key>
			<dict>
				<key>0</key>
				<dict>
					<key>name</key>
					<string>keyword.control.begin.qwe</string>
				</dict>
			</dict>
			<key>end</key>
			<string>end</string>
			<key>endCaptures</key>
			<dict>
				<key>0</key>
				<dict>
					<key>name</key>
					<string>keyword.control.end.qwe</string>
				</dict>
			</dict>
			<key>name</key>
			<string>meta.begin-end.qwe</string>
			<key>patterns</key>
			<array>
				<dict>
					<key>include</key>
					<string>#foo</string>
				</dict>
			</array>
			<key>repository</key>
			<dict>
				<key>foo</key>
				<dict>
					<key>match</key>
					<string>foo</string>
					<key>name</key>
					<string>keyword.control.foo.qwe</string>
				</dict>
			</dict>
		</dict>
	</array>
	<key>scopeName</key>
	<string>source.qwe</string>
	<key>uuid</key>
	<string>06AD8311-7342-4086-843E-BFB83EBC2377</string>
</dict>
</plist>

result in textmate:
Screen Shot 2020-10-05 at 10 30 28
result in vscode:
Screenshot from 2020-10-06 22-50-26

In vscode whole rule stopped working without any error

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the supplied grammar in TextMate and VS Code, focusing on the nested repository and #foo include behavior. Inspect the grammar parsing and repository-resolution entry points, then verify that nested repositories work without stopping the surrounding rule; add regression coverage if the existing test layout supports it.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.