Skip to content

Commit

Permalink
[feat] snippets updated
Browse files Browse the repository at this point in the history
- built-in types snippets added
- grammars for `import` fixed
- typo fixed
  • Loading branch information
salbert11 committed Oct 12, 2023
1 parent 24eb19c commit e4d910d
Show file tree
Hide file tree
Showing 6 changed files with 137 additions and 9 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"icon": "images/pineicon.png",
"publisher": "salbert11",
"license": "MIT",
"version": "3.2.0",
"version": "3.2.1-beta-2",
"engines": {
"vscode": "^1.62.0"
},
Expand Down Expand Up @@ -55,6 +55,10 @@
"language": "pine",
"path": "./snippets/built-in_scripts.json"
},
{
"language": "pine",
"path": "./snippets/built-in_types.json"
},
{
"language": "pine",
"path": "./snippets/comments.json"
Expand Down
14 changes: 14 additions & 0 deletions snippets/built-in_language_operators.json
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,20 @@
"while$0"
],
"description" : "while | Language Operator"
},
"true ⇨ ⟗" : {
"prefix" : "true",
"body" : [
"true$0"
],
"description" : "true | Language Operator"
},
"false ⇨ ⟗" : {
"prefix" : "false",
"body" : [
"false$0"
],
"description" : "false | Language Operator"
}
}

110 changes: 110 additions & 0 deletions snippets/built-in_types.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
{

"int ⇨ Ⓣ" : {
"prefix" : "int",
"body" : [
"int$0"
],
"description" : "int | Built-in Type"
},
"float ⇨ Ⓣ" : {
"prefix" : "float",
"body" : [
"float$0"
],
"description" : "float | Built-in Type"
},
"bool ⇨ Ⓣ" : {
"prefix" : "bool",
"body" : [
"bool$0"
],
"description" : "bool | Built-in Type"
},
"color ⇨ Ⓣ" : {
"prefix" : "color",
"body" : [
"color$0"
],
"description" : "color | Built-in Type"
},
"string ⇨ Ⓣ" : {
"prefix" : "string",
"body" : [
"string$0"
],
"description" : "string | Built-in Type"
},
"line ⇨ Ⓣ" : {
"prefix" : "line",
"body" : [
"line$0"
],
"description" : "line | Built-in Type"
},
"linefill ⇨ Ⓣ" : {
"prefix" : "linefill",
"body" : [
"linefill$0"
],
"description" : "linefill | Built-in Type"
},
"label ⇨ Ⓣ" : {
"prefix" : "label",
"body" : [
"label$0"
],
"description" : "label | Built-in Type"
},
"box ⇨ Ⓣ" : {
"prefix" : "box",
"body" : [
"box$0"
],
"description" : "box | Built-in Type"
},
"table ⇨ Ⓣ" : {
"prefix" : "table",
"body" : [
"table$0"
],
"description" : "table | Built-in Type"
},
"array ⇨ Ⓣ" : {
"prefix" : "array",
"body" : [
"array<$1> "
],
"description" : "array | Built-in Type"
},
"matrix ⇨ Ⓣ" : {
"prefix" : "matrix",
"body" : [
"matrix<$1> "
],
"description" : "matrix | Built-in Type"
},
"map ⇨ Ⓣ" : {
"prefix" : "map",
"body" : [
"map<$1> "
],
"description" : "map | Built-in Type"
},
"polyline ⇨ Ⓣ" : {
"prefix" : "polyline",
"body" : [
"polyline$0"
],
"description" : "polyline | Built-in Type"
},
"chart.point ⇨ Ⓣ" : {
"prefix" : "chart.point",
"body" : [
"chart.point$0"
],
"description" : "chart.point | Built-in Type"
}
}


8 changes: 4 additions & 4 deletions src/extension.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as vscode from 'vscode';
import * as hover_func from './hover_built-in_functions.json';
import * as var_func from './hover_built-in_variables.json';
import * as const_func from './hover_built-in_constants.json';
import * as hover_var from './hover_built-in_variables.json';
import * as hover_const from './hover_built-in_constants.json';

type Params = {
field: string;
Expand All @@ -28,8 +28,8 @@ type ConstPopupBlock = {
};

const BUILT_IN_FUNC = hover_func as FuncPopupBlock[];
const BUILT_IN_VAR = var_func as ConstPopupBlock[];
const BUILT_IN_CONST = const_func as ConstPopupBlock[];
const BUILT_IN_VAR = hover_var as ConstPopupBlock[];
const BUILT_IN_CONST = hover_const as ConstPopupBlock[];

export function activate(context: vscode.ExtensionContext) {

Expand Down
4 changes: 2 additions & 2 deletions syntaxes/ps.tmLanguage.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@
"imports":{
"patterns": [
{
"match": "^(import)\\s+(\\w+)(\/)(\\w+)(\/)(\\w+)\\s+(as)\\s+(\\w+)",
"match": "^(import)\\s+([\\w-]+)(\/)(\\w+)(\/)(\\w+)\\s+(as)\\s+(\\w+)",
"captures": {
"1": {"name": "keyword.control.import.ps"},
"2": {"name": "entity.name.type.class.ps"},
Expand All @@ -132,7 +132,7 @@
}
},
{
"match": "^(import)\\s+(\\w+)(\/)(\\w+)(\/)(\\w+)",
"match": "^(import)\\s+([\\w-]+)(\/)(\\w+)(\/)(\\w+)",
"captures": {
"1": {"name": "keyword.control.import.ps"},
"2": {"name": "entity.name.type.class.ps"},
Expand Down

0 comments on commit e4d910d

Please sign in to comment.