VS Code don't load the user-data - visual-studio-code

My problem is that the portable version of visual studio code don't load my settings I had copied from the folder %APPDATA%/code/user.
I loaded the .zip data and extracted the folder. I added a data folder into the extracted folder of VS Code. It's in Visual Studio Code\data. In there i copied the folder "user" from %APPDATA%/code/ and renamed the user folder into "user-data". Then I started code and the usersettings are not loaded.
The command .\code.exe --user-directory .\data\user-data won't work.
Is this a bug or did I do something wrong?

In portable mode, the --user-directory command linte option is ignored.
From the documentation:
--user-data-dir <dir>
Specifies the directory that user data is kept in, useful when running as root. Has no effect in Portable Mode.
Instead, use the default location of user data for a portable install and copy your user data to that directory (from a previous comment it seems like you've already done so successfuly).
For anyone wishing to use a different user data directory when in portable mode, symlink-ing the user data folder should be a viable option if on a linux-like platform.
(Trivia: this was at first reported as bug, after which the documentation was updated, rather making it a feature.)

You can simply create a folder called data in the root folder with
VS Code.
After the startup, the files with standard settings will be
created in the data folder.
Then you can just copy the settings from the folder %AppData%\Code\User to the folder data\user-data\User.
To migrate already installed extensions, copy the contents of the %HomePath%\.vscode\extensions folder to the data\extensions folder.

Related

vscode: Where stores the session data (restored opened files)? Is that possible to use relative path?

If I use vscode to open a directory and then opened some files and quit, vscode will reopen all the files at the next time when it launches.
But there is a problem. It seems vscode is not using relative path for storing this info and does not store this info inside the project directory. So if I move the directory or rename it, and then open the directory again, for example code projectNewName/, my previous session (opened files/opened editors) are lost. I have no idea where this session data stores and if it is possible to configure it to store relative path and save the session file inside the project directory, for example, project/.vscode or project/.vscode/session. If the opened editors session is stored inside a project directory, it will be restored regardless where the directory is and what the directory name is.
TL;DR: currently, configuration of this path is not supported.
VSCode stores the states for all the workspaces, in its global config folder under /Code/User/workspaceStorage/. See the path to the settings.json in this help paragraph for your OS and then just replace the end of the path. For Windows, for example, the settings path is %APPDATA%\Code\User\settings.json, so the state storage is
%APPDATA%/Code/User/workspaceStorage/
In this directory, there are many subdirectories with some hex names. Please, refer to my another answer for a python script to browse it. Each folder contains a workspace.json with mostly data only referring to the path of the workspace. There are also state.vscdb files in these directories. These are sqlite databases with only one table:
CREATE TABLE ItemTable (key TEXT UNIQUE ON CONFLICT REPLACE, value BLOB);
It is used as a key|value storage for all the state variables like:
workbench.panel.output|{"workbench.panel.output":{"collapsed":false,"isHidden":true}}
As far as I see from VSCode source, currently only a global path from the environment is used to locate this file:
this.environmentService.workspaceStorageHome
this.environmentService.globalStorageHome
which resolves to
get workspaceStorageHome(): URI { return URI.joinPath(this.appSettingsHome, 'workspaceStorage'); }
get globalStorageHome(): URI { return URI.joinPath(this.appSettingsHome, 'globalStorage'); }
So, it seems there are currently no options to customize it from the settings.json.

Visual Studio Code (VSCode) - how to update the standalone (.zip) version?

There is no "check for updates" when using the standalone/no install version.
What is best way to update a standalone version without losing settings etc.?
According to my experience (VSCode in a standalone .zip file uncompressed in D:\ using Win7 OS) you just need to download and uncompress the archive containing the new version (v 1.41.1).
When you run Code.exe in the new folder, your settings file is used and everithing is OK. (then, when you are really really sure that it is everithing OK, you could delete the old version).
If you changed the default settings file location, take a look at https://code.visualstudio.com/docs/getstarted/settings#_settings-file-locations
From the official doc it says when downloaded through zip file, one has download the release manually for each update and place the unzip version inside the Program files (Windows).
According to the special portable page all the settings, plugins, etc. of the standalone version
are stored in the data-folder. So assuming you called your vscode-folder vscode:
download the new version
unpack to vscode2 folder adjacent to current vscode
move data folder from vscode to vscode2
delete old vscode-folder
rename vscode2 to vscode
done
P.S.: Current portable versions notify about new version, but clicking on it leads to download, so above list still applies.
Edit 2020/08/04: To make a "normal" install portable one just needs to create the data folder inside the installation/unpack directory of VSC.
To download the old archive, replace user|system with archive in the URL.
Before:
https://update.code.visualstudio.com/1.69.2/win32-x64-user/stable
After:
https://update.code.visualstudio.com/1.69.2/win32-x64-archive/stable

Change .vscode folder location

I'm programming a client side applications using SharePoint Designer 2013.
I want to change to VSCODE since it supports a lot of extensions for some Javascript library like angular, jQuery. And because of the Chrome/Node.js debugger extension.
But when I try to start any Debugger, I got the error:
Unable to create 'launch.json' file inside the '.vscode' folder (Error: UNKNOWN: unknown error, mkdir '\\servername\DavWWWRoot\sitename\Style Library\.vscode').
I get this error because it's impossible to create a folder in SharePoint where the name starts with dot.
So there's a possibility to change the name of this folder or the file location to any directory in my local computer?
No, it's not possible to move/rename that folder. VS code is a tool that bases project management on folder content. So it is essential that the project settings reside in the folder being managed.
You can move the "extensions" folder, but unfortunately not the argv.json (so the ".vscode" will, at least be recreated on vscode launch)
https://github.com/microsoft/vscode/issues/17691#issuecomment-559234574
I hope that'll finally change sometime .
https://github.com/microsoft/vscode/issues/3884
https://github.com/OmniSharp/omnisharp-roslyn/issues/953

Deploy files in the localState folder during installation of a store app

I am building an app for windows store and I need some default and example data to be in the localstate folder (Windows.Storage.ApplicationData.current.localFolder) when the app run the first time.
The folder and files structure is a bit complex and I tryed to copy the files at the start of the application, but I can't manage that way.
Is it possible to have files being copied automatically from the installation folder to the localstate folder during the store app installation?
Unfortunately, customization of the app install process isn't currently supported. You have to do this as part of your first run processing.
One possibility is that you include the data in your package as a .ZIP or other compressed file and use an appropriate library to expand that file into a folder structure on startup. That could simplify your logic considerably. (I don't have a library to recommend; it's just an idea.)

wrx file handling with Developer Studio

Is there a way to make Progress Developer Studio 3.7 (Eclipse) generate all the wrx files (from the ocx) and place them in for example the rcode folder?
Clarification:
I dont know even how to make one wrx file. Have heard this "They get automatically created as soon as you drop an OCX control onto an ABL frame". But if you have removed that file, can you create it anew without having to redrop the control? And how do you automatically place it in a certain folder?
wrx files contain the properties of an ActiveX you set in the appbuilder.
If you loose the wrx, those properties revert back to default values. You should check-in the wrx files into your version control system together with the source .
To copy the wrx to the rcode directory I use robocopy.
suppose your sources are in a directory named src then you can copy them using
robocopy src rcode *.wrx /s
The wrx-file is generated when compiling in the AppBuilder.
See this entry in the Progress Knowledge base