Closed miguelsolorio closed 1 year ago
I can confirm in the "Running Extensions" window that when I switch profiles, there is a small variation in the extensions displayed. Some extensions like the "React Native Tools" extension show right away in that list, whereas some extensions like "C++" or "C#" won't show. Maybe they won't run until they are used.. I can see though that their related commands appear on the command palette upon profile change, so they must be working normally.
I have created a new profile based on the default one and when I try to export the settings, it shows the Chose (sic) what to export
window that loads endlessly. If I switch back the default profile, exporting it works just fine.
Wasn't a profile supposed to inherit settings from the user default settings, or aren't we there yet in 1.74.0?
Also I hope that later on, everything that can be exported to a profile, keyboard shortcuts, tasks, snippets etc. also can be inherited by a profile if the user choose to do so. Having duplicates of settings and shortcuts isn't viable.
The sole reason for me wanting this feature is to be able to quickly change coding environment for a particular instance/window, in other words changing a preset list of extensions. I might run a Java project in one window with a set of extensions, a SASS project in a second window, and then have a general profile with a minimal amount of extensions that can be brought up quickly for random files.
I know this is a WIP but as for now, this isn't useful to me, or am I experiencing a bug?
I'm going to try symlinking everything except extensions, but I'm afraid that might cause issues.
Edit: I made hardlinks to settings.json
, keybindings.json
, and tasks.json
without encountering any issues yet. This works as a workaround for now, but it won't allow granular overrides of course.
@depascalis Inherit/extending from default profiles is not yet supported, please see this - https://github.com/microsoft/vscode/issues/156144. We will look into this in next phase based on user feedback and requirements.
Before I knew about this feature I was using the --user-data-dir and --extensions-dir along with this shell script:
#!/usr/bin/env bash
VSC_PROFILE_ROOT="${HOME}/vscode-profiles"
PROFILE_DIR="${VSC_PROFILE_ROOT}/${1}"
USERDATA_DIR="${PROFILE_DIR}/user-data"
EXTENSIONS_DIR="${PROFILE_DIR}/extensions"
if [ -z "${1}" ]; then
echo -e "\nUsage: ${0} [profile-name] {workspace.vscode-workspace}"
echo "Where profile-name is directory storage for vscode profile."
echo "Where workspace.vscode-workspace is the vscode workspace file."
echo -e "\nExample: ${0} python"
echo "Creates ${USERDATA_DIR}, ${EXTENSIONS_DIR}"
echo -e "Then executes 'code' with --extensions-dir --user-data-dir args in cwd\n"
else
if [ ! -d "${PROFILE_DIR}" ]; then
mkdir -p "${PROFILE_DIR}" "${USERDATA_DIR}" "${EXTENSIONS_DIR}"
fi
if [ ! -z "${2}" ]; then
code --extensions-dir "${EXTENSIONS_DIR}" --user-data-dir "${USERDATA_DIR}" "${2}"
echo "${0} launching code: --extensions-dir ${EXTENSIONS_DIR} --user-data-dir ${USERDATA_DIR} ${2}"
else
code --extensions-dir "${EXTENSIONS_DIR}" --user-data-dir "${USERDATA_DIR}" .
echo "${0} launching code: --extensions-dir ${EXTENSIONS_DIR} --user-data-dir ${USERDATA_DIR} $(pwd)"
fi
fi
It isn't syncable but it does the job. I mainly use profiles for different languages. I'm really really really looking forward to this profile native support in vscode, esp. since community can build and share entire profiles to get a full-on language support with extensions, settings, etc. This is HUGE. I hate having shared extensions now, and have been using workspaces and workspace settings in my profiles and it has been dreamy.
Thanks devs! <3
To me, one of the most interesting things about profiles is for using it with Dev Containers to allow extension customization as per developer but looks like this is not supported at the time as I'm getting:
[error] Installing extensions to a specific profile is not supported in remote scenario: Error: Installing extensions to a specific profile is not supported in remote scenario
So I can't install extra extensions, export the profile, rebuild the container and import the profile configuration so my custom extensions are added to the extensions installed by the devcontainer.json extensions tag.
@miguelsolorio Are there any plans to support this scenario in the near future?
@rubensa Not sure if I understand your use case here to support profiles in Dev Containers. I think Dev Container itself is a profile. Can you please elaborate more here. FYI, we have a feature request to support profiles for remote - https://github.com/microsoft/vscode/issues/165247. Please comment and provide your scenario there.
I've noticed that if you move one project from one folder to a different one then vscode won't remember the Profile anymore, which makes me assume that it's vscode the one storing the map between profiles and paths for itself. Wouldn't it be more practical to store the profile information withing the project's .vscode folder? Or at least to allow to override the global setting from there?
@sandy081 By Dev Containers I mean this extension that allows you to develop inside a Docker container. With that extension, in the devcontainer.json file, you can specify the extensions that are going to be installed on Docker container first initialization. I'd like to add more extensions afterwards, export the profile, rebuild the container (this makes you loose any previously added extensions) and then re-import the profile (so the extras extensions are installed again). This should allow to have a predefined set of extensions for the project in the devcontainer.json file but add custom extensions as per individual developer (each developer could configure a personal profile).
@isidorn and I were chatting in a meeting some and I had a suggestion that could make profiles even more powerful. In short, if profiles could be layered--in a way similar to the layering of default / user / workspace / language / etc. settings--this could provide a lot of flexibility.
As an example, suppose the Python and Azure extensions each release some profiles containing an interesting mix of settings, extensions, snippets, etc. A user wants to use both of these, but if two profiles can't be active at once, or layered in some way, then they cannot.
Later on, suppose they no longer want/need the Python profile, because their next project is in a different language. They may want to turn that Python profile "off" (or remove it), without disturbing the other profile(s) present. Layering of the profiles could help in this scenario as well.
@sandy081 By Dev Containers I mean this extension that allows you to develop inside a Docker container. With that extension, in the devcontainer.json file, you can specify the extensions that are going to be installed on Docker container first initialization. I'd like to add more extensions afterwards, export the profile, rebuild the container (this makes you loose any previously added extensions) and then re-import the profile (so the extras extensions are installed again). This should allow to have a predefined set of extensions for the project in the devcontainer.json file but add custom extensions as per individual developer (each developer could configure a personal profile).
I believe this should be filled against the DevContainer repo. This is something which i think should be implemented too.
My opinion is, since DevContainer extensions are handled somewhat different from all other remote extensions (in the sense that you have a file which specify what extensions are available), you may end with overlapping functionality.
I personally think that a simple "this machine" extension array in the devcontainer.json
file, or even a separate file that allows you to specify extensions to be enabled (and not only recommended) in the current workspace would solve this issue.
@bwateratmsft See #15909
@rubensa Your requirement is this feature request - https://github.com/microsoft/vscode/issues/165247
if I create a new profile based on the default profile where this profile was created in my windows explorer? I do a backup for my vscode folder every period with settings and extensions, I need to know where I can find the folder of the new profile!!
it is stored in the profiles
folder next to your default profile settings.json
file.
it is stored in the
profiles
folder next to your default profilesettings.json
file.
cool, I find my profile settings/snippets now but what about extensions?
in windows is stored in C:\Users\User-name\.vscode\extensions
I can see only one folder of extensions ( for the default profile )
All extensions are installed(downloaded) in the installation folder, and each profile has an extensions manifest file (extensions.json
) that contains what extensions are included in the profile.
Is it possible to enable a few extensions in certain user profile? I don't want to install them on profile switch.
Is it possible to enable a few extensions in certain user profile? I don't want to install them on profile switch.
Can you please expand on what you want to do? If i understand correctly, you just need to uninstall a extension while in any profile to have it disabled for that profile.
@Lamarcke Here's my workflow: https://github.com/microsoft/vscode/issues/128030
Globally I have disabled language specific extensions and want to enable them only if I am in that language's workspace/profile. In summary, If I am working on vue I don't want to enable an extension for python.
Do note that I don't want to uninstall them, just enable those I want for that profile.
This will save the resources of the system. For install/uninstall I think it will download and uninstall on each profile switching that is not efficient compared to enable/disable.
@Lamarcke Here's my workflow: https://github.com/microsoft/vscode/issues/128030
Globally I have disabled language specific extensions and want to enable them only if I am in that language's workspace/profile. In summary, If I am working on vue I don't want to enable an extension for python.
Do note that I don't want to uninstall them, just enable those I want for that profile.
This will save the resources of the system. For install/uninstall I think it will download and uninstall on each profile switching that is not efficient compared to enable/disable.
I understand what you are trying to do. Unfortunately, i don't think there's a way to enable/disable extensions in a workspace-basis, at least for now.
However, VS Code doesn't "download and install" your extensions when you switch profiles. Rather, it keeps all your extensions in your user dir, and then just enable the ones you current profile has "installed".
e.g.: if you have a Python and a Vue profile, with the given language extensions installed, the "Vue" plugin gets disabled and the Python plugin gets enabled when you change to the Python profile. This process doesn't involve installation or uninstallations.
That's why switching profiles with different sets of extension is usually really fast.
Hi, thanks for giving the insights. Are there docs on user profiles? How can I tell the profile to enable the specific extension?
Out of curiosity, What happens if we don't use profiles feature and we uninstall and install the extension? Does it get downloaded or something else?
Thanks.
Hi, thanks for giving the insights. Are there docs on user profiles? How can I tell the profile to enable the specific extension?
Out of curiosity, What happens if we don't use profiles feature and we uninstall and install the extension? Does it get downloaded or something else?
Thanks.
I don't think there's specific docs about Settings Profiles for now, but you can do a quick search for "Profiles" on your browser in updates since Jun/2022. (This link is old, so the current implementation is more straightforward. I recommend just learning by doing in your VS Code Insiders)
What i do think happens is that only when no Profile (the "default" mode is also considered a profile) is using a extension, the extension files are truly removed. While i did say that changing profiles doesn't involve the usual install-uninstall process, actually clicking "Install" or "Uninstall" on extensions does.
Back to my example, if you are on the Python profile, clicking on "Uninstall" on the "isort" extension (just an example), you are actually uninstalling it, and you will likely need to click the "Reload Window" button or do it manually.
One thing i noticed, is that changing profiles removes the need to "Reload Window" when uninstalling extensions. Again, i think VS Code is actually soft-reloading the window for you when you change profiles. I always manually do it though, just in case.
How can I tell the profile to enable the specific extension?
You don't need to. When you uninstall a extension on a given profile, it's disabled for that profile. When you install any extension, it's enabled. When you switch away and back to said profile, only the extensions you have "installed" will be available. And, as i said, they won't be installed again, just enabled.
@Lamarcke
If I understood what you said, then you mean that the two profiles share the same extensions folder, in windows C:\Users\User-name\.vscode\extensions
And when, for example, switching to the second profile (non-default one) and uninstall an extension on it, the profile does not delete the extension from the extensions folder, it only disables it on this profile, while if I uninstall it from the default profile, it will be deleted from the extension folder?
@Lamarcke If I understood what you said, then you mean that the two profiles share the same extensions folder, in windows
C:\Users\User-name\.vscode\extensions
And when, for example, switching to the second profile (non-default one) and uninstall an extension on it, the profile does not delete the extension from the extensions folder, it only disables it on this profile, while if I uninstall it from the default profile, it will be deleted from the extension folder?
Please take what i'm saying with a grain of salt. Only contributors can safely confirm this info. This is just from some tests i've done myself.
About your question, i tried testing it myself and this is the result:
I have the "One Dark" theme installed on both the Default
and Web
profiles in my VS Code.
The one dark extension folder is named zhuangtongfa.material-theme-3.15.6
in C:\Users\User-name\.vscode-insiders\extensions
.
Step 0. Switch to the Default
profile.
Step 1. Removed One Dark
from my Default
profile. This includes using the "Reload Window" command.
Step 2. Check if the files are removed. They are not.
Step 3. Switch to the Web
profile. There, One Dark is enabled and the switch is instantaneous.
Step 4. Removed One Dark
from my Web
profile. Used the "Reload window".
Step 5. Check if the files are removed. They are not.
Step 6. Close VS Code. Files are still there.
Step 7. Reopen VS Code. Files are gone when VS Code finishes booting up.
I tried this with the inverse order (removing from "Default" and then from "Web") and the behavior is consistent.
This leads me to believe that VS Code scans your profiles' extensions at startup, and if no profile is using a extension, it's removed for good.
This also confirms the things i have said above:
A global extension folder; Extensions are only removed when no profile (including the Default
) is using them; Extensions in the global extension folder get enabled and disabled in a per-profile basis, meaning no install/uninstall on profile changes.
TL;DR: Extensions are only truly removed when you uninstall them from all profiles.
@Lamarcke your insights are correct. Thanks for explaining it to the users.
Hello there! Is there a way to tell VSCode to open up a project with a specific profile? Maybe something that you can set in the Workspace settings
Hello there! Is there a way to tell VSCode to open up a project with a specific profile? Maybe something that you can set in the Workspace settings
If i'm not mistaken, VS Code should remember the profile you have choosen for a given workspace (if you select the profile while the workspace is open).
Can someone please confirm?
It looks like it does @Lamarcke @floatingpurr but where is it stored? Is it only stored locally, or is a reference to the workspace/folder stored with the profile which is then synced? It might be useful if that information could be explicitly set in the workspace settings too for reference.
It looks like it does @Lamarcke @floatingpurr but where is it stored? Is it only stored locally, or is a reference to the workspace/folder stored with the profile which is then synced? It might be useful if that information could be explicitly set in the workspace settings too for reference.
I believe it's only stored locally. In my opinion, it wouldn't make sense to have it defined in a workspace file because there's no way to define profiles in a per-workspace basis. It would also be redundant if this is ever implemented.
Is inheritance of the profiles still planned?
I tried out settings profiles and created some, but they seem not to follow changes in my default profile.
This kinda makes it a bit useless for me, because I do like to for example enable experimental features some times, or change the font etc. and it would be a shame if I have to do this for each and every profile separately.
@LasseRosenow inheriting from default profile is tracked here - https://github.com/microsoft/vscode/issues/156144. It would be great if you can provide your usecase in that issue.
How ExtensionContext.globalStorageUri
work with profiles? We use vscode.Uri.joinPath(context.globalStorageUri, "../../snippets")
to get user snippets, and find globalStorageUri
will not change with profiles. https://github.com/zjffun/vscode-snippets-manager/issues/8
VS Code uses userDataProfileService.currentProfile.snippetsHome
internally, could snippetsHome
provide to extensions?
Thank you.
ExtensionContext.globalStorageUri
always points to same location irrespective of profiles. Please follow up in this issue - https://github.com/microsoft/vscode/issues/160466
I read the issues. The ideas are very interesting, but I hope they are not limited to modifying the global setting file manually, but like Windows, Only simple operations are needed. For example, extension sets can be moved like files. Extensions can be placed in different extension sets. At the same time, simple operations can be used to set what extension sets and setting files the environment needs. The whole process does not need to display and modify the global setting file. At this point, the issue can be closed
Closing this plan item as this feature is Generally Available from next stable. Please file separate issues for any other requirements or bugs. Thanks every one of the feedback.
Closing this plan item as this feature is Generally Available from next stable. Please file separate issues for any other requirements or bugs. Thanks every one of the feedback.
I'm kinda new to VS Code Insiders. Is it already available in Insiders? Thank you for the great work.
关闭此计划项,因为此功能已从下一个稳定版正式发布。请针对任何其他要求或错误提交单独的问题。感谢每一个反馈。
Can you tell me what new content has been added to this problem
I'm kinda new to VS Code Insiders. Is it already available in Insiders? Thank you for the great work.
Yes, and will be available in next stable release too.
Thanks for Profiles. It is the best feature ever.
I've just started using it with eight profiles, including one "Airplane Mode" 😎
Where can I find the profiles documentation?
I've seen this update; https://code.visualstudio.com/updates/v1_75#_profiles
But didn't find a link to the documentation.
@equiman WIP: https://github.com/microsoft/vscode-docs/issues/6020
I was also surprised that they released a new feature without actually telling us how to use it.
Sorry about that, and we will be coming up with user guide soon. I thought that the summary in release notes - https://code.visualstudio.com/updates/v1_75#_profiles is good enough to start with. But I agree user guide is definitely needed.
@sandy081 No worries - the wait was well worth it, because user profiles is an awesome new feature!
@sandy081 Any command line to start a specific profile?
@sandy081 Any command line to start a specific profile?
Please use code --help
to learn what arguments you can specify.
@sandy081 Any command line to start a specific profile?
Yes, you can use the --profile
flag.
code --profile "Default" code --profile "DotNet" code --profile "React" code --profile "Node"
I've also defined some aliases that help open the current path using some profiles.
alias vc="code --profile \"Default\""
alias vco="vc ."
alias vcn="vc . -n"
alias vd="code --profile \"DotNet\""
alias vdo="vd ."
alias vr="code --profile \"React\""
alias vro="vr ."
alias vn="code --profile \"Node\""
alias vno="vn ."
Overview
This issue aims to explore what adding "profiles" could look like in the product. These profiles can be used in education, presentations, or can even be language specific. The explorations should cover being able to setup and switch between profiles. Ideally these profiles should be synced with Settings Sync (if used) so you can use those profiles anywhere.
One idea for settings is to introduce a new settings object like:
The "Demos" profile inherits the current settings a user has and adds additional settings on top of the current ones. Also, when profiles are enabled we will create a "Default" profile where the user can switch back to their default mode.
Related issues