diff --git a/package-lock.json b/package-lock.json index af23267..7aaca93 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "pinescript-helper", - "version": "3.2.0", + "version": "3.2.1-beta-2", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "pinescript-helper", - "version": "3.2.0", + "version": "3.2.1-beta-2", "license": "MIT", "dependencies": { "find-up": "^6.3.0", diff --git a/package.json b/package.json index d1b5226..ef3beee 100644 --- a/package.json +++ b/package.json @@ -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" }, @@ -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" diff --git a/snippets/built-in_language_operators.json b/snippets/built-in_language_operators.json index c52417b..33f797e 100644 --- a/snippets/built-in_language_operators.json +++ b/snippets/built-in_language_operators.json @@ -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" } } diff --git a/snippets/built-in_types.json b/snippets/built-in_types.json new file mode 100644 index 0000000..18927ab --- /dev/null +++ b/snippets/built-in_types.json @@ -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" + } + } + + \ No newline at end of file diff --git a/src/extension.ts b/src/extension.ts index 6ba79f9..23ab3e9 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -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; @@ -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) { diff --git a/syntaxes/ps.tmLanguage.json b/syntaxes/ps.tmLanguage.json index 7f8ffd7..9e37fad 100644 --- a/syntaxes/ps.tmLanguage.json +++ b/syntaxes/ps.tmLanguage.json @@ -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"}, @@ -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"},