Is there a way to change the Update path VS Code? - visual-studio-code

So changed a folder name wherein VScode was installed.. thus when trying to update vscode refers old path and gives an error.
Is there a way to change the path to find the necessary file to run update??.. instead of renaming the folder back to it's original name?
I tried looking in the settings but found no option to change the path for updating.

Related

Get file path starting inside workspace folder - vscode

I'm trying to figure out how to get the relative file path starting from the workspace folder. So for example if the workspace folder is called My App and the file path is to the current folder is
file:///c%3A/Users/Bob/Documents/My%20App/backend/connections/server.js
Then I want to be able to store in a variable only backend/connections/server.js so it would exclude the workspace folder with the %20 in it. Currently
vscode.window.activeTextEditor.document.uri;
outputs
file:///c%3A/Users/Bob/Documents/My%20App/backend/connections/server.js.
Is there a method I can call that I'm not using or an easy way to do this without having to do some regex expression?
The short answer: no
Visual Studio Code will does not pass any awareness of itself into the code it hosts. While you can access the $workspaceFolder variable inside Code's launch.json and tasks.json, your code itself doesn't have access to those variables.
And even if it could, as soon as you would move your code outside of your development environment, it would break, as that $workspaceFolder would no longer be there.
If you want to make provisions for doing special stuff while in a dev environment, you'll have to define what you consider the workspace folder to be - there is no way for you to get that dynamically.

Flutter: Automatic refactor in VS Code after renaming directory or changing path

I am running Flutter on VS Code and often make changes within my Lib directory where I rename files or change their location within the directory. After making the change, all my import statements give me the error Target of URI doesn't exist and force me to manually update each import statement with the correct file path to the resource file. Is there a way for VS Code to automatically detect and update the file path in all dependent files whenever there is a change to that file's name or location?
Edit: I use absolute paths in my project: import 'package:Project/model/example.dart'
You can add the following line to your settings.json to automatically update import file paths: "dart.previewUpdateImportsOnRename": true

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.

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

MATLAB path doesn't match pathdef

I am running MATLAB 2013b on a CentOS machine. Right now I have startup.m set to cd me into another directory, lets call it shared, where I keep all of my code. I also have pathdef.m set to add shared and some of its subdirectories to the MATLAB path.
The problem is that once MATLAB is open and I check the path settings, ~/matlab has also been added to the top of the path list, ahead of shared. The home folder is where I keep some old versions of code, so it causes the wrong version to be run sometimes. I've double checked my pathdef and startup files, and the ~/matlab directory is definitely not listed. What could be causing MATLAB to automatically add this directory to the path, and how can I fix it?