Skip to content

Commit 42c03cf

Browse files
committed
v2.7.2
1 parent cc7434e commit 42c03cf

File tree

3 files changed

+16
-13
lines changed

3 files changed

+16
-13
lines changed

client/src/extension.ts

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -333,16 +333,15 @@ async function compileScript(editor: TextEditor) {
333333
let cmd = '', cmdop = workspace.getConfiguration('AutoHotkey2').CompilerCMD as string;
334334
const { document } = editor;
335335
const ws = workspace.getWorkspaceFolder(document.uri)?.uri.fsPath ?? '';
336-
const compilePath = findFile(['Compiler\\Ahk2Exe.exe', '..\\Compiler\\Ahk2Exe.exe'], ws);
337-
const executePath = resolvePath(ahkpath_cur, ws);
338-
if (!compilePath) {
339-
window.showErrorMessage(localize('ahk2.filenotexist', 'Ahk2Exe.exe'));
340-
return;
341-
}
342-
if (!executePath) {
343-
const s = ahkpath_cur || 'AutoHotkey.exe';
344-
window.showErrorMessage(localize('ahk2.filenotexist', s));
345-
return;
336+
cmdop = cmdop.replace(/(['"]?)\$\{execPath\}\1/gi, '\0');
337+
if (cmdop.includes('\0')) {
338+
const executePath = resolvePath(ahkpath_cur, ws);
339+
if (!executePath) {
340+
const s = ahkpath_cur || 'AutoHotkey.exe';
341+
window.showErrorMessage(localize('ahk2.filenotexist', s));
342+
return;
343+
}
344+
cmdop = cmdop.replaceAll('\0', `"${executePath}"`);
346345
}
347346
if (document.isUntitled || document.uri.scheme !== 'file') {
348347
window.showErrorMessage(localize('ahk2.savebeforecompilation'));
@@ -352,12 +351,16 @@ async function compileScript(editor: TextEditor) {
352351
const currentPath = document.uri.fsPath;
353352
const exePath = currentPath.replace(/\.\w+$/, '.exe');
354353
const prev_mtime = getFileMtime(exePath);
355-
cmdop = cmdop.replace(/(['"]?)\$\{execPath\}\1/gi, `"${executePath}"`);
356354
if (cmdop.match(/\bahk2exe\w*\.exe/i)) {
357355
cmd = cmdop + ' /in ' + currentPath;
358356
if (!cmd.toLowerCase().includes(' /out '))
359357
cmd += '/out "' + exePath + '"';
360358
} else {
359+
const compilePath = findFile(['Compiler\\Ahk2Exe.exe', '..\\Compiler\\Ahk2Exe.exe'], ws);
360+
if (!compilePath) {
361+
window.showErrorMessage(localize('ahk2.filenotexist', 'Ahk2Exe.exe'));
362+
return;
363+
}
361364
cmd = `"${compilePath}" ${cmdop} /in "${currentPath}" `;
362365
if (!cmdop.toLowerCase().includes(' /out '))
363366
cmd += '/out "' + exePath + '"';

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"description": "AutoHotkey v2 Language Support, based on vscode-lsp.",
55
"author": "thqby",
66
"publisher": "thqby",
7-
"version": "2.7.1",
7+
"version": "2.7.2",
88
"license": "LGPLv3.0",
99
"categories": [
1010
"Formatters",

server/src/lexer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5394,7 +5394,7 @@ export class Lexer {
53945394
break;
53955395
}
53965396
if ((t = line.match(/^;\s*@?(todo|fixme)\b(:?\s*)(.*)/i))) {
5397-
_this.children.push(DocumentSymbol.create(`${t[2].toUpperCase()}: ${t[4].trim()}`, undefined,
5397+
_this.children.push(DocumentSymbol.create(`${t[1].toUpperCase()}: ${t[3].trim()}`, undefined,
53985398
SymbolKind.Null, rg = make_range(parser_pos + 1, next_LF - parser_pos - 1), rg));
53995399
if (bg)
54005400
continue;

0 commit comments

Comments
 (0)