Open keenstoat opened 2 months ago
Found what was causing the problem.
In the toProjectPath()
function vscode.workspace.workspaceFolders.filter
filter returns an empty array:
const dir = vscode.workspace.workspaceFolders
? vscode.workspace.workspaceFolders.filter(x => x.name == vscode.workspace.name)[0].uri.fsPath
: px.dirname(vscode.window.activeTextEditor.document.fileName);
I've solved it locally with the following:
function toProjectPath(pathName='') {
const wsFolders = vscode.workspace.workspaceFolders ?
vscode.workspace.workspaceFolders.filter(x => x.name == vscode.workspace.name) : [];
const dir = wsFolders.length > 0
? wsFolders[0].uri.fsPath
: px.dirname(vscode.window.activeTextEditor.document.fileName);
const normalized = px.normalize(dir);
const trimmed = pathName.trim();
if (trimmed.length == 0) {
return normalized;
}
return px.join(normalized, trimmed);
}
I'm getting an expected output now
@keenstoat Hi, thank you for reporting this issue. Would you be willing to create a pull request to apply your fix? I will then release a new version of the extension. I will need some time to figure out how to do that again exactly, since it's been a while since I released the original version.
Actual output
When running the example for the vending machine here: https://www.mcrl2.org/web/user_manual/tutorial/machine/index.html#first-variation
And running the "Parse" action button (also for the mCRL2:Parse command)
Then an error is displayed with the message:
Cannot read properties of undefined (reading 'uri')
And the developer tools console shows the following error:
Expected output
Parsing the file with the tool shows a successful message:
Note
The error happens for all commands: parse, show graph, simulate, etc