Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 17, 2025

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

  • windowTitle.ts: Retrieves language ID from active text editor's model, handling both code editors and diff editors
  • workbench.contribution.ts: Documents the new variable alongside existing window title variables

Usage

{
  "window.title": "${activeEditorShort}${separator}${activeEditorLanguageId}${separator}${rootName}"
}

Produces:

  • myFile.ts - typescript - vscode
  • Untitled-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

This section details on the original issue you should resolve

<issue_title>Variable in window.title for language id of active editor</issue_title>
<issue_description>For accessibility purposes, it would be great if we were able to put the language id of the active editor in the window title.

Like with @meganrogge's #190613, this window title variable would enable us to easily get critical information to Talon in real time to enable appropriate voice commands

Fwiw today we look for the file extension in the window title (eg .ts or .py) to determine language, but that is not completely reliable; eg it breaks for untitled documents

</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: meganrogge <29464607+meganrogge@users.noreply.github.com>
Copilot AI changed the title [WIP] Add variable for language id in window title Add ${activeEditorLanguageId} variable to window title Dec 17, 2025
Copilot AI requested a review from meganrogge December 17, 2025 23:08
@meganrogge meganrogge added this to the December / January 2026 milestone Dec 17, 2025
@meganrogge meganrogge requested a review from bpasero December 17, 2025 23:12
@meganrogge meganrogge marked this pull request as ready for review December 17, 2025 23:13
Copilot AI review requested due to automatic review settings December 17, 2025 23:13
@meganrogge
Copy link
Contributor

@bpasero just taking care of low hanging fruit + an easy accessiblity win

Copy link
Contributor

Copilot AI left a 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

Copy link
Member

@bpasero bpasero left a 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;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Variable in window.title for language id of active editor

3 participants