-
Notifications
You must be signed in to change notification settings - Fork 37k
Add ${activeEditorLanguageId} variable to window title
#284151
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
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: meganrogge <29464607+meganrogge@users.noreply.github.com>
${activeEditorLanguageId} variable to window title
|
@bpasero just taking care of low hanging fruit + an easy accessiblity win |
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 adds a new ${activeEditorLanguageId} template variable to the window title configuration, enabling accessibility tools like Talon to reliably detect the current language mode without parsing file extensions.
Key Changes:
- Introduces language ID retrieval from the active text editor's model, supporting both regular code editors and diff editors
- Adds documentation for the new variable in the configuration registry
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/vs/workbench/browser/parts/titlebar/windowTitle.ts | Implements language ID extraction from active editor model (lines 364-376) and adds it to the title template variables (line 402) |
| src/vs/workbench/browser/workbench.contribution.ts | Documents the new ${activeEditorLanguageId} variable in the configuration schema with an example |
bpasero
left a comment
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.
@meganrogge much easier by using this:
const activeEditorLanguageId = this.editorService.activeTextEditorLanguageId;
Adds a new
${activeEditorLanguageId}template variable to the window title configuration. This enables reliable language detection for accessibility tools like Talon, which previously had to parse file extensions from the title—a method that breaks for untitled documents.Implementation
Usage
{ "window.title": "${activeEditorShort}${separator}${activeEditorLanguageId}${separator}${rootName}" }Produces:
myFile.ts - typescript - vscodeUntitled-1 - plaintext - workspace(works without file extensions)App.jsx - javascriptreact - my-app(precise language modes)Returns empty string when no text editor is active.
Original prompt
window.titlefor language id of active editor #197663💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.