-
Notifications
You must be signed in to change notification settings - Fork 37.7k
If the users selects a language, let's have it actually choose the language they selected. (Yaml vs yaml) #288153
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
If the users selects a language, let's have it actually choose the language they selected. (Yaml vs yaml) #288153
Conversation
…nguage they selected. (Yaml vs yaml)
📬 CODENOTIFYThe following users are being notified based on files changed in this PR: @bpaseroMatched files:
|
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.
Pull request overview
This PR fixes a bug in the language selection feature where selecting a language (e.g., "YAML") from the quick pick would not reliably select the correct language ID due to case-sensitive fuzzy lookup. The fix replaces the indirect lookup via languageName with direct usage of the languageId stored in the quick pick item's id field.
Changes:
- Added
id: languageIdfield to language quick pick items to store the precise language ID - Changed language selection logic to use
pick.idinstead of performing a fuzzy name lookup viagetLanguageIdByLanguageName(pick.label)
Comments suppressed due to low confidence (1)
src/vs/workbench/browser/parts/editor/editorStatus.ts:1289
- This line still uses the old fuzzy lookup approach via
getLanguageIdByLanguageName(pick.label). It should be updated to usepick.idfor consistency with the fix on line 1284. This inconsistency could cause the telemetry to report incorrect language IDs when the label doesn't match exactly (e.g., 'YAML' vs 'yaml').
const chosenLanguageId = languageService.getLanguageIdByLanguageName(pick.label) || 'unknown';
|
What bug does this fix? |
|
When multiple languages exist with differently cased names. You can only change to one of them. Eg Yaml vs yaml then no matter which you select, it'll choose Yaml. This lets you select either one . |
Untested - Use Id instead of fuzzy lookup (Yaml vs yaml)
Too simple for an issue.
Two line change which changes identifying with a string to identifying them with the id. WOW