From 4a5c6502e227db1a3e37d0e534c7e5c7aa3c1548 Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Sat, 22 Nov 2025 10:44:59 +0100 Subject: [PATCH 1/3] Added test workflow --- .github/workflows/deploy.yaml | 3 --- .github/workflows/test.yaml | 31 +++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/test.yaml diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 15cb25e..447b243 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -20,9 +20,6 @@ jobs: - name: Install dependencies run: npm --color ci - - name: Run lint - run: npm --color run lint - - name: Read version from package.json run: | VERSION=$(node -p "require('./package.json').version") diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml new file mode 100644 index 0000000..d32b42d --- /dev/null +++ b/.github/workflows/test.yaml @@ -0,0 +1,31 @@ +name: Test + +on: + push: + branches: [main] + pull_request: + types: [opened, synchronize, reopened] + +jobs: + run-tests: + name: Run tests + runs-on: ubuntu-latest + strategy: + fail-fast: false + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version-file: .nvmrc + + - name: Install dependencies + run: npm --color ci + + - name: Compile + run: npm --color run compile + + - name: Run lint + run: npm --color run lint From 7b48b5e6bf603a7533471fb7fc428aeb25a272d8 Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Sat, 22 Nov 2025 10:49:23 +0100 Subject: [PATCH 2/3] Update comment --- src/extension.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/extension.ts b/src/extension.ts index 905eae4..5f88571 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -65,7 +65,7 @@ const languages: Record = { }; // For some reason this crashes if we put it inside activate -// TODO: this isn't a field, suppress package member coloring like Go +// Fix: this isn't a field, suppress package member coloring like Go const initParser = treeSitter.Parser.init(); // Called when the extension is first activated by user opening a file with the appropriate language From fa07ded540afac6506202e83e15f459d8a0c04dd Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Sat, 22 Nov 2025 10:50:31 +0100 Subject: [PATCH 3/3] Ran prettier --- eslint.config.ts | 2 +- src/extension.ts | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/eslint.config.ts b/eslint.config.ts index 74d3c22..9c1ee26 100644 --- a/eslint.config.ts +++ b/eslint.config.ts @@ -40,5 +40,5 @@ export default eslintTs.config( { files: ["eslint.config.ts"], extends: [eslintTs.configs.disableTypeChecked], - } + }, ); diff --git a/src/extension.ts b/src/extension.ts index 5f88571..6e16350 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -87,7 +87,7 @@ export function activate(context: vscode.ExtensionContext) { const validateGetLanguage = (languageId: string) => { if (disabledLanguages?.has(languageId)) { throw new Error( - `${languageId} is disabled on vscode versions >= 1.98.0. See https://github.com/cursorless-dev/cursorless/issues/2879` + `${languageId} is disabled on vscode versions >= 1.98.0. See https://github.com/cursorless-dev/cursorless/issues/2879`, ); } }; @@ -117,7 +117,7 @@ export function activate(context: vscode.ExtensionContext) { absolute = path.join( context.extensionPath, "parsers", - language.module + ".wasm" + language.module + ".wasm", ); } @@ -186,7 +186,7 @@ export function activate(context: vscode.ExtensionContext) { function updateTree( parser: treeSitter.Parser, - edit: vscode.TextDocumentChangeEvent + edit: vscode.TextDocumentChangeEvent, ) { if (edit.contentChanges.length === 0) { return; @@ -239,7 +239,7 @@ export function activate(context: vscode.ExtensionContext) { async function openIfVisible(document: vscode.TextDocument) { if ( vscode.window.visibleTextEditors.some( - (editor) => editor.document.uri.toString() === document.uri.toString() + (editor) => editor.document.uri.toString() === document.uri.toString(), ) ) { await open(document); @@ -247,12 +247,12 @@ export function activate(context: vscode.ExtensionContext) { } context.subscriptions.push( - vscode.window.onDidChangeVisibleTextEditors(colorAllOpen) + vscode.window.onDidChangeVisibleTextEditors(colorAllOpen), ); context.subscriptions.push(vscode.workspace.onDidChangeTextDocument(edit)); context.subscriptions.push(vscode.workspace.onDidCloseTextDocument(close)); context.subscriptions.push( - vscode.workspace.onDidOpenTextDocument(openIfVisible) + vscode.workspace.onDidOpenTextDocument(openIfVisible), ); // Don't wait for the initial color, it takes too long to inspect the themes and causes VSCode extension host to hang @@ -263,7 +263,7 @@ export function activate(context: vscode.ExtensionContext) { if (ret == null) { const document = vscode.workspace.textDocuments.find( - (textDocument) => textDocument.uri.toString() === uri.toString() + (textDocument) => textDocument.uri.toString() === uri.toString(), ); if (document == null) { @@ -297,7 +297,7 @@ export function activate(context: vscode.ExtensionContext) { */ getLanguage(languageId: string): treeSitter.Language | undefined { console.warn( - "vscode-parse-tree: getLanguage is deprecated, use createQuery(languageId, source) instead." + "vscode-parse-tree: getLanguage is deprecated, use createQuery(languageId, source) instead.", ); validateGetLanguage(languageId); return languages[languageId]?.parser?.language ?? undefined; @@ -305,7 +305,7 @@ export function activate(context: vscode.ExtensionContext) { createQuery( languageId: string, - source: string + source: string, ): treeSitter.Query | undefined { const language = languages[languageId]?.parser?.language; if (language == null) {