Skip to content

Commit 10bb03a

Browse files
authored
Merge pull request #29 from SSlinky/dev
Composition Over Inheritence Refactor
2 parents 8a2bacd + dfffd12 commit 10bb03a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+4678
-1906
lines changed

.github/workflows/node.js.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,11 @@ jobs:
2929
- run: npm ci
3030
# For some reason, antlr4ng writes to a different location on the VM
3131
# than it does locally, preventing compile. Command added to move the generated files.
32+
- run: npm run textMate
3233
- name: npm run antlr4ng
33-
run: npm run antlr4ng && mv ./server/src/antlr/out/server/src/antlr/* ./server/src/antlr/out
34+
run: npm run antlr4ng && npm run antlr4ngPre && mv ./server/src/antlr/out/server/src/antlr/* ./server/src/antlr/out
3435
- run: npm run compile
35-
# - run: npm test
36+
- run: xvfb-run -a npm test
37+
if: runner.os == 'Linux'
38+
- run: npm test
39+
if: runner.os != 'Linux'

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@ node_modules
99
client/server
1010
.vscode-test
1111
sample*/**
12-
*.vsix
12+
*.vsix
13+
*.tsbuildinfo

.vscode-test.mjs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// .vscode-test.mjs
2+
import { defineConfig } from '@vscode/test-cli';
3+
4+
export default defineConfig({
5+
files: 'client/out/test/**/*.test.js',
6+
mocha: {
7+
ui: 'tdd',
8+
timeout: 4000
9+
}
10+
});

