Skip to content

Commit

Permalink
6.1.0 - 2024-09-22 🫙 (#509)
Browse files Browse the repository at this point in the history
  • Loading branch information
mark-wiemer authored Sep 22, 2024
1 parent 351db60 commit e1813b5
Show file tree
Hide file tree
Showing 18 changed files with 154 additions and 65 deletions.
5 changes: 5 additions & 0 deletions .vscode-test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,9 @@
import { defineConfig } from '@vscode/test-cli';
export default defineConfig({
files: ['out/src/**/*.test.js'],
// https://mochajs.org/#command-line-usage
// https://github.com/mochajs/mocha/tree/main/example/config
mocha: {
timeout: 900_000,
},
});
16 changes: 1 addition & 15 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,11 @@
"type": "extensionHost",
"request": "launch",
"args": ["--extensionDevelopmentPath=${workspaceRoot}"],
"outFiles": ["${workspaceRoot}/out/**/*.js"],
"preLaunchTask": "npm: build",
"preLaunchTask": "npm: build:dev", // :dev for sourcemaps
"env": {
"VSCODE_AHK_SERVER_PATH": "", // default path works for debug as well
"SYNTAXES_PATH": "" // default path works for debug as well
}
},
{
"name": "Test Extension",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"--disable-extensions",
"--extensionDevelopmentPath=${workspaceFolder}",
"--extensionTestsPath=${workspaceFolder}/out/src/test/suite/index"
],
"outFiles": ["${workspaceFolder}/out/test/**/*.js"],
"preLaunchTask": "npm: compile-ts"
}
]
}
8 changes: 5 additions & 3 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# Changelog

## 6.1.0 - unreleased 🫙
## 6.1.0 - 2024-09-22 🫙

