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

Allow an extension to control a terminal tab title/description variable #171175

Closed
Tracked by #20822
Tyriar opened this issue Jan 12, 2023 · 6 comments
Closed
Tracked by #20822

Allow an extension to control a terminal tab title/description variable #171175

Tyriar opened this issue Jan 12, 2023 · 6 comments
Assignees
Labels
api api-proposal feature-request Request for new features or functionality *out-of-scope Posted issue is not in scope of VS Code terminal-tabs

Comments

@Tyriar
Copy link
Member

Tyriar commented Jan 12, 2023

Some extensions create "special" terminals, one way of differentiating them is explicitly setting a title but then that replaces the standard title. What if instead a variable was controlled by an extension which would then default beside the task/local variables as they're similar:

image

Context: microsoft/vscode-python#20492 (comment)

@karrtikr
Copy link
Contributor

For our use case we would like to apply this to all terminals (even if it's not the one we created).

@Tyriar
Copy link
Member Author

Tyriar commented Mar 7, 2023

Current thinking:

  • Make name non-readonly
  • This is used as the ${process} variable in the terminal title/description settings
export interface Terminal {
	/**
	 * The name of the terminal, this will be used as the `${process}` variable in the terminal
	 * tab title and description settings.
	 */
	name: string;
}

We could use a ${extension} variable instead so you can still use process, this might clutter the UI too much though.

@Tyriar
Copy link
Member Author

Tyriar commented Mar 7, 2023

Feedback from API sync:

  • Throw a runtime error if a non-owning extension tries to change the name, mention in API docs
  • Improve ${process} setting description
  • Finalizing is fine, provided it works

@karrtikr
Copy link
Contributor

karrtikr commented Mar 13, 2023

Proposal:

  • Add non-readonly property "description"
  • This is used as the ${extension} variable in the terminal title/description settings
  • Any non-owning extension can contribute to the description. Information will show up on the right without shifting other text:

@Tyriar
Copy link
Member Author

Tyriar commented Mar 14, 2023

I'm concerned about non-owning extensions clobbering the description, leading to inconsistent behavior. For example an extension may create the terminal, set the description, and Python would overwrite it. Or the opposite, where Python sets it and some other extensions overwrites it.

After thinking about it more, it feels wrong that non-owning extensions have any say in this and we should instead attach this information in a less prominent way using the env var description as proposed in #171108. I also think allowing an extension to set text in the description is going to lead to an overly cluttered UI. So we could surface the information in the tooltip where we show shell integration's state:

image

Yes this is not as prominent as you might like, but I want to establish this area as how you get information about the particular terminal. We also have a WIP PR to add the process PID/executable/args there for example: #171258

@Tyriar
Copy link
Member Author

Tyriar commented Mar 20, 2023

The current plan is to not do this

@Tyriar Tyriar closed this as completed Mar 20, 2023
@Tyriar Tyriar added the *out-of-scope Posted issue is not in scope of VS Code label Mar 20, 2023
@TylerLeonhardt TylerLeonhardt removed this from the March 2023 milestone Mar 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api api-proposal feature-request Request for new features or functionality *out-of-scope Posted issue is not in scope of VS Code terminal-tabs
Projects
None yet
Development

No branches or pull requests

4 participants