1
1
const vscode = require ( 'vscode' ) ;
2
2
const path = require ( 'path' ) ;
3
+ const fs = require ( 'fs' ) ;
3
4
const { spawn } = require ( 'child_process' ) ;
4
5
const languageConfiguration = require ( './languageConfiguration' ) ;
5
6
const hoverFeature = require ( './ai_hover' ) ;
@@ -16,8 +17,6 @@ const {
16
17
updateDiagnostics,
17
18
} = require ( './checkAutoItCode' ) ;
18
19
19
- const { checkPath } = vscode . workspace . getConfiguration ( 'autoit' ) ;
20
-
21
20
let diagnosticCollection ;
22
21
23
22
const parseAu3CheckOutput = ( document , output ) => {
@@ -49,7 +48,7 @@ const parseAu3CheckOutput = (document, output) => {
49
48
} ;
50
49
51
50
function checkAutoItCode ( document ) {
52
- const { enableDiagnostics } = vscode . workspace . getConfiguration ( 'autoit' ) ;
51
+ const { checkPath , enableDiagnostics } = vscode . workspace . getConfiguration ( 'autoit' ) ;
53
52
54
53
diagnosticCollection . clear ( ) ;
55
54
@@ -61,6 +60,13 @@ function checkAutoItCode(document) {
61
60
return ;
62
61
}
63
62
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
+
64
70
const checkProcess = spawn ( checkPath , [ document . fileName ] , {
65
71
cwd : path . dirname ( document . fileName ) ,
66
72
} ) ;
0 commit comments