Skip to content

Shardbyte/vscode-pinescript

Repository files navigation

PineScript V6 — VS Code Extension

Full-featured language support for Pine Script v6 (TradingView) inside VS Code.


Features

Feature Description
Syntax Highlighting TextMate grammar for strings, numbers, hex colors, annotations, operators, and fold markers
Semantic Tokens Full identifier colorization — namespaces, functions, variables, keywords, types, constants
Hover Documentation Rich markdown hover for all 680+ built-in functions and variables, plus user-defined symbols
Auto-Completion Namespace dot-completions (ta., math., color., …), top-level keywords, built-in variables
Signature Help Parameter hints for built-in and user-defined functions, with active parameter tracking
Go-to Definition Jump to user-defined functions, types, methods — in current file or across workspace
Find All References Locate every use of a symbol across open documents and workspace files
Rename Symbol File-scoped rename with validation (rejects built-ins, keywords, invalid identifiers)
Document Symbols Outline view showing all functions, types, methods, enums, and top-level variables
Code Folding Indent-based folding for function/if/for/while bodies; //#region//#endregion
Diagnostics Missing version annotation, missing declaration, unknown namespace members, deprecated security(), strategy calls in indicator scripts, unreachable code, unused imports
Quick Fixes One-click add //@version=6, add indicator(), replace deprecated security()
Inlay Hints Parameter name labels inside function calls
Color Preview Inline color swatches for #RRGGBB, #RRGGBBAA, color.rgb(), color.new(), and named color constants
Formatter Normalize line endings, expand tabs, trim trailing whitespace, collapse blank lines
Snippets 40+ snippets for strategies, indicators, inputs, technical indicators, and more

Requirements

  • VS Code 1.118 or later
  • Pine Script v6 files (.pine)

Installation

From Marketplace

Search for PineScript V6 in the VS Code Extensions view and click Install.

From VSIX (manual)

code --install-extension pinescript-v6-0.1.0.vsix

Configuration

Setting Default Description
pinescript.workspace.maxIndexDepth 5 Directory depth to scan for workspace go-to-definition (1–20)
pinescript.workspace.maxIndexFiles 200 Maximum .pine files to index across workspace (10–2000)

Snippets

Prefix Description
indicator indicator() declaration
strategy strategy() declaration
strategy_full Strategy with commission, slippage, pyramiding
strategy_ls Long+short strategy template
func User function definition
method Method definition
type UDT type declaration
enum_type Enum declaration
request_lower_tf request.security_lower_tf()
ta_bb Bollinger Bands
ta_kc Keltner Channels
ta_supertrend Supertrend indicator
ta_stoch Stochastic oscillator
map_new map.new<string, float>() with get/put
40+ total — trigger with prefix in a .pine file

Diagnostics & Quick Fixes

Code Severity Message
missing-version Error Script must start with //@version=6
missing-declaration Error Script must call indicator(), strategy(), or library()
unknown-namespace-member Warning Unknown member on a namespace
deprecated-security Warning security() → use request.security()
strategy-in-indicator Error strategy.entry/exit/… in an indicator() script
unreachable-code Warning Code after return in a function body
unused-import Information Import alias never referenced

Color Picker

The extension registers a color provider that shows inline color swatches for:

  • #FF5733 / #FF573380 (hex with optional alpha)
  • color.rgb(255, 87, 51)
  • color.new(color.red, 20)
  • All 17 named color constants (color.red, color.blue, …)

Clicking the swatch opens VS Code's color picker and the extension round-trips the selection back to the appropriate Pine syntax.


Screenshots

Screenshots coming soon.


License

MIT — see LICENSE for details.

Contributing

Issues and pull requests are welcome at github.com/Shardbyte/vscode-pinescript.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors