Closed cincofe closed 9 months ago
You need to ensure that the workspace path of matlab is the same as that of vscode.workspace, which is also the default setting.
Sorry, I just cannot understand the problem. Do you mean that you want to run a file that is outside the workspace?
In /src/extension.ts
line 222:
let relativePath = vscode.workspace.asRelativePath(filePath);
relativePath
has the correct value most of the time, except when the VS workspace ha multiple roots, i.e. when you added a second folder using File > Add folder to workspace ....
The workaround is of course to remove the extra folder before running the code, but sometimes it comes handy to keep related files/folders open in the some workspace.
If the workspace contains an additional folder (on top of the main workspace folder), the relative path used as argument of the Matlab's
run()
instruction contains the name of the folder itself and execution fails.Possibly related to this issue with
vscode.workspace.asRelativePath
?Successful execution example
In the folder
/path/to/sometoolbox
, thesometoolbox
workspace is defined bysometoolbox.code-workspace
, which contains the following:When the ⏩ button is pushed while
somescript.m
is the current document, the add-on issues the following Matlab command, which is correct:Failed execution example
If the
/path/to/anothertoolbox
folder is added to the same workspace, the resultingsometoolbox.code-workspace
is:Now, running the current document produces the following Matlab command:
which is of course incorrect and produces the following error:
Tested with:
on VS Code: