Skip to content

Commit 4284d64

Browse files
Added test workflow (#121)
* Added test workflow * Update comment * Ran prettier
1 parent c0bf549 commit 4284d64

File tree

4 files changed

+42
-14
lines changed

4 files changed

+42
-14
lines changed

.github/workflows/deploy.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@ jobs:
2020
- name: Install dependencies
2121
run: npm --color ci
2222

23-
- name: Run lint
24-
run: npm --color run lint
25-
2623
- name: Read version from package.json
2724
run: |
2825
VERSION=$(node -p "require('./package.json').version")

.github/workflows/test.yaml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Test
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
types: [opened, synchronize, reopened]
8+
9+
jobs:
10+
run-tests:
11+
name: Run tests
12+
runs-on: ubuntu-latest
13+
strategy:
14+
fail-fast: false
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v4
18+
19+
- name: Set up Node.js
20+
uses: actions/setup-node@v4
21+
with:
22+
node-version-file: .nvmrc
23+
24+
- name: Install dependencies
25+
run: npm --color ci
26+
27+
- name: Compile
28+
run: npm --color run compile
29+
30+
- name: Run lint
31+
run: npm --color run lint

eslint.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,5 @@ export default eslintTs.config(
4040
{
4141
files: ["eslint.config.ts"],
4242
extends: [eslintTs.configs.disableTypeChecked],
43-
}
43+
},
4444
);

src/extension.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ const languages: Record<string, Language | undefined> = {
6565
};
6666

6767
// For some reason this crashes if we put it inside activate
68-
// TODO: this isn't a field, suppress package member coloring like Go
68+
// Fix: this isn't a field, suppress package member coloring like Go
6969
const initParser = treeSitter.Parser.init();
7070

7171
// Called when the extension is first activated by user opening a file with the appropriate language
@@ -87,7 +87,7 @@ export function activate(context: vscode.ExtensionContext) {
8787
const validateGetLanguage = (languageId: string) => {
8888
if (disabledLanguages?.has(languageId)) {
8989
throw new Error(
90-
`${languageId} is disabled on vscode versions >= 1.98.0. See https://github.com/cursorless-dev/cursorless/issues/2879`
90+
`${languageId} is disabled on vscode versions >= 1.98.0. See https://github.com/cursorless-dev/cursorless/issues/2879`,
9191
);
9292
}
9393
};
@@ -117,7 +117,7 @@ export function activate(context: vscode.ExtensionContext) {
117117
absolute = path.join(
118118
context.extensionPath,
119119
"parsers",
120-
language.module + ".wasm"
120+
language.module + ".wasm",
121121
);
122122
}
123123

@@ -186,7 +186,7 @@ export function activate(context: vscode.ExtensionContext) {
186186

187187
function updateTree(
188188
parser: treeSitter.Parser,
189-
edit: vscode.TextDocumentChangeEvent
189+
edit: vscode.TextDocumentChangeEvent,
190190
) {
191191
if (edit.contentChanges.length === 0) {
192192
return;
@@ -239,20 +239,20 @@ export function activate(context: vscode.ExtensionContext) {
239239
async function openIfVisible(document: vscode.TextDocument) {
240240
if (
241241
vscode.window.visibleTextEditors.some(
242-
(editor) => editor.document.uri.toString() === document.uri.toString()
242+
(editor) => editor.document.uri.toString() === document.uri.toString(),
243243
)
244244
) {
245245
await open(document);
246246
}
247247
}
248248

249249
context.subscriptions.push(
250-
vscode.window.onDidChangeVisibleTextEditors(colorAllOpen)
250+
vscode.window.onDidChangeVisibleTextEditors(colorAllOpen),
251251
);
252252
context.subscriptions.push(vscode.workspace.onDidChangeTextDocument(edit));
253253
context.subscriptions.push(vscode.workspace.onDidCloseTextDocument(close));
254254
context.subscriptions.push(
255-
vscode.workspace.onDidOpenTextDocument(openIfVisible)
255+
vscode.workspace.onDidOpenTextDocument(openIfVisible),
256256
);
257257

258258
// 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) {
263263

264264
if (ret == null) {
265265
const document = vscode.workspace.textDocuments.find(
266-
(textDocument) => textDocument.uri.toString() === uri.toString()
266+
(textDocument) => textDocument.uri.toString() === uri.toString(),
267267
);
268268

269269
if (document == null) {
@@ -297,15 +297,15 @@ export function activate(context: vscode.ExtensionContext) {
297297
*/
298298
getLanguage(languageId: string): treeSitter.Language | undefined {
299299
console.warn(
300-
"vscode-parse-tree: getLanguage is deprecated, use createQuery(languageId, source) instead."
300+
"vscode-parse-tree: getLanguage is deprecated, use createQuery(languageId, source) instead.",
301301
);
302302
validateGetLanguage(languageId);
303303
return languages[languageId]?.parser?.language ?? undefined;
304304
},
305305

306306
createQuery(
307307
languageId: string,
308-
source: string
308+
source: string,
309309
): treeSitter.Query | undefined {
310310
const language = languages[languageId]?.parser?.language;
311311
if (language == null) {

0 commit comments

Comments
 (0)