Skip to content
This repository was archived by the owner on Aug 31, 2023. It is now read-only.

Commit d7c7573

Browse files
committed
Initial commit
0 parents  commit d7c7573

10 files changed

+291
-0
lines changed

Diff for: .gitattributes

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Set default behavior to automatically normalize line endings.
2+
* text=auto
3+

Diff for: .gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules
2+
*.vsix

Diff for: .vscode/launch.json

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// A launch configuration that launches the extension inside a new window
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
{
6+
"version": "0.2.0",
7+
"configurations": [
8+
{
9+
"name": "Extension",
10+
"type": "extensionHost",
11+
"request": "launch",
12+
"runtimeExecutable": "${execPath}",
13+
"args": [
14+
"--extensionDevelopmentPath=${workspaceFolder}"
15+
]
16+
}
17+
]
18+
}

Diff for: .vscodeignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.vscode/**
2+
.vscode-test/**
3+
.gitignore
4+
vsc-extension-quickstart.md

Diff for: CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Change Log
2+
3+
## [0.1] - 2018-09-10
4+
- Initial release

Diff for: README.md

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Pine script syntax highlighting for VS Code
2+
3+
## Features
4+
5+
This extension adds Pine Script Syntax Hightlighting for VS Code
6+
7+
\!\[feature X\]\(images/feature-x.png\)
8+
9+
## Pull requests
10+
11+
If you find the syntax highlighting to be inadequate, please submit a PR.
12+
13+
#### Share
14+
15+
Do share good strategies or inidcators.
16+
17+
18+
Note: This extension is provided as-is. It doesn't do tricks for your trading. Only colors what you write...

Diff for: example.pine

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// This is a comment
2+
// Small Pine example to test syntax highlighting
3+
4+
study("MACD")
5+
fast = 12, slow = 26
6+
fastMA = ema(close, fast)
7+
slowMA = ema(close, slow)
8+
macd = fastMA - slowMA
9+
signal = sma(macd, 9)
10+
plot(macd, color=blue)
11+
plot(signal, color=orange)

Diff for: language-configuration.json

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"comments": {
3+
// symbol used for single line comment. Remove this entry if your language does not support line comments
4+
"lineComment": "//",
5+
// symbols used for start and end a block comment. Remove this entry if your language does not support block comments
6+
"blockComment": [ "/*", "*/" ]
7+
},
8+
// symbols used as brackets
9+
"brackets": [
10+
["{", "}"],
11+
["[", "]"],
12+
["(", ")"]
13+
],
14+
// symbols that are auto closed when typing
15+
"autoClosingPairs": [
16+
["[", "]"],
17+
["(", ")"],
18+
["\"", "\""],
19+
["'", "'"]
20+
],
21+
// symbols that that can be used to surround a selection
22+
"surroundingPairs": [
23+
["[", "]"],
24+
["(", ")"],
25+
["\"", "\""],
26+
["'", "'"]
27+
]
28+
// "wordPattern": [],
29+
30+
// "indentationRules": {
31+
// "increaseIndentPattern": "^\\s*((begin|class|(private|protected)\\s+def|def|else|elsif|ensure|for|if|module|rescue|unless|until|when|while|case)|([^#]*\\sdo\\b)|([^#]*=\\s*(case|if|unless)))\\b([^#\\{;]|(\"|'|\/).*\\4)*(#.*)?$",
32+
// "decreaseIndentPattern": "^\\s*([}\\]]([,)]?\\s*(#|$)|\\.[a-zA-Z_]\\w*\\b)|(end|rescue|ensure|else|elsif|when)\\b)"
33+
// }
34+
}

Diff for: package.json

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"name": "pine-script-syntax-highlighting",
3+
"displayName": "Pine Script Syntax Highlighting",
4+
"description": "Syntax Highlighting for Pine Script",
5+
"version": "0.0.1",
6+
"publisher": "leifcr",
7+
"engines": {
8+
"vscode": "^1.27.0"
9+
},
10+
"categories": [
11+
"Programming Languages"
12+
],
13+
"contributes": {
14+
"languages": [{
15+
"id": "pine",
16+
"aliases": ["Pine Script", "pine"],
17+
"extensions": [".pine"],
18+
"configuration": "./language-configuration.json"
19+
}],
20+
"grammars": [{
21+
"language": "pine",
22+
"scopeName": "source.pine",
23+
"path": "./syntaxes/pine.tmLanguage.json"
24+
}]
25+
}
26+
}

Diff for: syntaxes/pine.tmLanguage.json

