vlang/vscode-vlang

v.fmt does not work if there is syntax error in the file

felixf4xu opened this issue · 0 comments

Hi,

I'm testing this extension and I found that if the .v source file contains syntax error, v.fmt will not work: the command just exits silently without formatting the file, and there is no error message.

how to reproduce:

create a .v file with syntax error, then ctrl+shift+p to execute v.fmt command.

Expected behavior:

the file is formatted or there is error message.

Others

I checked the source code a little bit:

export async function fmt(): Promise<void> {
	const document = window.activeTextEditor.document;
	await document.save();
	const filePath = `"${document.fileName}"`;

	execVInTerminalOnBG(['fmt', '-w', filePath]);
}

execVInTerminalOnBG should be execVInTerminal and then there will be error message if the file contains syntax error.