Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v6.1.0 #509

Merged
merged 35 commits into from
Sep 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
2775fbf
Link closed issues to changelog
mark-wiemer Sep 22, 2024
3ff471a
Fix typo in actionWhenV1Detected setting
mark-wiemer Sep 22, 2024
ad6a436
Remove broken test launch config
mark-wiemer Sep 22, 2024
57a7513
Add test util showDocument
mark-wiemer Sep 22, 2024
6ab0234
Remove console log
mark-wiemer Sep 22, 2024
d02c4b2
Update ahk2 to remove console log
mark-wiemer Sep 22, 2024
4eee67e
Add run script test skeleton
mark-wiemer Sep 22, 2024
1cc9af9
Add test for output view visible
mark-wiemer Sep 22, 2024
605972d
Run all the tests!
mark-wiemer Sep 22, 2024
5a31d40
Document showOutputView config
mark-wiemer Sep 22, 2024
8c0c6fd
Build ext before running tests
mark-wiemer Sep 22, 2024
a656b51
Set test timeout to 15min
mark-wiemer Sep 22, 2024
d258751
Add tests for `showOutputView` in run mode
mark-wiemer Sep 22, 2024
cb6fc11
Update utils to clarify output view specifically
mark-wiemer Sep 22, 2024
f8919b5
Separate run and debug tests for readability
mark-wiemer Sep 22, 2024
cf94026
Remove application code opening output channel
mark-wiemer Sep 22, 2024
8947383
Reopen #70
mark-wiemer Sep 22, 2024
dfcae37
Use ahk2 main
mark-wiemer Sep 22, 2024
f5ecb7e
Try to fix breakpoints issue
mark-wiemer Sep 22, 2024
eb1ed58
Update config.ahk2
mark-wiemer Sep 22, 2024
372d7bf
Update to v6.1.0
mark-wiemer Sep 22, 2024
ca24b11
Fixup nls files
mark-wiemer Sep 22, 2024
128109f
Note fix of actionWhenV1Detected desc
mark-wiemer Sep 22, 2024
e0a77a3
Fixup `showOutputView` as code
mark-wiemer Sep 22, 2024
9591781
Rename `showOutputView` to `showOutput`
mark-wiemer Sep 22, 2024
2b61b11
Use ahk2 main
mark-wiemer Sep 22, 2024
aa02cdd
Fix typo in license.txt
mark-wiemer Sep 22, 2024
b4e3691
Run all tests
mark-wiemer Sep 22, 2024
035848e
Fix format
mark-wiemer Sep 22, 2024
4adfb00
Reduce showOutput test flakiness
mark-wiemer Sep 22, 2024
279d69b
Really reduce flakiness
mark-wiemer Sep 22, 2024
f2c4963
Does this even work in CI?
mark-wiemer Sep 22, 2024
599af0c
Link to mocha docs
mark-wiemer Sep 22, 2024
5f845e8
Ignore showOutput test in CI
mark-wiemer Sep 22, 2024
3c39b0e
Remove debug tests for now
mark-wiemer Sep 22, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading