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

Error when parsing mcrl2 file #1

Closed
keenstoat opened this issue Sep 28, 2024 · 3 comments · Fixed by #2
Closed

Error when parsing mcrl2 file #1

keenstoat opened this issue Sep 28, 2024 · 3 comments · Fixed by #2

Comments

@keenstoat
Copy link

Actual output

When running the example for the vending machine here: https://www.mcrl2.org/web/user_manual/tutorial/machine/index.html#first-variation

act
    ins10, optA, acc10, putA, coin, ready ;
proc
    User = ins10 . optA . User ;
    Mach = acc10 . putA . Mach ;
init
    allow(
        { coin, ready },
        comm(
            { ins10|acc10 -> coin, optA|putA -> ready },
            User || Mach
        ) 
    ) ;

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')

image

And the developer tools console shows the following error:

notificationsAlerts.ts:40 Error: Cannot read properties of undefined (reading 'uri')
	at h (/home/charles/.vscode-server/bin/38c31bc77e0dd6ae88a4e9cc93428cc27a56ba40/out/vs/workbench/api/node/extensionHostProcess.js:161:210901)
	at h.$executeContributedCommand (/home/charles/.vscode-server/bin/38c31bc77e0dd6ae88a4e9cc93428cc27a56ba40/out/vs/workbench/api/node/extensionHostProcess.js:161:211414)
	at y.S (/home/charles/.vscode-server/bin/38c31bc77e0dd6ae88a4e9cc93428cc27a56ba40/out/vs/workbench/api/node/extensionHostProcess.js:158:5968)
	at y.Q (/home/charles/.vscode-server/bin/38c31bc77e0dd6ae88a4e9cc93428cc27a56ba40/out/vs/workbench/api/node/extensionHostProcess.js:158:5734)
	at y.M (/home/charles/.vscode-server/bin/38c31bc77e0dd6ae88a4e9cc93428cc27a56ba40/out/vs/workbench/api/node/extensionHostProcess.js:158:4767)
	at y.L (/home/charles/.vscode-server/bin/38c31bc77e0dd6ae88a4e9cc93428cc27a56ba40/out/vs/workbench/api/node/extensionHostProcess.js:158:3602)
	at i.value (/home/charles/.vscode-server/bin/38c31bc77e0dd6ae88a4e9cc93428cc27a56ba40/out/vs/workbench/api/node/extensionHostProcess.js:158:2297)
	at r.B (/home/charles/.vscode-server/bin/38c31bc77e0dd6ae88a4e9cc93428cc27a56ba40/out/vs/workbench/api/node/extensionHostProcess.js:90:732)
	at r.fire (/home/charles/.vscode-server/bin/38c31bc77e0dd6ae88a4e9cc93428cc27a56ba40/out/vs/workbench/api/node/extensionHostProcess.js:90:949)
	at a.fire (/home/charles/.vscode-server/bin/38c31bc77e0dd6ae88a4e9cc93428cc27a56ba40/out/vs/workbench/api/node/extensionHostProcess.js:115:14463)
	at i.value (/home/charles/.vscode-server/bin/38c31bc77e0dd6ae88a4e9cc93428cc27a56ba40/out/vs/workbench/api/node/extensionHostProcess.js:184:8635)
	at r.B (/home/charles/.vscode-server/bin/38c31bc77e0dd6ae88a4e9cc93428cc27a56ba40/out/vs/workbench/api/node/extensionHostProcess.js:90:732)
	at r.fire (/home/charles/.vscode-server/bin/38c31bc77e0dd6ae88a4e9cc93428cc27a56ba40/out/vs/workbench/api/node/extensionHostProcess.js:90:949)
	at a.fire (/home/charles/.vscode-server/bin/38c31bc77e0dd6ae88a4e9cc93428cc27a56ba40/out/vs/workbench/api/node/extensionHostProcess.js:115:14463)
	at h.A (/home/charles/.vscode-server/bin/38c31bc77e0dd6ae88a4e9cc93428cc27a56ba40/out/vs/workbench/api/node/extensionHostProcess.js:115:17622)
	at i.value (/home/charles/.vscode-server/bin/38c31bc77e0dd6ae88a4e9cc93428cc27a56ba40/out/vs/workbench/api/node/extensionHostProcess.js:115:16996)
	at r.B (/home/charles/.vscode-server/bin/38c31bc77e0dd6ae88a4e9cc93428cc27a56ba40/out/vs/workbench/api/node/extensionHostProcess.js:90:732)
	at r.fire (/home/charles/.vscode-server/bin/38c31bc77e0dd6ae88a4e9cc93428cc27a56ba40/out/vs/workbench/api/node/extensionHostProcess.js:90:949)
	at m.acceptChunk (/home/charles/.vscode-server/bin/38c31bc77e0dd6ae88a4e9cc93428cc27a56ba40/out/vs/workbench/api/node/extensionHostProcess.js:115:12209)
	at i.value (/home/charles/.vscode-server/bin/38c31bc77e0dd6ae88a4e9cc93428cc27a56ba40/out/vs/workbench/api/node/extensionHostProcess.js:115:11479)
	at r.B (/home/charles/.vscode-server/bin/38c31bc77e0dd6ae88a4e9cc93428cc27a56ba40/out/vs/workbench/api/node/extensionHostProcess.js:90:732)
	at r.fire (/home/charles/.vscode-server/bin/38c31bc77e0dd6ae88a4e9cc93428cc27a56ba40/out/vs/workbench/api/node/extensionHostProcess.js:90:949)
	at a.z (/home/charles/.vscode-server/bin/38c31bc77e0dd6ae88a4e9cc93428cc27a56ba40/out/vs/workbench/api/node/extensionHostProcess.js:181:21815)
	at a.acceptFrame (/home/charles/.vscode-server/bin/38c31bc77e0dd6ae88a4e9cc93428cc27a56ba40/out/vs/workbench/api/node/extensionHostProcess.js:181:21621)
	at i.n (/home/charles/.vscode-server/bin/38c31bc77e0dd6ae88a4e9cc93428cc27a56ba40/out/vs/workbench/api/node/extensionHostProcess.js:181:20066)
	at /home/charles/.vscode-server/bin/38c31bc77e0dd6ae88a4e9cc93428cc27a56ba40/out/vs/workbench/api/node/extensionHostProcess.js:181:16993
	at Socket.b (/home/charles/.vscode-server/bin/38c31bc77e0dd6ae88a4e9cc93428cc27a56ba40/out/vs/workbench/api/node/extensionHostProcess.js:181:14623)
	at Socket.emit (node:events:519:28)
	at addChunk (node:internal/streams/readable:559:12)
	at readableAddChunkPushByteMode (node:internal/streams/readable:510:3)
	at Readable.push (node:internal/streams/readable:390:5)
	at TCP.onStreamRead (node:internal/stream_base_commons:191:23)

Expected output

Parsing the file with the tool shows a successful message:
image

Note

The error happens for all commands: parse, show graph, simulate, etc

@keenstoat
Copy link
Author

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
image

@CptWesley
Copy link
Owner

@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.

@CptWesley
Copy link
Owner

@keenstoat It took me a while to get around to this, but I found some time to fix it and release a new version on the vscode marketplace.

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

Successfully merging a pull request may close this issue.

2 participants