.vscode/launch.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,27 @@
4646
"startRule": "startRule",
4747
"printParseTree": true,
4848
"visualParseTree": true
49+
},
50+
{
51+
"name": "Debug ANTLR4 Pre grammar",
52+
"type": "antlr-debug",
53+
"request": "launch",
54+
"input": "${file}",
55+
"grammar": "server/src/antlr/vbapre.g4",
56+
"startRule": "startRule",
57+
"printParseTree": true,
58+
"visualParseTree": true
59+
},
60+
{
61+
"name": "Extension Tests",
62+
"type": "extensionHost",
63+
"request": "launch",
64+
"runtimeExecutable": "${execPath}",
65+
"args": [
66+
"--extensionDevelopmentPath=${workspaceFolder}",
67+
"--extensionTestsPath=${workspaceFolder}/client/out/test/index"
68+
],
69+
"outFiles": ["${workspaceFolder}/client/out/test/**/*.test.js"]
4970
}
5071
],
5172
"compounds": [

.vscodeignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ contributing.md
2323
*.interp
2424
*.tokens
2525
*.vsix
26+
*.tsbuildinfo
2627

2728
# Samples and testing
2829
sample*/**

client/package-lock.json

Lines changed: 17 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"vscode-languageclient": "^9.0.1"
1717
},
1818
"devDependencies": {
19-
"@types/vscode": "^1.94.0",
19+
"@types/vscode": "^1.96.0",
2020
"@vscode/test-electron": "^2.4.1"
2121
}
2222
}

client/src/syntaxes/vba.tmLanguage.yaml

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ repository:
377377
repository:
378378
argsVariable:
379379
name: meta.arguments.argsVariable.vba
380-
match: (?i),?\s*((?:Optional\s+)?(?:(?:ByVal|ByRef)\s+)?)?([a-z][a-z0-9_]*)(?:\s+(as\s+[a-z][a-z0-9_]*))?(\s*=\s*[^,)]+)?
380+
match: (?i),?\s*((?:Optional\s+)?(?:(?:ByVal|ByRef)\s+)?)?([a-z][a-z0-9_]*)(\(\))?(?:\s+(as\s+[a-z][a-z0-9_]*))?(\s*=\s*[^,)]+)?
381381
# Attempted replacing \s with (?:\s+|\s*_\s*\n) to consume a space or a line ending but it refuses to play the game.
382382
# match: ~~ doesn't work (?i),?(?:\s+|\s*_\s*\n)*((?:Optional(?:\s+|\s*_\s*\n)+)?(?:(?:ByVal|ByRef)(?:\s+|\s*_\s*\n)+)?)?([a-z][a-z0-9_]*)(?:(?:\s+|\s*_\s*\n)+(as(?:\s+|\s*_\s*\n)+[a-z][a-z0-9_]*))?((?:\s+|\s*_\s*\n)*=(?:\s+|\s*_\s*\n)*[^,\n)]+)?
383383
# match: ~~ all broken (?i),?(?:\s*_\s*\n)*((?:Optional(?:\s+(?:\s*_\s*\n)*))?(?:(?:ByVal|ByRef)(?:\s+(?:\s*_\s*\n)*))?)?([a-z][a-z0-9_]*)(?:(?:\s+(?:\s*_\s*\n)*)(as\(?:\s+(?:\s*_\s*\n)*)[a-z][a-z0-9_]*))?((?:\s*_\s*\n)*=(?:\s*_\s*\n)*[^,)]+)?
@@ -428,7 +428,7 @@ repository:
428428
patterns:
429429
- include: "#lineContinuation"
430430
apostropheComments:
431-
name: comment.line.apostropheXX.vba
431+
name: comment.line.apostrophe.vba
432432
match: (?i)\s*'.*
433433
remarkComments:
434434
name: comment.line.remark.vba
@@ -460,6 +460,7 @@ repository:
460460
patterns:
461461
- include: "#comments"
462462
- include: "#literals"
463+
- include: "#operators"
463464

464465
moduleOption:
465466
name: keyword.control.vba
@@ -673,7 +674,7 @@ repository:
673674
repository:
674675
variableDeclaration:
675676
name: storage.var-declaration.vba
676-
match: (?i)^\s*(Dim|Public|Private)\s+([a-z][a-z0-9_]*)(\(.*\))?(\s+As(?:\s+New)?\s+[A-Z][A-Z0-9_]*)?
677+
match: (?i)^\s*(Dim|Public|Private|Global)\s+([a-z][a-z0-9_]*)([&%#!@$^])?(\(.*\))?(\s+As(?:\s+New)?\s+[A-Z][A-Z0-9_]*)?
677678
captures:
678679
1:
679680
# Dim|Private
@@ -682,28 +683,34 @@ repository:
682683
# varName
683684
name: variable.other.readwrite.vba
684685
3:
686+
# Type hint?
687+
name: support.type.primitive.vba
688+
4:
685689
# Array bounds?
686690
patterns:
687691
- include: "#language"
688-
4:
692+
5:
689693
# As Type
690694
patterns:
691695
- include: "#types"
692696
constDeclaration:
693697
name: storage.const-declaration.vba
694-
match: "^\\s*((?i)(?:(?:Public|Private)\\s+)?Const)\\s+([A-Z][A-Z0-9_]*)((?i)\\s+As\\s+[A-Z][A-Z0-9_]*)?(.*)"
698+
match: ^\s*((?i)(?:(?:Public|Private)\s+)?Const)\s+([A-Z][A-Z0-9_]*)([&%#!@$^])?((?i)\s+As\s+[A-Z][A-Z0-9_]*)?(.*)
695699
captures:
696700
1:
697701
# Public|Private Const
698-
name: constant.language.vba
702+
name: storage.type.vba
699703
2:
700704
# CONSTNAME
701-
name: variable.other.constant.property
705+
name: variable.other.constant.vba
702706
3:
707+
# Type hint?
708+
name: support.type.primitive.vba
709+
4:
703710
# As Type
704711
patterns:
705712
- include: "#types"
706-
4:
713+
5:
707714
# = "some value"
708715
patterns:
709716
- include: "#language"

client/src/test/completion.test.ts

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,43 @@
1-
/* --------------------------------------------------------------------------------------------
2-
* Copyright (c) Microsoft Corporation. All rights reserved.
3-
* Licensed under the MIT License. See License.txt in the project root for license information.
4-
* ------------------------------------------------------------------------------------------ */
1+
// /* --------------------------------------------------------------------------------------------
2+
// * Copyright (c) Microsoft Corporation. All rights reserved.
3+
// * Licensed under the MIT License. See License.txt in the project root for license information.
4+
// * ------------------------------------------------------------------------------------------ */
55

6-
import * as vscode from 'vscode';
7-
import * as assert from 'assert';
8-
import { getDocUri, activate } from './helper';
6+
// import * as vscode from 'vscode';
7+
// import * as assert from 'assert';
8+
// import { getDocUri, activate } from './helper';
99

10-
suite('Should do completion', () => {
11-
const docUri = getDocUri('completion.txt');
10+
// suite('Should do completion', () => {
11+
// const docUri = getDocUri('completion.txt');
1212

13-
test('Completes JS/TS in txt file', async () => {
14-
await testCompletion(docUri, new vscode.Position(0, 0), {
15-
items: [
16-
{ label: 'JavaScript', kind: vscode.CompletionItemKind.Text },
17-
{ label: 'TypeScript', kind: vscode.CompletionItemKind.Text }
18-
]
19-
});
20-
});
21-
});
13+
// test('Completes JS/TS in txt file', async () => {
14+
// await testCompletion(docUri, new vscode.Position(0, 0), {
15+
// items: [
16+
// { label: 'JavaScript', kind: vscode.CompletionItemKind.Text },
17+
// { label: 'TypeScript', kind: vscode.CompletionItemKind.Text }
18+
// ]
19+
// });
20+
// });
21+
// });
2222

23-
async function testCompletion(
24-
docUri: vscode.Uri,
25-
position: vscode.Position,
26-
expectedCompletionList: vscode.CompletionList
27-
) {
28-
await activate(docUri);
23+
// async function testCompletion(
24+
// docUri: vscode.Uri,
25+
// position: vscode.Position,
26+
// expectedCompletionList: vscode.CompletionList
27+
// ) {
28+
// await activate(docUri);
2929

30-
// Executing the command `vscode.executeCompletionItemProvider` to simulate triggering completion
31-
const actualCompletionList = (await vscode.commands.executeCommand(
32-
'vscode.executeCompletionItemProvider',
33-
docUri,
34-
position
35-
)) as vscode.CompletionList;
30+
// // Executing the command `vscode.executeCompletionItemProvider` to simulate triggering completion
31+
// const actualCompletionList = (await vscode.commands.executeCommand(
32+
// 'vscode.executeCompletionItemProvider',
33+
// docUri,
34+
// position
35+
// )) as vscode.CompletionList;
3636

37-
assert.ok(actualCompletionList.items.length >= 2);
38-
expectedCompletionList.items.forEach((expectedItem, i) => {
39-
const actualItem = actualCompletionList.items[i];
40-
assert.equal(actualItem.label, expectedItem.label);
41-
assert.equal(actualItem.kind, expectedItem.kind);
42-
});
43-
}
37+
// assert.ok(actualCompletionList.items.length >= 2);
38+
// expectedCompletionList.items.forEach((expectedItem, i) => {
39+
// const actualItem = actualCompletionList.items[i];
40+
// assert.equal(actualItem.label, expectedItem.label);
41+
// assert.equal(actualItem.kind, expectedItem.kind);
42+
// });
43+
// }

0 commit comments

Comments
 (0)