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

possible solution to resolve --user-data-dir and --extensions-dir (#869, #411, #331, and etc) #905

Closed
jjangga0214 opened this issue Jun 10, 2019 · 5 comments

Comments

@jjangga0214
Copy link

jjangga0214 commented Jun 10, 2019

Hi, while using vscode as root on Kali linux with --user-data-dir (e.g. code --user-data-dir /root/.config/vscode), I faced an issue that code-settings-sync does not install extensions.

It seems the problem is caused from the fact that there's no vscode API for an extenstion to detect --user-data-dir and --extensions-dir. I could also found issues like #869 and #411.

And if so, we don't know whether and when the API are to be provided. Therefore, I suggests a (possibly temporary) workaround.

The idea is user provides environment variables like $CODE_USER_DATA_DIR or $CODE_EXTENSIONS_DIR. For instance, I could run CODE_USER_DATA_DIR=/root/.config/vscode code --user-data-dir /root/.config/vscode.

To achieve that, we might abandon using vscode.commands.executeCommand, and replace it with cli.

src/service/pluginService.ts

v3.3.0 (line 221)

const name = ext.publisher + "." + ext.name; //extension identifier
await vscode.commands.executeCommand(
            "workbench.extensions.installExtension", name);

Suggestion (concept code) based on master (line 301)

const name = missExt.publisher + "." + missExt.name;
const extensionCli = `${myExt} 
${process.env.CODE_USER_DATA_DIR ? 
"--user-data-dir " + process.env.CODE_USER_DATA_DIR : "" } 
${process.env.CODE_EXTENSIONS_DIR ? 
"--extensions-dir " + process.env.CODE_EXTENSIONS_DIR : "" } 
--install-extension ${name}`;
exec(extensionCli, (err, stdout, stderr) => {
...
})

How do you think of the idea?

@jjangga0214 jjangga0214 changed the title possible solution to #411 possible solution to resolve --user-data-dir and --extensions-dir (#869, #411, #331, and etc) Jun 10, 2019
@auxves
Copy link
Contributor

auxves commented Jun 10, 2019

@jjangga0214 The changes in v3.3.0 were necessary to support all versions of VSCode. Also, using the API to install extensions should completely fix this issue. Have you tried installing a build of v3.3.0 and trying that out?

@jjangga0214
Copy link
Author

jjangga0214 commented Jun 10, 2019

@arnohovhannisyan Thanks for letting me know!
I currently use v3.2.9, and due to a strange bug ( photo below ), couldn't run v3.3.0 locally.
Screenshot from 2019-06-10 19-49-52
It'd be great anyway if I really can use it as you mentioned on my Kali when v3.3.0 becomes the official.

@auxves
Copy link
Contributor

auxves commented Jun 10, 2019

@jjangga0214
Copy link
Author

@arnohovhannisyan Happy to see it works even on today!
So, I guess #411 can be closed (if it's tested on windows 10).
Thank you :)

@shanalikhan
Copy link
Owner

Duplicate of #411

@shanalikhan shanalikhan marked this as a duplicate of #411 Jun 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants