Skip to content

Commit 5f74304

Browse files
committed
Merge branch 'dev'
2 parents 59ba0df + ae8013c commit 5f74304

36 files changed

+364
-245
lines changed

.eslintrc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"env": {
3-
"es6": true,
3+
"es2021": true,
44
"node": true
55
},
66
"extends": [

.github/workflows/codeql.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
strategy:
2121
fail-fast: false
2222
matrix:
23-
language: [ 'javascript' , 'typescript' ]
23+
language: [ 'javascript', 'typescript' ]
2424

2525
steps:
2626
- name: Checkout repository

.prettierignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
*.md
21
package*.json

.prettierrc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"arrowParens": "avoid",
3+
"endOfLine": "lf",
34
"singleQuote": true,
45
"trailingComma": "all",
56
"printWidth": 120,
@@ -11,6 +12,12 @@
1112
"options": {
1213
"parser": "json"
1314
}
15+
},
16+
{
17+
"files": "*.md",
18+
"options": {
19+
"tabWidth": 2
20+
}
1421
}
1522
]
1623
}

.vscode/launch.json

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,19 @@
44
"configurations": [
55
{
66
"name": "Run G-Code (Sandbox) - Samples",
7-
"type": "pwa-extensionHost",
7+
"type": "extensionHost",
88
"request": "launch",
99
"runtimeExecutable": "${execPath}",
1010
"args": [
1111
"--disable-extensions",
12+
"--trace-warnings",
1213
"--trace-depreciation",
1314
"--extensionDevelopmentPath=${workspaceFolder}",
1415
"${workspaceFolder}/samplenc/sample-colors.nc",
15-
"${workspaceFolder}/samplenc/sample-profile.nc"
16+
"${workspaceFolder}/samplenc/sample-profile.nc",
17+
"${workspaceFolder}/samplenc/sample-circular-pocket.nc"
1618
],
19+
"cwd": "${workspaceFolder}",
1720
"outFiles": [
1821
"${workspaceFolder}/dist/**/*.js"
1922
],
@@ -25,22 +28,24 @@
2528
"preLaunchTask": "npm: webpack",
2629
"skipFiles": [
2730
"<node_internals>/**",
28-
"**/node_modules/**"
31+
"**/node_modules/**",
32+
"**/resources/app/out/vs/**"
2933
],
3034
"smartStep": true,
3135
"sourceMaps": true,
32-
"trace": true
36+
"trace": true,
3337
},
3438
{
3539
"name": "Run G-Code (Sandbox)",
36-
"type": "pwa-extensionHost",
40+
"type": "extensionHost",
3741
"request": "launch",
3842
"runtimeExecutable": "${execPath}",
3943
"args": [
4044
"--disable-extensions",
4145
"--trace-depreciation",
4246
"--extensionDevelopmentPath=${workspaceFolder}"
4347
],
48+
"cwd": "${workspaceFolder}",
4449
"outFiles": [
4550
"${workspaceFolder}/dist/**/*.js"
4651
],
@@ -52,15 +57,16 @@
5257
"preLaunchTask": "npm: webpack",
5358
"skipFiles": [
5459
"<node_internals>/**",
55-
"**/node_modules/**"
60+
"**/node_modules/**",
61+
"**/resources/app/out/vs/**"
5662
],
5763
"smartStep": true,
5864
"sourceMaps": true,
5965
"trace": true
6066
},
6167
{
6268
"name": "Run G-Code (Full)",
63-
"type": "pwa-extensionHost",
69+
"type": "extensionHost",
6470
"request": "launch",
6571
"runtimeExecutable": "${execPath}",
6672
"args": [
@@ -86,7 +92,7 @@
8692
},
8793
{
8894
"name": "Run G-Code As Web Extension",
89-
"type": "pwa-extensionHost",
95+
"type": "extensionHost",
9096
"debugWebWorkerHost": true,
9197
"request": "launch",
9298
"args": [
@@ -105,26 +111,35 @@
105111
},
106112
{
107113
"name": "G-Code Mocha Unit Tests",
108-
"type": "pwa-node",
114+
"type": "node",
109115
"request": "launch",
110116
"internalConsoleOptions": "openOnSessionStart",
111117
"program": "${workspaceFolder}/node_modules/mocha/bin/_mocha",
112118
"args": [
113-
"--no-timeouts",
114-
"--colors",
115119
"--require",
116120
"ts-node/register",
121+
"--timeout",
122+
"0",
123+
"--colors",
124+
"--recursive",
117125
"${workspaceFolder}/test/unit/*.test.ts"
118126
],
119127
"skipFiles": [
120128
"<node_internals>/**",
121129
"**/node_modules/**"
122130
],
131+
"presentation": {
132+
"hidden": false,
133+
"group": "Testing",
134+
"order": 1
135+
},
123136
"env": {
124137
"NODE_ENV": "testing",
125138
"TS_NODE_PROJECT": "./tsconfig.tests.json"
126139
},
127-
"sourceMaps": true
140+
"sourceMaps": true,
141+
"smartStep": true,
142+
"trace": true
128143
}
129144
]
130145
}

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 45 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,7 @@
5959
"activationEvents": [
6060
"onLanguage:gcode",
6161
"onView:gcode.gcodeTree",
62-
"onView:gcode.gcodeStats",
63-
"onCommand:gcode.views.navTree.refresh",
64-
"onCommand:gcode.views.stats.refresh",
65-
"onCommand:gcode.supportGCode"
62+
"onView:gcode.gcodeStats"
6663
],
6764
"capabilities": {
6865
"virtualWorkspaces": true
@@ -165,12 +162,18 @@
165162
"enum": [
166163
"Mill",
167164
"Lathe",
168-
"3D Printer"
165+
"3D Printer",
166+
"Swiss",
167+
"Laser",
168+
"EDM"
169169
],
170170
"enumDescriptions": [
171171
"Configure G-Code Extension for CNC Mill",
172172
"Configure G-Code Extension for CNC Lathe",
173-
"Configure G-Code Extension for 3D Printers"
173+
"Configure G-Code Extension for 3D Printers",
174+
"Configure G-Code Extension for Swiss-style Lathes",
175+
"Configure G-Code Extension for Laser Machine Tools",
176+
"Configure G-Code Extension for EDM"
174177
],
175178
"markdownDescription": "Configure G-Code Extension for a Specific Machine Type",
176179
"scope": "window"
@@ -217,6 +220,7 @@
217220
"enum": [
218221
"silent",
219222
"errors",
223+
"warnings",
220224
"verbose",
221225
"debug"
222226
],
@@ -347,38 +351,63 @@
347351
],
348352
"commandPalette": [
349353
{
350-
"command": "gcode.views.navTree.refresh",
351-
"when": "true"
354+
"command": "gcode.addComment",
355+
"when": "editorLangId == gcode"
352356
},
353357
{
354-
"command": "gcode.views.stats.refresh",
358+
"command": "gcode.addLineNumbers",
359+
"when": "editorLangId == gcode"
360+
},
361+
{
362+
"command": "gcode.removeComment",
363+
"when": "editorLangId == gcode"
364+
},
365+
{
366+
"command": "gcode.removeLineNumbers",
367+
"when": "editorLangId == gcode"
368+
},
369+
{
370+
"command": "gcode.showSettings",
355371
"when": "true"
356372
},
357373
{
358374
"command": "gcode.supportGCode",
359375
"when": "false"
376+
},
377+
{
378+
"command": "gcode.views.navTree.refresh",
379+
"when": "editorLangId == gcode"
380+
},
381+
{
382+
"command": "gcode.views.stats.refresh",
383+
"when": "editorLangId == gcode"
360384
}
361385
],
362386
"editor/context": [
363387
{
364-
"when": "resourceLangId == gcode",
388+
"when": "editorLangId == gcode",
365389
"command": "gcode.views.navTree.refresh",
366390
"group": "gcode"
367391
},
368392
{
369-
"when": "resourceLangId == gcode",
393+
"when": "editorLangId == gcode",
370394
"command": "gcode.views.stats.refresh",
371395
"group": "gcode"
372396
},
373397
{
374-
"when": "resourceLangId == gcode",
398+
"when": "editorLangId == gcode",
375399
"command": "gcode.addComment",
376400
"group": "gcode"
377401
},
378402
{
379-
"when": "resourceLangId == gcode",
403+
"when": "editorLangId == gcode",
380404
"command": "gcode.removeComment",
381405
"group": "gcode"
406+
},
407+
{
408+
"when": "editorLangId == gcode",
409+
"command": "gcode.showSettings",
410+
"group": "gcode"
382411
}
383412
]
384413
},
@@ -448,6 +477,7 @@
448477
},
449478
"scripts": {
450479
"analyze:bundle": "webpack --env analyzeBundle",
480+
"build": "webpack -mode development",
451481
"bundle": "webpack --mode production",
452482
"clean": "shx rm -rf out/* && rm -rf dist/*",
453483
"compile": "tsc -p ./",
@@ -457,8 +487,9 @@
457487
"pretest": "npm run compile",
458488
"pretty": "prettier --config .prettierrc --loglevel warn .",
459489
"pub": "vsce publish",
490+
"refresh": "npm run clean && shx rm -rf ./node_modules && npm install",
460491
"test": "node ./out/test/runTests.js",
461-
"test:unit": "SET TS_NODE_PROJECT=./tsconfig.tests.json&& mocha -r ts-node/register test/unit/*.test.ts",
492+
"test:unit": "SET TS_NODE_PROJECT=./tsconfig.tests.json && mocha -r ts-node/register test/unit/*.test.ts",
462493
"vscode:prepublish": "npm run bundle",
463494
"webpack": "webpack --mode development",
464495
"webpack-dev": "webpack --mode development --watch"

src/control.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ import { StatusBarControl } from './util/statusBar';
1212
import { NavTreeView } from './views/navTreeView';
1313
import { GCodeUnitsController } from './gcodeUnits';
1414
import { StatsView } from './views/statsView';
15-
import { constants, Contexts, PIcon, VSBuiltInCommands } from './util/constants';
16-
import { UtilCommands } from './util/commands/common';
15+
import { constants, Contexts, GCommands, PIcon, VSBuiltInCommands } from './util/constants';
1716
import { Version } from './util/version';
1817
import { Messages } from './util/messages';
1918
import { StateControl } from './util/stateControl';
2019
import { CodesWebview } from './webviews/codesWebview';
2120
import { MachineTypeControl } from './util/machineType';
2221
import { GCodeHoverControl } from './hovers/gcodeHoverControl';
2322
import { defaults } from './util/configuration/defaults';
23+
import { registerCommands } from './util/commands/functions';
2424

2525
const cfgUnits = 'general.units';
2626
const cfgAutoRef = {
@@ -32,6 +32,7 @@ export class Control {
3232
private static _config: Config | undefined;
3333
private static _context: ExtensionContext;
3434
private static _units: string | undefined;
35+
private static _version: Version;
3536

3637
// Controllers
3738
private static _machineTypeControl: MachineTypeControl | undefined;
@@ -75,9 +76,16 @@ export class Control {
7576

7677
// Static Methods
7778
static initialize(context: ExtensionContext, config: Config) {
79+
// Initialize G-Code Extension
7880
this._context = context;
7981
this._config = config;
8082

83+
// Initialze Configuration
84+
Config.initialize(this._context, this._config);
85+
86+
// Register Commands
87+
context.subscriptions.push(...registerCommands());
88+
8189
// Load StatusBars
8290
context.subscriptions.push((this._statusBarControl = new StatusBarControl()));
8391

@@ -136,7 +144,7 @@ export class Control {
136144
'support',
137145
'Support G-Code Syntax ❤',
138146
undefined,
139-
UtilCommands.ShowSupportGCode,
147+
GCommands.ShowSupportGCode,
140148
);
141149

142150
// Check Version

src/extension.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,9 @@
44
* -------------------------------------------------------------------------------------------- */
55
'use strict';
66
import { ExtensionContext } from 'vscode';
7-
import { Config, configuration } from './util/configuration/config';
7+
import { configuration } from './util/configuration/config';
88
import { constants } from './util/constants';
99
import { Logger } from './util/logger';
10-
import { registerCommands } from './util/commands';
1110
import { Control } from './control';
1211

1312
export function activate(context: ExtensionContext) {
@@ -17,13 +16,6 @@ export function activate(context: ExtensionContext) {
1716
Logger.initialize(context);
1817
Logger.enable();
1918

20-
// Initialize Config
21-
const cfg = configuration;
22-
Config.initialize(context, cfg);
23-
24-
// Register Commands
25-
void registerCommands(context);
26-
2719
// Initialize Controller
2820
Control.initialize(context, configuration);
2921

0 commit comments

Comments
 (0)