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

Add the profile name being used in the workspace settings #213036

Open
digfish opened this issue May 19, 2024 · 5 comments
Open

Add the profile name being used in the workspace settings #213036

digfish opened this issue May 19, 2024 · 5 comments
Assignees
Labels
feature-request Request for new features or functionality user-profiles User profile management

Comments

@digfish
Copy link

digfish commented May 19, 2024

Hi,

I use the same workspace in different computers, but I'm using my Github account to sign in and use the same VS Code profiles in all those vs code instances, in every computer.
Problem is, when I open the same workspace in different computers in a local network (since the workspace is stored on a NAS shared folder), the same profile is not automatically activated when I open the workspace on a new computer, other profile (usually it inherits the profile the last opened project was using on the same vs code instance on that particular computer).
Is there some way in which the profile name could be stored in the workspace settings, so that the same workspace opened by different computers would automatically open the same profile (of course, this is a feature that would work only for one user) ?

Thanks for your attention, best regards,

@sias32
Copy link

sias32 commented May 19, 2024

As an example, you could export the profile to a .code-profile file, and in the .work-space settings add the ability to specify the path to the profile file to use. As was recently done with local workspace extensions

@digfish
Copy link
Author

digfish commented May 19, 2024 via email

@sias32
Copy link

sias32 commented May 19, 2024

Sorry, i apologize for misleading you. I wrote an example of how this idea can be implemented, it is not a solution.

@digfish
Copy link
Author

digfish commented May 19, 2024

Anyway, I questioned the Copilot bot about writing an extension specifically for this use case, that's what it answered:


I see, you're asking about the Visual Studio Code's internal API for changing the running profile. Unfortunately, as of now, there is no direct API in VS Code that allows you to switch between different running profiles programmatically.

However, you can programmatically modify the settings.json file which is essentially what the profiles are. You can use the vscode.workspace.getConfiguration and update methods to get and update settings respectively.

Here's a basic example:

let config = vscode.workspace.getConfiguration('yourConfiguration');

config.update('yourSetting', 'newValue', vscode.ConfigurationTarget.Workspace);

In this example, 'yourConfiguration' is the section of the configuration (like 'editor', 'files', etc.), 'yourSetting' is the specific setting you want to change, and 'newValue' is the value you want to set.

Remember that this will only work if the extension is activated and has the necessary permissions to modify workspace settings.`


In this way, I could store the profile being used in the workspace, but there is no way to automatically retrieve its value through the vscode internal API in its current state.

@benibenj benibenj assigned sandy081 and unassigned benibenj May 22, 2024
@sandy081 sandy081 added feature-request Request for new features or functionality user-profiles User profile management labels May 30, 2024
@sandy081 sandy081 added this to the Backlog Candidates milestone May 30, 2024
@VSCodeTriageBot
Copy link
Collaborator

This feature request is now a candidate for our backlog. The community has 60 days to upvote the issue. If it receives 20 upvotes we will move it to our backlog. If not, we will close it. To learn more about how we handle feature requests, please see our documentation.

Happy Coding!

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 user-profiles User profile management
Projects
None yet
Development

No branches or pull requests

5 participants