Skip to content

Commit f4412d8

Browse files
committed
Adds a check for valid path to Au3Check
1 parent 0bf3a9a commit f4412d8

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/extension.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
const vscode = require('vscode');
22
const path = require('path');
3+
const fs = require('fs');
34
const { spawn } = require('child_process');
45
const languageConfiguration = require('./languageConfiguration');
56
const hoverFeature = require('./ai_hover');
@@ -16,8 +17,6 @@ const {
1617
updateDiagnostics,
1718
} = require('./checkAutoItCode');
1819

19-
const { checkPath } = vscode.workspace.getConfiguration('autoit');
20-
2120
let diagnosticCollection;
2221

2322
const parseAu3CheckOutput = (document, output) => {
@@ -49,7 +48,7 @@ const parseAu3CheckOutput = (document, output) => {
4948
};
5049

5150
function checkAutoItCode(document) {
52-
const { enableDiagnostics } = vscode.workspace.getConfiguration('autoit');
51+
const { checkPath, enableDiagnostics } = vscode.workspace.getConfiguration('autoit');
5352

5453
diagnosticCollection.clear();
5554

@@ -61,6 +60,13 @@ function checkAutoItCode(document) {
6160
return;
6261
}
6362

63+
if (!fs.existsSync(checkPath)) {
64+
vscode.window.showErrorMessage(
65+
'Inavlid Check Path! Please review AutoIt settings (Check Path in UI, autoit.checkPath in JSON)',
66+
);
67+
return;
68+
}
69+
6470
const checkProcess = spawn(checkPath, [document.fileName], {
6571
cwd: path.dirname(document.fileName),
6672
});

0 commit comments

Comments
 (0)