vscode-project-manager
vscode-project-manager copied to clipboard
[FEATURE] - Add support to `Profile` for Projects
Some time ago I tried reach out to VS Code team to allow projects to have an extensions file (in .vscode folder) where I can say which extensions I want to have enabled or disabled, sadly it got rejected.
I work with different type of projects, some requires PHP extensions, some have only NodeJS/JavaScript, TypeScript, Go and so on. My idea was to have a file or a config section somewhere where I can say in which projects/folder I want to have extensions enabled or even disabled in some cases. This would reduce the startup time heavily in my case.
I thought about ways how this could be done and now my idea is to have my projects managed together with my extensions I want to have enabled for my projects. So the best solution is to combine them in the project manager where a new object extensions
would allow extension to be enabled/disabled. I don't know if this is possible but I think this is something that belongs here.
This is what I found in the API:
https://github.com/Microsoft/vscode/blob/master/src/vs/vscode.d.ts#L8921-L8949
Something like this I guess.
const projects = [
{
enabled: true,
name: 'Test',
rootPath: '$home/Test',
group: 'testings',
extensions: {
'ms-vscode.vscode-typescript-tslint-plugin': true,
'rebornix.ruby': false
}
}
]
projects.forEach(({ extensions }) => {
Object.keys(extensions).forEach((extName, active) => {
const ext = vscode.extensions.getExtension(extName)
if (!ext) {
// not a known extension
return
}
if (active) {
ext.activate()
} else {
// deactivate extension here
}
})
})
Hi @muuvmuuv ,
Well, this is not the extension's original idea, which is simply to give you easy access of your favorite projects, but I agree this is a great addition to the workflow.
But I'm wondering, why VS Code does not support it natively (using a local file), just like it does for Extension Recommendations (.vscode\extensions.json
file). I mean, it already supports Enabling / Disabling extensions per workspace, so you already have that. The only difference is that it does not use a local file to store the enabled/disabled extensions, but probably uses the VS Code internal storage (workspace based).
I don't know when you reach out VS Code team asking for this, but maybe it was prior this Enable/Disable extension per workspace feature being implemented (I guess it happened last year). If that is the case, I think if you ask them again, it could be natively supported using .vscode\extensions.json
file.
My main concern about adding this to the extension (besides not being it's original idea) is because some extensions requires reloading the workspace when you enable/disable it. I'm not sure why it does happen, and what could be done to detect, in order to avoid/warn the user. Without this issue, as you already commented, it's doable :-).
Hope this helps
Ah I see some people already asked that again in VSCode, haven't checked that before. So hopefully they will add this soon ^^ And yes it was before the Extension Recommendations, don't get it why they implemented this, never have used this because it's so uncomfortable to use.
I just thought it would be a great combination with projects/workspaces in one destination. Anyway I still think this extension should be natively supported 😆 Code is on a good way to get a nice IDE but Project Management is missing and I really don't know why they don't want it.
https://github.com/microsoft/vscode/issues/40239
I can't understand how does this feature would binding to the current project?
I think it would be great to add parameters for exec the code
to the project manager settings file. For an example:
[
{
"name": "google_spreadsheets_chat_bot",
"rootPath": "/raid/user/gitlab.com/blah-blah ",
"paths": [],
"group": "",
"enabled": true,
"args": "--extensions-dir /home/user/yada-yada"
}
]
It would let us to use more flexible options. Using exported variables would be great too. "before runs triggers" are appreciated too.
Hi @oshliaer ,
Thank you for your suggestion, but to switch between projects, the extension does not use code
command line but the openFolder
command (VS Code API) and it does not provide args to add.
I'm not sure such extensibility is possible, because some of the command args may define how VS Code will open, so I guess to accomplish such feature, it would indeed need to use code
command line args. It's not something that I would like to bring back (at the early days of the extension, it worked this way), but I wouldn't say it won't happen 😄 . I'll move it to its own issue.
Hope this helps
@muuvmuuv ,
It appears my concerns about enabling/disabling extensions were real. A new extension called Profile Switcher already has a few open issues about it:
https://github.com/aaronpowell/vscode-profile-switcher/issues/
I'll keep watching its evolution, but if these errors didn't get fixed, I'll cancel the issue.
Hope this helps
Sounds reasonable for me. The extension looks good but I don't want to have this separated if it's possible 😄
Hi @muuvmuuv ,
I did take a look at Profile Switcher extension to see it evolution and just noted that it does not really _ disable/enable_ extensions but uninstall/install instead. That's not something that I would like to do, because installation is not a workspace feature.
For now, there is no API to deactivate
extensions, just activate
. For some reason the VS Code team decided to store this info in internal storage, not settings.json
/extensions.json
.
I'll keep looking
Depends on https://github.com/microsoft/vscode/issues/84997
Just recently (https://github.com/microsoft/vscode/issues/84997#issuecomment-574910685) the dependency issue has been moved to “Backlog Candidate” by the VS Code team, which means it has 60 days to receive enough attention (upvotes), otherwise it will be closed.
So, for those of you interested in this issue to be possible, go to the VS Code repo and upvote.
There are 12 :+1: now.
Such a feature would be extremely nice to have to improve the overall performance of VSCode as well.
I am working on many different projects with different languages and some extensions I don't use for specific languages simply drain performance. The profile switcher extension is a good idea. There is also an extension disabler extension but they are all not working with WSL and are unmaintained.
Hi @DAmNRelentless ,
The VS Code team is working on a new feature, temporarily called Profiles, and according to its issue (https://github.com/microsoft/vscode/issues/116740), it would allow enable/disable extensions per profile, via config file (https://github.com/microsoft/vscode/issues/40239).
It's great news 🎉
That's really awesome to hear! Would you implement the profiles feature into the project manager then? Like load a specific profile with each project automatically?
Maybe. It depends on how it will end up being developed by the VS Code team.
If it only loads from the .vscode/settings.json
file, I'll probably do nothing about it. You just have to add that setting to your project, and when you switch between projects, it will load the proper Profile
If they provide a Load Profile
command/API that applies a Profile, then each project could have a profile
attribute.
Let's see 😬
There's also this extension that came out in April vscode-profiles. I haven't tested it yet but I'm installing it now. It is somewhat of a hack with symlinks etc, but that's what's needed when there's no API to work with.
Edit: This extension looks to be more trouble than it's worth. You can't have different profiles in different windows. My impression is that it installs/uninstalls extensions when activating profiles. There are too many hacks. I wonder how it works with the settings for the web version of vscode.
There's also this extension that came out in April vscode-profiles. I haven't tested it yet but I'm installing it now. It is somewhat of a hack with symlinks etc, but that's what's needed when there's no API to work with.
Edit: This extension looks to be more trouble than it's worth. You can't have different profiles in different windows. My impression is that it installs/uninstalls extensions when activating profiles. There are too many hacks. I wonder how it works with the settings for the web version of vscode.
I've also used this. I literally tested all available profile and extension disabler extensions there are. None of them is really good. I stick to this extension for now although it has way more features than I need.
Personally, I hope that the native User Profile feature the VS Code team is planning (https://github.com/microsoft/vscode/issues/116740) would work on all scenarios.
At least based on the description, it seems they are aware of the per profile extension enablement.
Let’s see how it goes
@muuvmuuv after 4 years they realized that maybe they had to implement it
leaving a comment here just to follow the debate. I have this need to control plugins on a daily basis and I also never found anything that could help me.
Hi @miguelsmuller ,
I suggest you to keep track on https://github.com/microsoft/vscode/issues/116740 as well, because I hope this feature will be added natively in VS Code.
Hope this helps
Any news here?
I’m waiting to see how the new Profiles feature will work. But it seems (based on a few tests) that VS Code remembers the previous profile you were using for an specific project.
So, if you open a project and select/activate a profile, the next time you open that project, it will load that same profile.
But, it is not a stable experience, yet, as it did not recovered the previous profile in some testes.
Let’s see.
Just forgot to comment here about the Feature Request that the VS Code team asked me to create - https://github.com/microsoft/vscode/issues/156173. With this new API, I would be able to open a project with a pre-defined Profile.
I think this is good news, and with that, this feature could be finally released.
Stay tuned
Opening a folder with a specific profile should be happening very soon now ! Thanks for all the work @alefragnani
For sure 😬
@alefragnani 【Add support to Profile for Projects 】 When can I publish it?
Playing with it and it seems to be working just fine, and should be available in the next release.
Then, I wonder if add the possibility to assign profiles to Tags as well would be a good improvement to the next update 😬
@alefragnani just checking in - is there any ETA for releasing this feature?