From 578d85223edfb12ea85bd02d9bf4357c48e6fd46 Mon Sep 17 00:00:00 2001 From: Mark Wiemer <7833360+mark-wiemer@users.noreply.github.com> Date: Sat, 2 Nov 2024 06:53:50 -0700 Subject: [PATCH] Improve included method detection (#554) --- .vscode/dev.code-snippets | 4 +- ahk2 | 2 +- changelog.md | 6 +++ src/common/codeUtil.ts | 5 +- src/common/out.ts | 5 ++ src/parser/parser.ts | 17 ++++-- src/providers/defProvider.ts | 67 ++++++++++++------------ src/providers/defProvider.utils.test.ts | 57 ++++++++++++++++++++ src/providers/defProvider.utils.ts | 69 +++++++++++++++++++++++++ 9 files changed, 190 insertions(+), 42 deletions(-) create mode 100644 src/providers/defProvider.utils.test.ts create mode 100644 src/providers/defProvider.utils.ts diff --git a/.vscode/dev.code-snippets b/.vscode/dev.code-snippets index 8f5f4a8a..a62abe73 100644 --- a/.vscode/dev.code-snippets +++ b/.vscode/dev.code-snippets @@ -21,12 +21,12 @@ "scope": "javascript,typescript", "prefix": "suite", "body": [ - "suite('$1', () => {", + "suite($1.name, () => {", " const tests: [", " name: string,", " args: Parameters,", " expected: ReturnType,", - " ][] = [$0];", + " ][] = [[$0]];", " tests.forEach(([name, args, expected]) =>", " test(name, () => assert.strictEqual($1(...args), expected)),", diff --git a/ahk2 b/ahk2 index c05e25ed..22d94d87 160000 --- a/ahk2 +++ b/ahk2 @@ -1 +1 @@ -Subproject commit c05e25ede71fb57a15c9e1fa18606068a2a8a88e +Subproject commit 22d94d87c46270b6729f18ef3350a7605c700842 diff --git a/changelog.md b/changelog.md index 71c3cc95..428e6dee 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,11 @@ # Changelog +## 6.4.0 - unreleased + +### New features + +- Hovering over a filename in an `#include` directive now provides a link to that document in your IDE + ## 6.3.0 - 2024-10-19 🕳️ ### New features diff --git a/src/common/codeUtil.ts b/src/common/codeUtil.ts index d4f86949..970f4d32 100644 --- a/src/common/codeUtil.ts +++ b/src/common/codeUtil.ts @@ -20,10 +20,10 @@ export class CodeUtil { } /** - * Concats an array and an item or array of items. Impure, @see array is modified + * Concats an array and an item or array of items. Impure, `array` is modified * @param array The initial array * @param items Either an item to add to the end of the array, - * or another array to concat to the end of @see array + * or another array to concat to the end of `array` */ public static join(array: unknown[], items: unknown) { if (!array || !items) { @@ -54,7 +54,6 @@ export class CodeUtil { } /** Whether the current active text editor is for an AHK v1 file */ -// todo use LSP for all v2 functionality export const isV1 = (): boolean => vscode.window.activeTextEditor?.document.languageId === LanguageId.ahk1; diff --git a/src/common/out.ts b/src/common/out.ts index 56d185ea..a6b7aabf 100644 --- a/src/common/out.ts +++ b/src/common/out.ts @@ -4,6 +4,10 @@ import * as vscode from 'vscode'; export class Out { private static outputChannel: vscode.OutputChannel; + /** + * Logs the given value without focusing the output view. + * Prepends all logs with `new Date().toISOString()`. + */ public static debug(value: Error | string) { Out.log(value, false); } @@ -12,6 +16,7 @@ export class Out { * Logs the given value. Traces errors to console before logging. * Prepends all logs with `new Date().toISOString()`. * @param value The value to log + * @param focus whether to focus the output view. Defaults to true. */ public static log(value: Error | string, focus = true) { if (value instanceof Error) { diff --git a/src/parser/parser.ts b/src/parser/parser.ts index 7c1a17d8..873b3d01 100644 --- a/src/parser/parser.ts +++ b/src/parser/parser.ts @@ -53,6 +53,7 @@ export class Parser { document: vscode.TextDocument, options: BuildScriptOptions = {}, ): Promise