Skip to content

Commit

Permalink
Release v0.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
scottmwyant committed Jul 26, 2021
2 parents c4717a4 + a9a62a7 commit 211b595
Show file tree
Hide file tree
Showing 10 changed files with 44 additions and 28 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ All notable changes will be documented in this file.

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

## [v0.2.1] - 2021-07-25

### Changed

- More consistent colorization. Comments and variables are tokenized before generic alpha-numeric addresses.

## [v0.2.0] - 2021-05-09

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

### Changed

- 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.
- 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.

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

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ Examples of inline definitions:

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`.

##### Using the dictionary
#### Using the dictionary

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

Expand Down
16 changes: 8 additions & 8 deletions assets/gcode.tmLanguage.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
"foldingStartMarker": "^O([A-Z0-9]{1,4})(?=\\s|$|\\()",
"foldingStopMarker": "^RTS$",
"patterns": [
{
"include": "#comments"
},
{
"include": "#variables"
},
{
"include": "#sub-programs"
},
Expand All @@ -19,12 +25,6 @@
},
{
"include": "#address-decimal"
},
{
"include": "#variables"
},
{
"include": "#comments"
}
],
"repository": {
Expand Down Expand Up @@ -323,13 +323,13 @@
"comments": {
"patterns": [
{
"name": "comment.parens.gcode",
"name": "punctuation.definition.tag",
"begin": "\\(",
"end": "\\)",
"contentName": "punctuation.definition.tag"
},
{
"name": "comment.semi-colon.gcode",
"name": "punctuation.definition.tag",
"begin": "\\;",
"end": "$",
"contentName": "punctuation.definition.tag"
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "gcode",
"displayName": "G-Code",
"description": "The premier Visual Studio Code extension for G-Code",
"version": "0.2.0",
"version": "0.2.1",
"preview": true,
"author": {
"name": "Scott M. Wyant",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { IDictionary } from './index'
import { commands, ExtensionContext, ViewColumn, WebviewPanel, window, workspace } from 'vscode'

interface Definitions {
[key: string]: string
}

export class Dictionary {
export class Dictionary implements IDictionary {

private definitionsFromSettings: Definitions = {};
private definitionsFromComments: Definitions = {};
Expand Down
9 changes: 9 additions & 0 deletions src/dictionaryService/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { ExtensionContext } from 'vscode'
import { Dictionary } from './dictionary'


export interface IDictionary {
lookup: (word: string) => string
}

export const start = (context: ExtensionContext) => new Dictionary(context)
4 changes: 3 additions & 1 deletion src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ import { ExtensionContext } from 'vscode';
import * as commands from './commands'
import * as hoverProvider from './hoverProvider'
import * as grammar from './grammar'
import * as dictionaryService from './dictionaryService'

export function activate(context: ExtensionContext) {

const dictionary = dictionaryService.start(context)
commands.register(context);
hoverProvider.register(context);
hoverProvider.register(context, dictionary);
grammar.register(context);
}
16 changes: 8 additions & 8 deletions src/grammar/gcode.tmLanguage.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
"foldingStartMarker": "^O([A-Z0-9]{1,4})(?=\\s|$|\\()",
"foldingStopMarker": "^RTS$",
"patterns": [
{
"include": "#comments"
},
{
"include": "#variables"
},
{
"include": "#sub-programs"
},
Expand All @@ -19,12 +25,6 @@
},
{
"include": "#address-decimal"
},
{
"include": "#variables"
},
{
"include": "#comments"
}
],
"repository": {
Expand Down Expand Up @@ -323,13 +323,13 @@
"comments": {
"patterns": [
{
"name": "comment.parens.gcode",
"name": "replace.comment",
"begin": "\\(",
"end": "\\)",
"contentName": "replace.comment"
},
{
"name": "comment.semi-colon.gcode",
"name": "replace.comment",
"begin": "\\;",
"end": "$",
"contentName": "replace.comment"
Expand Down
6 changes: 3 additions & 3 deletions src/hoverProvider/gcodeHoverProvider.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { CancellationToken, Hover, HoverProvider, Position, ProviderResult, TextDocument} from 'vscode'
import { Dictionary } from './dictionary'
import { IDictionary } from '../dictionaryService'

export class gcodeHoverProvider implements HoverProvider {

private dictionary: Dictionary
private dictionary: IDictionary

constructor(dictionary: Dictionary){
constructor(dictionary: IDictionary){
this.dictionary = dictionary
}

Expand Down
6 changes: 2 additions & 4 deletions src/hoverProvider/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import { ExtensionContext, languages } from 'vscode';
import { gcodeHoverProvider } from './gcodeHoverProvider';
import { Dictionary } from './dictionary'
import { IDictionary } from '../dictionaryService'

export function register(context: ExtensionContext) {

const dictionary = new Dictionary(context);
export function register(context: ExtensionContext, dictionary: IDictionary) {

context.subscriptions.push(
languages.registerHoverProvider('gcode', new gcodeHoverProvider(dictionary))
Expand Down

0 comments on commit 211b595

Please sign in to comment.