Skip to content

Commit d876eab

Browse files
committed
v2.7.6
1 parent 22ea66a commit d876eab

File tree

6 files changed

+41
-45
lines changed

6 files changed

+41
-45
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
syntaxes/* linguist-vendored

.github/workflows/node.js.yml

Lines changed: 0 additions & 30 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,21 @@
1-
name: Create Release
1+
name: Build And Release
22

33
on:
44
push:
55
tags: [v*]
66
jobs:
77
build:
8-
runs-on: ubuntu-latest
8+
strategy:
9+
matrix:
10+
node-version: [20.x]
11+
runs-on: windows-latest
912
steps:
10-
- uses: actions/checkout@v3
13+
- name: Checkout
14+
uses: actions/checkout@v5
15+
- run: npm ci && npm run package
1116
- env:
1217
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1318
TAG_NAME: ${{ github.ref_name }}
14-
run: gh release create $TAG_NAME --generate-notes --notes "[Download VSIX package](https://marketplace.visualstudio.com/_apis/public/gallery/publishers/thqby/vsextensions/vscode-autohotkey2-lsp/${TAG_NAME/v}/vspackage)"
19+
run:
20+
gh release create $TAG_NAME --generate-notes --notes "[Download VSIX package](https://marketplace.visualstudio.com/_apis/public/gallery/publishers/thqby/vsextensions/vscode-autohotkey2-lsp/${TAG_NAME/v}/vspackage)" vscode-autohotkey2-lsp-${TAG_NAME/v}.vsix
1521
shell: bash

client/src/extension.ts

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import { resolve } from 'path';
2727
import { createServer, Socket } from 'net';
2828
import { lstatSync, readlinkSync } from 'fs';
2929
import { opendir, readFile } from 'fs/promises';
30-
import { ChildProcess, execSync, spawn, SpawnOptionsWithoutStdio } from 'child_process';
30+
import { ChildProcess, execSync, spawn, SpawnOptions } from 'child_process';
3131
import { registerCommonFeatures } from './common';
3232

3333
const ahkconfig = workspace.getConfiguration('AutoHotkey2');
@@ -254,7 +254,7 @@ async function runScript(textEditor: TextEditor, selection = false) {
254254
args.push(lc);
255255
return '';
256256
});
257-
const opt: SpawnOptionsWithoutStdio = {
257+
const opt: SpawnOptions = {
258258
cwd: resolve(textEditor.document.fileName, '..'),
259259
};
260260
const uiAccess = ahkStatusBarItem.text.endsWith('[UIAccess]');
@@ -263,6 +263,7 @@ async function runScript(textEditor: TextEditor, selection = false) {
263263
const redirect = `(()=>(std:=FileOpen('${pipe}','w'),DllCall('SetStdHandle','uint',-11,'ptr',std.Handle),DllCall('SetStdHandle','uint',-12,'ptr',std.Handle),OnExit((*)=>!std)))()`;
264264
createPipeReadStream(pipe).then(out => out.on('data', output_append));
265265
args.push('/include', createTempFile(redirect, 'ahk-stdout-redirect'));
266+
opt.stdio = 'ignore';
266267
if (selecttext)
267268
path = createTempFile(selecttext);
268269
} else opt.env = Object.fromEntries(Object.entries(process.env)
@@ -285,13 +286,14 @@ async function runScript(textEditor: TextEditor, selection = false) {
285286
});
286287
if (!cp.pid)
287288
return;
288-
if (path === '*')
289-
cp.stdin?.write(selecttext), cp.stdin?.end();
289+
if (!uiAccess) {
290+
cp.stderr!.on('data', output_append), cp.stdout!.on('data', output_append);
291+
if (path === '*')
292+
cp.stdin!.end(selecttext);
293+
}
290294
ahkprocesses.set(cp.pid, cp);
291295
cp.path = path;
292296
commands.executeCommand('setContext', 'ahk2:isRunning', true);
293-
if (!uiAccess)
294-
cp.stderr?.on('data', output_append), cp.stdout?.on('data', output_append);
295297
cp.on('exit', (code) => {
296298
outputchannel.appendLine(`[info] ${spid}exited with code=${code} in ${(Date.now() - startTime) / 1000} seconds`);
297299
ahkprocesses.delete(cp.pid!);
@@ -377,8 +379,8 @@ async function compileScript(editor: TextEditor) {
377379
else
378380
window.showErrorMessage(localize('ahk2.compiledfailed'));
379381
});
380-
cp.stderr?.on('data', output_append);
381-
cp.stdout?.on('data', output_append);
382+
cp.stderr.on('data', output_append);
383+
cp.stdout.on('data', output_append);
382384
} else
383385
window.showErrorMessage(localize('ahk2.compiledfailed'));
384386
}
@@ -439,7 +441,7 @@ if ${!!word} && !DllCall('oleacc\\AccessibleObjectFromWindow', 'ptr', ctl, 'uint
439441
const isUIAccess = ahkStatusBarItem.text.endsWith('[UIAccess]');
440442
const cp = spawn(executePath, ['/ErrorStdOut', isUIAccess ? createTempFile(script) : '*']);
441443
if (!isUIAccess)
442-
cp.stdin.write(script), cp.stdin.end();
444+
cp.stdin.end(script);
443445
}
444446

445447
function getConfig<T>(section: string) {
@@ -718,9 +720,11 @@ function createTempFile(str: string, prefix = 'ahk-script') {
718720
function createPipeReadStream(path: string): Promise<Socket> {
719721
return new Promise((resolve) => {
720722
const server = createServer((socket) => {
723+
const destroy = () => socket.destroy();
721724
server.close();
722725
socket.setEncoding('utf-8');
723-
socket.on('error', () => socket.destroy());
726+
socket.on('close', destroy);
727+
socket.on('error', destroy);
724728
resolve(socket);
725729
}).listen(path);
726730
setTimeout(() => server.close(), 2000);

package.json

Lines changed: 2 additions & 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.5",
7+
"version": "2.7.6",
88
"license": "LGPLv3.0",
99
"categories": [
1010
"Formatters",
@@ -661,6 +661,7 @@
661661
"eslint": "eslint --fix",
662662
"package": "vsce package",
663663
"publish": "vsce publish",
664+
"push-tag": "node push_tag.js",
664665
"test": "mocha -u tdd ./server/out/test/*.test.js",
665666
"test-grammar": "vscode-tmgrammar-snap tmgrammar-test/*.ahk",
666667
"vscode:prepublish": "node esbuild.mjs && vscode-test && npm run test-grammar",

push_tag.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
const fs = require('fs');
2+
const cp = require('child_process');
3+
const ver = 'v' + JSON.parse(fs.readFileSync(__dirname + '/package.json', { encoding: 'utf8' })).version;
4+
cp.exec([
5+
'git add .',
6+
`git commit -m ${ver}`,
7+
`git tag -a ${ver} -m ${ver} -f`,
8+
`git push origin main --tags`,
9+
].join(' && '), { cwd: __dirname }, (err, stdout, stderr) => {
10+
if (err)
11+
return console.error(err);
12+
stdout && console.log(stdout);
13+
stderr && console.error(stderr);
14+
});

0 commit comments

Comments
 (0)