Skip to content
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

Support referencing context key values in window.title template #202991

Closed
hediet opened this issue Jan 22, 2024 · 3 comments · Fixed by #225408
Closed

Support referencing context key values in window.title template #202991

hediet opened this issue Jan 22, 2024 · 3 comments · Fixed by #225408
Assignees
Labels
feature-request Request for new features or functionality titlebar VS Code main title bar issues verification-needed Verification of issue is requested verified Verification succeeded
Milestone

Comments

@hediet
Copy link
Member

hediet commented Jan 22, 2024

Currently, window.title allows several variables.
It would be awesome for extensibility, if ${context.myContextVar} would be supported, with myContextVar being an arbitrary context variable.

Then extensions could contribute to the window title (candidates would be ${context.debuggerStateEmoji} or ${context.workspaceEmoji}).

I'd be up to create a PR!

Related: #2809

@bpasero bpasero added feature-request Request for new features or functionality titlebar VS Code main title bar issues labels Jan 22, 2024
@bpasero bpasero added this to the On Deck milestone Jan 22, 2024
@bpasero
Copy link
Member

bpasero commented Jan 22, 2024

Sounds interesting, feel free to give it a try. The variables are substituted from here:

// Variables
const activeEditorShort = editor ? editor.getTitle(Verbosity.SHORT) : '';

@hediet hediet added help wanted Issues identified as good community contribution opportunities good first issue Issues identified as good for first-time contributors labels Jan 22, 2024
@LEKPHET-KUNSUE
Copy link

anyone assign me pls

@hediet hediet removed the good first issue Issues identified as good for first-time contributors label Jan 23, 2024
@bpasero bpasero changed the title Support referencing context key values in window.title template Support referencing context key values in window.title template Jan 25, 2024
@bpasero bpasero removed their assignment Jan 26, 2024
@bpasero bpasero assigned benibenj and unassigned hediet Aug 19, 2024
@bpasero bpasero modified the milestones: On Deck, August 2024 Aug 19, 2024
@benibenj benibenj added verification-needed Verification of issue is requested and removed help wanted Issues identified as good community contribution opportunities labels Aug 26, 2024
@benibenj
Copy link
Contributor

Verification steps:

  1. From an extension, create a contxt key and register a title variable
export function activate(context: vscode.ExtensionContext) {
    setInterval(() => 
        vscode.commands.executeCommand('setContext', 'timeNowContextKey', new Date().toLocaleTimeString()),
        1000
    );
    vscode.commands.executeCommand('registerWindowTitleVariable', 'timeNow', 'timeNowContextKey');
}
  1. go to window.title in settings and add the newly created title variable (for example window.title: "${timeNow}")
  2. Make sure the window title correctly renders the value of the variable in the command center / window title area

@rzhao271 rzhao271 added the verified Verification succeeded label Aug 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Request for new features or functionality titlebar VS Code main title bar issues verification-needed Verification of issue is requested verified Verification succeeded
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants