-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
[textmate] don't warn when same grammar is registered multiple times #6125
Conversation
const existingProvider = this.scopeToProvider.get(scope); | ||
if (existingProvider) { | ||
Promise.all([existingProvider.getGrammarDefinition(), description.getGrammarDefinition()]).then(([a, b]) => { | ||
if (a.location !== b.location) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
only if both locations are not undefined?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I think that's enough. But if you insist ... :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tested that waning is reported only when locations are different, but warning should be also reported if locations are undefined
console.warn(new Error(`a registered grammar provider for '${scope}' scope is overridden`)); | ||
} | ||
}); | ||
return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm removing this return again.
Fixes #6124 Signed-off-by: Sven Efftinge <[email protected]>
1209e65
to
9d1af3f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it looks good to me now
Fixes #6124
What it does
No more warnings when the same grammar is registered multiple times.
How to test
Remove textmate-grammars and install https://registry.npmjs.org/@theia/vscode-builtin-ini/-/vscode-builtin-ini-0.2.1.tgz in plugins folder
See how no warning is logged (if you do the same without this change there will be warning)
Review checklist
Reminder for reviewers