+171
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
1+
{
2+
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
3+
"name": "Pine Script",
4+
"patterns": [
5+
{
6+
"match": "//.*",
7+
"name": "comment.pine"
8+
},
9+
{
10+
"include": "#constants"
11+
},
12+
{
13+
"include": "#functions"
14+
},
15+
{
16+
"include": "#operators"
17+
},
18+
{
19+
"include": "#keywords"
20+
},
21+
{
22+
"include": "#strings"
23+
}
24+
],
25+
"repository": {
26+
"strings": {
27+
"patterns": [
28+
{
29+
"begin": "\"",
30+
"beginCaptures": {
31+
"1": {
32+
"name": "punctuation.definition.string.begin.pine"
33+
}
34+
},
35+
"end": "\"",
36+
"endCaptures": {
37+
"1": {
38+
"name": "punctuation.definition.string.end.pine"
39+
}
40+
},
41+
"name" : "string.quoted.double.pine",
42+
"patterns": [
43+
{
44+
"match": "\\\\.",
45+
"name": "constant.character.escaped.pine"
46+
}
47+
]
48+
},
49+
{
50+
"begin": "'",
51+
"beginCaptures": {
52+
"1": {
53+
"name": "punctuation.definition.string.begin.pine"
54+
}
55+
},
56+
"end": "'",
57+
"endCaptures": {
58+
"1": {
59+
"name": "punctuation.definition.string.end.pine"
60+
}
61+
},
62+
"name" : "string.quoted.double.pine",
63+
"patterns": [
64+
{
65+
"match": "\\\\.",
66+
"name": "constant.character.escaped.pine"
67+
}
68+
]
69+
}
70+
]
71+
},
72+
"functions": {
73+
"patterns": [
74+
{
75+
"match": "\\b(avg|bar(color|since)|bgcolor|change|cross|donchian|falling|fill|highest|iff|input|lowest|m(ax|in)|plot(arrow|bar|candle|char|shape|figure)?|rising|security|tostring|(e|s)ma|study|valuewhen)(?=\\()",
76+
"captures": {
77+
"1": {
78+
"name": "support.function.pine"
79+
}
80+
}
81+
},
82+
{
83+
"match": "[a-zA-Z_][a-zA-Z0-9_]*\\s*(?=\\=)",
84+
"name": "variable.parameter.pine"
85+
},
86+
{
87+
"match": "([a-zA-Z_][a-zA-Z0-9_]*)\\(.*\\)\\s(=>)\\s",
88+
"captures": {
89+
"1": {
90+
"name": "support.function.pine"
91+
},
92+
"2": {
93+
"name": "keyword.operator.assignment.pine"
94+
}
95+
}
96+
}
97+
]
98+
},
99+
"constants": {
100+
"patterns":[
101+
{
102+
"match": "\\b(true|false)\\b",
103+
"name": "constant.language.pine"
104+
},
105+
{
106+
"match": "\\b(open|high|low|close|volume|na|len|period|tikerid)\\b",
107+
"name": "constant.language.pine"
108+
},
109+
{
110+
"match": "\\b(monday|tuesday|wednesday|thursday|friday|saturday|sunday|dayofweek)\\b",
111+
"name": "constant.language.pine"
112+
},
113+
{
114+
"match": "\\b(line|histogram|cross|area|columns|circles)\\b",
115+
"name": "constant.language.pine"
116+
},
117+
{
118+
"match": "\\blocation\\.(abovebar|belowbar|top|bottom|absolute)\\b",
119+
"name": "constant.language.pine"
120+
},
121+
{
122+
"match": "\\bshape\\.(x(cross)?|(triangle|arrow|label)(up|down)|flag|circle|square|diamond)\\b",
123+
"name": "constant.language.pine"
124+
},
125+
{
126+
"match": "\\b(aqua|black|silver|gray|white|maroon|red|purple|fuchsia|green|lime|olive|yellow|navy|blue|teal|orange)\\b",
127+
"name": "constant.language.pine"
128+
},
129+
{
130+
"match": "#[a-fA-F0-9]{6}",
131+
"name": "contstant.support.pine"
132+
},
133+
{
134+
"match": "\\b([0-9]+)\\b",
135+
"name": "constant.numeric.pine"
136+
}
137+
]
138+
},
139+
"operators": {
140+
"patterns": [
141+
{
142+
"match": "(\\-|\\+|\\*|/|%)",
143+
"name": "keyword.operator.arithmetic.pine"
144+
},
145+
{
146+
"match": "(==|!=|<=|>=|<|>)",
147+
"name": "keyword.operator.comparison.pine"
148+
},
149+
{
150+
"match": "(\\?|\\:)",
151+
"name": "keyword.operator.ternary.pine"
152+
},
153+
{
154+
"match": "\\b(and|or|not)\\b",
155+
"name": "keyword.operator.logical.pine"
156+
},
157+
{
158+
"match": "=",
159+
"name": "keyword.operator.assignment.pine"
160+
}
161+
]
162+
},
163+
"keywords": {
164+
"patterns": [{
165+
"name": "keyword.control.pine",
166+
"match": "\\b(if|else|while|for|return)\\b"
167+
}]
168+
}
169+
},
170+
"scopeName": "source.pine"
171+
}

0 commit comments

Comments
 (0)