- Add "General > showOutputView" setting to toggle automatically showing the output view when running or debugging a script
- Add `General > showOutput` setting to toggle automatically showing the output view when running a script ([#492](https://github.com/mark-wiemer-org/ahkpp/issues/492))
- Fix quick help when selecting quoted strings ([#376](https://github.com/mark-wiemer-org/ahkpp/issues/376))
- Fix description for `V2 > General > actionWhenV1Detected` setting key
- Fix `V2 > Syntaxes` setting

## 6.0.0 - 2024-09-01 🥂

Expand Down Expand Up @@ -206,7 +208,7 @@ Fixup new command names and IDs:

</details>

## 5.1.0 - 2024-08-22 🧪
## 5.1.0 - 2024-08-22 🧪🎂

<details><summary>5.1.0</summary>

Expand Down
2 changes: 1 addition & 1 deletion ahk2
Submodule ahk2 updated from 611cef to fddd2e
11 changes: 5 additions & 6 deletions demos/manualTests/config.ahk2
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@
#SingleInstance

;; General
; showOutputView
; showOutput
; always: shows on start
; never: never shows
; works for both running and debugging
; works only for running scripts
; running: output is in the Output view

; always+run
; always+debug
; never+run
; never+debug
; always
; never
x := 1
2 changes: 1 addition & 1 deletion license.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Portions copyright 2019-2022 [Weijan Chen](https://github.com/cweijan/autohotkey

Unless otherwise indicated, all content is licensed under MIT.
AutoHotkey H icon licensed under GNU GENERAL PUBLIC LICENSE
Files under in the ahk2 submodule are licensed under GNU LESSER GENERAL PUBLIC LICENSE.
Files in the ahk2 submodule are licensed under GNU LESSER GENERAL PUBLIC LICENSE.
Other files licensed outside of MIT are marked as such at the top of the file.

MIT License
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 11 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "vscode-autohotkey-plus-plus",
"displayName": "AutoHotkey Plus Plus",
"version": "6.0.0",
"version": "6.1.0",
"description": "AutoHotkey v1 and v2 language support for Visual Studio Code: IntelliSense, debugging, formatting, and more!",
"categories": [
"Debuggers",
Expand Down Expand Up @@ -73,10 +73,12 @@
"test": "npm run test-grammar && npm run test-unit",
"pretest-grammar": "npm run compile-grammar",
"test-grammar": "vscode-tmgrammar-snap language/samples/*.{ahk1,ahk2}",
"pretest-unit": "npm run compile-ts",
"pretest-unit": "npm run compile-ts && npm run build",
"test-unit": "vscode-test",
"test-unit:ci": "npm run test-unit -- -i --fgrep @ignoreCI",
"test:ci": "npm run test-grammar && npm run test-unit:ci",
"validate": "npm run lint && npm run test && npm run package",
"validate:ci": "npm run lint:ci && npm run test && npm run package",
"validate:ci": "npm run lint:ci && npm run test:ci && npm run package",
"vscode:prepublish": "npm run compile-grammar && npm run build && echo Packaging..."
},
"contributes": {
Expand Down Expand Up @@ -229,22 +231,22 @@
"AHK++.general": {
"type": "object",
"properties": {
"showOutputView": {
"showOutput": {
"type": "string",
"enum": [
"always",
"never"
],
"enumDescriptions": [
"%ahk++.config.general.showOutputView.always%",
"%ahk++.config.general.showOutputView.never%"
"%ahk++.config.general.showOutput.always%",
"%ahk++.config.general.showOutput.never%"
],
"default": "always",
"description": "%ahk++.config.general.showOutputView%"
"description": "%ahk++.config.general.showOutput%"
}
},
"default": {
"showOutputView": "always"
"showOutput": "always"
},
"additionalProperties": {
"type": "string"
Expand Down Expand Up @@ -632,7 +634,7 @@
"SwitchToV1",
"SkipLine"
],
"description": "%ahk++.config.v2.actionWhenV1Detectedd%"
"description": "%ahk++.config.v2.actionWhenV1Detected%"
},
"commentTagRegex": {
"type": "string",
Expand Down
6 changes: 3 additions & 3 deletions package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
"ahk++.command.setV2Interpreter": "Set AHK v2 Interpreter",
"ahk++.command.stop": "Stop AHK Script",
"ahk++.command.updateVersionInfo": "Update File Version Info",
"ahk++.config.general.showOutputView": "Show output view when running or debugging a script. View can always be toggled with F1 > 'View: Toggle Output' (`Ctrl+Shift+U`)",
"ahk++.config.general.showOutputView.always": "Always open the output when running or debugging a script",
"ahk++.config.general.showOutputView.never": "Never automatically show the output",
"ahk++.config.general.showOutput": "Automatically show output view when running a script. View can always be toggled with F1 > 'View: Toggle Output' (`Ctrl+Shift+U`)",
"ahk++.config.general.showOutput.always": "Always open the output view when running a script",
"ahk++.config.general.showOutput.never": "Never automatically show the output view",
"ahk++.config.v2.actionWhenV1Detected": "Action when v1 script is detected",
"ahk++.config.v2.commentTagRegex": "The regular expression for custom symbols to appear in the breadcrumb and elsewhere. Default matches any line that starts with `;;`. Changes take effect after restart.",
"ahk++.config.v2.completionCommitCharacters": "Characters which commit auto-completion",
Expand Down
6 changes: 3 additions & 3 deletions package.nls.zh-cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
"ahk++.command.setV2Interpreter": "选择AutoHotkey2解释器",
"ahk++.command.stop": "停止运行中的脚本",
"ahk++.command.updateVersionInfo": "更新文件版本信息",
"ahk++.config.general.showOutputView": "运行或调试脚本时显示输出视图。可以通过 F1 > 视图切换视图: 切换输出 (`Ctrl+Shift+U`)",
"ahk++.config.general.showOutputView.always": "运行或调试脚本时始终打开输出结果",
"ahk++.config.general.showOutputView.never": "从不自动显示输出",
"ahk++.config.general.showOutput": "运行脚本时自动显示输出视图。可通过 F1 > '视图.切换输出' (`Ctrl+Shift+U`)随时切换视图: Toggle Output' (`Ctrl+Shift+U`)",
"ahk++.config.general.showOutput.always": "运行脚本时始终打开输出视图",
"ahk++.config.general.showOutput.never": "从不自动显示输出视图",
"ahk++.config.v2.actionWhenV1Detected": "检测到v1脚本时的行为",
"ahk++.config.v2.commentTagRegex": "用来从注释中提取命名标记的正则表达式, 并生成模块符号",
"ahk++.config.v2.completeFunctionCalls": "当右侧不存在`(`或`[`时, 给函数补全添加括号; 否则向右移动光标",
Expand Down
2 changes: 1 addition & 1 deletion src/common/global.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export enum ConfigKey {
indentCodeAfterLabel = 'v1.formatter.indentCodeAfterLabel',
maximumParseLength = 'v1.intellisense.maximumParseLength',
preserveIndent = 'v1.formatter.preserveIndent',
showOutputView = 'general.showOutputView',
showOutput = 'general.showOutput',
templateSnippetNameV1 = 'v1.file.templateSnippetName',
templateSnippetNameV2 = 'v2.file.templateSnippetName',
trimExtraSpaces = 'v1.formatter.trimExtraSpaces',
Expand Down
8 changes: 1 addition & 7 deletions src/debugger/debugSession.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { commands } from 'vscode';
import {
BreakpointEvent,
InitializedEvent,
Expand All @@ -12,7 +11,6 @@ import { DebugProtocol } from '@vscode/debugprotocol';
import { DebugDispatcher } from './debugDispatcher';
import { Continue } from './struct/command';
import { VscodeScope } from './struct/scope';
import { ConfigKey, Global } from '../common/global';

/**
* This interface describes the mock-debug specific launch attributes
Expand Down Expand Up @@ -40,7 +38,7 @@ export class DebugSession extends LoggingDebugSession {
private dispatcher: DebugDispatcher;

public constructor() {
super('ahk-debug.txt');
super();

// this debugger uses zero-based lines and columns
this.setDebuggerLinesStartAt1(false);
Expand All @@ -61,10 +59,6 @@ export class DebugSession extends LoggingDebugSession {
})
.on('output', (text) => {
this.sendEvent(new OutputEvent(`${text}\n`));
if (Global.getConfig(ConfigKey.showOutputView)) {
// focus on debug console view
commands.executeCommand('workbench.debug.action.focusRepl');
}
})
.on('end', () => {
this.sendEvent(new TerminatedEvent());
Expand Down
1 change: 0 additions & 1 deletion src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import { initializeLanguageVersionService } from './service/languageVersionServi
import { activate as activateV2 } from '../ahk2/client/src/extension';

export function activate(context: vscode.ExtensionContext) {
console.log('ahk++ activated');
(async () => {
Global.updateStatusBarItems('Indexing AutoHotkey workspace...');
await Parser.buildByPath(vscode.workspace.rootPath);
Expand Down
25 changes: 12 additions & 13 deletions src/providers/format.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getDocument } from '../test/utils';
import { getDocument, showDocument } from '../test/utils';
import * as assert from 'assert';
import * as fs from 'fs-extra';
import * as path from 'path';
Expand Down Expand Up @@ -163,23 +163,22 @@ suite('External formatter', () => {
externalFormatTests.forEach((formatTest) => {
test(`${formatTest.filenameRoot} external format`, async () => {
// Arrange
const inFilename = formatTest.filenameRoot + inFilenameSuffix;
const inFilePath = path.join(
filesParentPath,
formatTest.filenameRoot + inFilenameSuffix,
);
const outFilename = formatTest.filenameRoot + outFilenameSuffix;
const outFileString = fs
.readFileSync(path.join(filesParentPath, outFilename))
.toString();
const unformattedSampleFile = await getDocument(
path.join(filesParentPath, inFilename),
);
const originalText = unformattedSampleFile.getText();
const textEditor = await vscode.window.showTextDocument(
unformattedSampleFile,
);
const unformattedSampleDoc = await getDocument(inFilePath);
const originalText = unformattedSampleDoc.getText();
const textEditor = await showDocument(unformattedSampleDoc);
const formatter = new FormatProvider();

// Act
const edits = formatter.provideDocumentFormattingEdits(
unformattedSampleFile,
unformattedSampleDoc,
{
...defaultOptions,
...formatTest.options,
Expand All @@ -196,10 +195,10 @@ suite('External formatter', () => {
assert.strictEqual(textEditor.document.getText(), outFileString);

// Teardown - revert the file to its original state
const lastLineIndex = unformattedSampleFile.lineCount - 1;
const lastLineIndex = unformattedSampleDoc.lineCount - 1;
const lastLineLength =
unformattedSampleFile.lineAt(lastLineIndex).text.length;
const fullDocumentRange = unformattedSampleFile.validateRange(
unformattedSampleDoc.lineAt(lastLineIndex).text.length;
const fullDocumentRange = unformattedSampleDoc.validateRange(
new vscode.Range(
new vscode.Position(0, 0),
new vscode.Position(lastLineIndex + 1, lastLineLength + 1), // + 1 to ensure full coverage
Expand Down
51 changes: 51 additions & 0 deletions src/test/ahk2.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import * as assert from 'assert';
import * as vscode from 'vscode';
import * as path from 'path';
import {
closePanel,
getDocument,
isOutputVisible,
showDocument,
updateConfig,
} from './utils';

// Currently in `out` folder, need to get back to main `src` folder
const filesParentPath = path.join(
__dirname, // ./out/src/test
'..', // ./out/src
'..', // ./out
'..', // .
'src', // ./src
'test', // ./src/test
'samples', // ./src/test/samples
);

suite('ahk2', () => {
// CI does not have AHK installed
suite('general.showOutput @ignoreCI', () => {
const before = async (show: 'always' | 'never') => {
await updateConfig('general', { showOutput: show });
const filePath = path.join(filesParentPath, 'ahk2.ahk2');
const doc = await getDocument(filePath);
await showDocument(doc);
};

const runTests: [name: string, show: 'always' | 'never'][] = [
['always + run', 'always'],
['never + run', 'never'],
];

runTests.forEach(([name, show]) => {
test(name, async () => {
await before(show);

// run cmd opens panel when `showOutput` is 'always'
await closePanel();

await vscode.commands.executeCommand(`ahk++.run`);

assert.equal(await isOutputVisible(), show === 'always');
});
});
});
});
4 changes: 4 additions & 0 deletions src/test/samples/ahk2.ahk2
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#Requires AutoHotkey v2.0
#SingleInstance Force

x := 1
14 changes: 14 additions & 0 deletions src/test/utils.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import * as assert from 'assert';
import * as vscode from 'vscode';
import { closePanel, isOutputVisible } from './utils';

suite('utils', () => {
suite('closeOutputView', () => {
test('open to closed', async () => {
vscode.commands.executeCommand('workbench.action.togglePanel'); // open panel
await closePanel();

assert.equal(await isOutputVisible(), false);
});
});
});
Loading

0 comments on commit e1813b5

Please sign in to comment.