Skip to content

Commit 211b595

Browse files
committed
Release v0.2.1
2 parents c4717a4 + a9a62a7 commit 211b595

File tree

10 files changed

+44
-28
lines changed

10 files changed

+44
-28
lines changed

CHANGELOG.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ All notable changes will be documented in this file.
44

55
Contributors: This document uses style guidelines from [Keep A Changelog](http://keepachangelog.com/).
66

7+
## [v0.2.1] - 2021-07-25
8+
9+
### Changed
10+
11+
- More consistent colorization. Comments and variables are tokenized before generic alpha-numeric addresses.
12+
713
## [v0.2.0] - 2021-05-09
814

915
### Added
@@ -12,7 +18,7 @@ Contributors: This document uses style guidelines from [Keep A Changelog](http:/
1218

1319
### Changed
1420

15-
- The active document is now being scanned for inline comments on file save event in addition to the activation event that was used initially. In the future listener for the document activation event may be removed, it remains in the codebase for now.
21+
- The active document is now being scanned for inline comments on file save event in addition to the activation event that was used initially. In the future, the listener for the document activation event may be removed, but that remains unchanged for now.
1622

1723
## [v0.1.3] - 2021-02-06
1824

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ Examples of inline definitions:
6464

6565
When providing definitions, regardless of which method you use, don't use leading zeros. Provide a definition for `G1` not `G01`. When you hover over a code like `G01` the extension ignores the leading zero and returns a definition for `G1`.
6666

67-
##### Using the dictionary
67+
#### Using the dictionary
6868

6969
**<kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>P</kbd> `>G-Code: Show the dictionary`**
7070

assets/gcode.tmLanguage.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@
55
"foldingStartMarker": "^O([A-Z0-9]{1,4})(?=\\s|$|\\()",
66
"foldingStopMarker": "^RTS$",
77
"patterns": [
8+
{
9+
"include": "#comments"
10+
},
11+
{
12+
"include": "#variables"
13+
},
814
{
915
"include": "#sub-programs"
1016
},
@@ -19,12 +25,6 @@
1925
},
2026
{
2127
"include": "#address-decimal"
22-
},
23-
{
24-
"include": "#variables"
25-
},
26-
{
27-
"include": "#comments"
2828
}
2929
],
3030
"repository": {
@@ -323,13 +323,13 @@
323323
"comments": {
324324
"patterns": [
325325
{
326-
"name": "comment.parens.gcode",
326+
"name": "punctuation.definition.tag",
327327
"begin": "\\(",
328328
"end": "\\)",
329329
"contentName": "punctuation.definition.tag"
330330
},
331331
{
332-
"name": "comment.semi-colon.gcode",
332+
"name": "punctuation.definition.tag",
333333
"begin": "\\;",
334334
"end": "$",
335335
"contentName": "punctuation.definition.tag"

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"name": "gcode",
44
"displayName": "G-Code",
55
"description": "The premier Visual Studio Code extension for G-Code",
6-
"version": "0.2.0",
6+
"version": "0.2.1",
77
"preview": true,
88
"author": {
99
"name": "Scott M. Wyant",

src/hoverProvider/dictionary.ts renamed to src/dictionaryService/dictionary.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1+
import { IDictionary } from './index'
12
import { commands, ExtensionContext, ViewColumn, WebviewPanel, window, workspace } from 'vscode'
23

34
interface Definitions {
45
[key: string]: string
56
}
67

7-
export class Dictionary {
8+
export class Dictionary implements IDictionary {
89

910
private definitionsFromSettings: Definitions = {};
1011
private definitionsFromComments: Definitions = {};

src/dictionaryService/index.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { ExtensionContext } from 'vscode'
2+
import { Dictionary } from './dictionary'
3+
4+
5+
export interface IDictionary {
6+
lookup: (word: string) => string
7+
}
8+
9+
export const start = (context: ExtensionContext) => new Dictionary(context)

src/extension.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@ import { ExtensionContext } from 'vscode';
22
import * as commands from './commands'
33
import * as hoverProvider from './hoverProvider'
44
import * as grammar from './grammar'
5+
import * as dictionaryService from './dictionaryService'
56

67
export function activate(context: ExtensionContext) {
78

9+
const dictionary = dictionaryService.start(context)
810
commands.register(context);
9-
hoverProvider.register(context);
11+
hoverProvider.register(context, dictionary);
1012
grammar.register(context);
1113
}

src/grammar/gcode.tmLanguage.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@
55
"foldingStartMarker": "^O([A-Z0-9]{1,4})(?=\\s|$|\\()",
66
"foldingStopMarker": "^RTS$",
77
"patterns": [
8+
{
9+
"include": "#comments"
10+
},
11+
{
12+
"include": "#variables"
13+
},
814
{
915
"include": "#sub-programs"
1016
},
@@ -19,12 +25,6 @@
1925
},
2026
{
2127
"include": "#address-decimal"
22-
},
23-
{
24-
"include": "#variables"
25-
},
26-
{
27-
"include": "#comments"
2828
}
2929
],
3030
"repository": {
@@ -323,13 +323,13 @@
323323
"comments": {
324324
"patterns": [
325325
{
326-
"name": "comment.parens.gcode",
326+
"name": "replace.comment",
327327
"begin": "\\(",
328328
"end": "\\)",
329329
"contentName": "replace.comment"
330330
},
331331
{
332-
"name": "comment.semi-colon.gcode",
332+
"name": "replace.comment",
333333
"begin": "\\;",
334334
"end": "$",
335335
"contentName": "replace.comment"

src/hoverProvider/gcodeHoverProvider.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import { CancellationToken, Hover, HoverProvider, Position, ProviderResult, TextDocument} from 'vscode'
2-
import { Dictionary } from './dictionary'
2+
import { IDictionary } from '../dictionaryService'
33

44
export class gcodeHoverProvider implements HoverProvider {
55

6-
private dictionary: Dictionary
6+
private dictionary: IDictionary
77

8-
constructor(dictionary: Dictionary){
8+
constructor(dictionary: IDictionary){
99
this.dictionary = dictionary
1010
}
1111

src/hoverProvider/index.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
import { ExtensionContext, languages } from 'vscode';
22
import { gcodeHoverProvider } from './gcodeHoverProvider';
3-
import { Dictionary } from './dictionary'
3+
import { IDictionary } from '../dictionaryService'
44

5-
export function register(context: ExtensionContext) {
6-
7-
const dictionary = new Dictionary(context);
5+
export function register(context: ExtensionContext, dictionary: IDictionary) {
86

97
context.subscriptions.push(
108
languages.registerHoverProvider('gcode', new gcodeHoverProvider(dictionary))

0 commit comments

Comments
 (0)