Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,18 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and

## [Unreleased]

## [3.1.0] - 2026-09-08

### Added

- 78 new snippets, for a total of 97. They cover script headers and full `indicator()` / `strategy()` declarations, library `import` / `export`, tuples, types with methods, enums with `input.enum()`, `var` / `varip`, condition `switch`, stepped and breaking loops, `runtime.error()` and `log.*()`; section, divider, notes, date and TODO comments plus `//@` documentation blocks; every `input.*()` function, inline and grouped inputs; `plotshape`, `plotchar`, `plotarrow`, `plotcandle`, `plotbar`, `bgcolor`, `barcolor`, `hline`, band fills, gradient plots, labels, lines, boxes, tables, polylines and a debug label; `alert()` with plain and JSON messages; higher timeframe tuples, non-repainting `request.security()`, `request.security_lower_tf()`, a security wrapper, sessions, timeframe changes, backtest windows and last-bar blocks; strategy orders, position flags, percent stop loss / take profit and an ATR trailing stop; crossover signals, a selectable moving average, Bollinger Bands, RSI with bands, ATR stops and breakout levels; arrays, maps and matrices.
- A test that checks every snippet for unique prefixes, well-formed placeholders and v6 pragmas.

### Changed

- The function tuple snippet no longer suggests names that shadow built-in variables.
- README documents the snippet catalogue and walks through the editor features in more detail.

## [3.0.0] - 2026-09-07

The extension becomes a full language extension. Highlighting is unchanged; everything below is new.
Expand Down
73 changes: 64 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<br>
</h1>

<h4 align="center">Syntax highlighting, snippets and editor support for TradingView Pine Script® v6 in Visual Studio Code.</h4>
<h4 align="center">Completion, hover documentation, signature help, 97 snippets, themes and compiler diagnostics for TradingView Pine Script® v6 in Visual Studio Code.</h4>

<p align="center">
<a href="https://marketplace.visualstudio.com/items?itemName=ex-codes.pine-script-syntax-highlighter"><img src="https://vsmarketplacebadges.dev/version-short/ex-codes.pine-script-syntax-highlighter.svg?style=flat-square&label=marketplace&color=blue" alt="Marketplace version"></a>
Expand All @@ -19,17 +19,72 @@

![Example](images/example.png)

## Why you will like it

Open a `.pine` file and the editor already knows the language: every v6 built-in completes with its signature, hovering anything shows the reference entry, parameter hints follow you through a call, and **97 snippets** turn a prefix and <kbd>Tab</kbd> into a full indicator, a strategy exit block or a Bollinger Bands section. Nothing leaves your machine unless you opt in, and the whole thing weighs less than a megabyte.

## Quick start

1. Install **Pine Script Syntax Highlighter** from the Marketplace.
2. Create a file named `my-script.pine` and type `indicator`, then press <kbd>Tab</kbd>. A complete v6 indicator appears with the title, short title, overlay flag and an input ready to fill in; <kbd>Tab</kbd> moves between the fields.
3. Type `ta.` to see the whole namespace with documentation, pick `ta.sma`, and watch the parameter hints as you write the arguments.
4. Hover over `input.int`, `ta.crossover` or your own function to read what it does.
5. Try `bb`, `sltp`, `table` or `request.security.tuple` with <kbd>Tab</kbd> to drop in a working building block.
6. Press <kbd>F1</kbd> and type `Pine Script:` to see the commands: new files from templates, docstrings, type annotations and the reference.

## Features

- **Completion.** Built-in functions, variables and constants from every v6 namespace, keywords, types, your own functions, types, enums and variables, named arguments inside calls, `//@` annotations, and `import` paths. Function items insert a call and open parameter hints.
- **Hover documentation.** Signature, description, parameters, return value and a link to the reference entry for built-ins; declaration and `//@` docs for your own symbols; a library card on `import` lines.
- **Signature help.** Overloads and the active parameter, including named arguments.
### Completion that knows Pine

- Built-in functions, variables and constants from every v6 namespace (`ta`, `math`, `str`, `array`, `matrix`, `map`, `request`, `strategy`, `label`, `line`, `box`, `table`, `polyline`, `chart`, `log`, and the rest), each with its documentation and signature.
- Keywords, type names and qualifiers, and your own functions, methods, types, enums and variables as soon as you declare them.
- Named arguments inside a call, `//@` annotations at the start of a comment, and `import` paths that complete user, library and version.
- Function items insert a call and open parameter hints, so a long `strategy.exit()` is a matter of tabbing through its parameters.

### Documentation where the cursor is

- **Hover** on a built-in shows the signature, description, parameters, return value and a link to the reference entry. Hover on your own symbol shows its declaration and its `//@` docs. Hover on an `import` line shows a card for the library.
- **Signature help** lists the overloads, highlights the active parameter and keeps up when you switch to named arguments.
- **Open Reference** jumps to the v6 reference page for the built-in under the cursor.

### 97 snippets, from a header to a complete strategy block

Every snippet targets Pine Script v6, uses placeholders you can tab through, and inserts code that compiles as-is. Type the prefix and press <kbd>Tab</kbd>, or pick it from the completion list.

| Group | Prefixes |
| ----------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Script skeletons | `indicator`, `strategy`, `library`, `indicator.full`, `strategy.full`, `header`, `version`, `import`, `export` |
| Declarations and control flow | `fn`, `fntuple`, `method`, `type`, `typemethod`, `enum`, `enuminput`, `var`, `varip`, `if`, `switch`, `switchcond`, `for`, `forin`, `forby`, `forbreak`, `while`, `once`, `runtime.error`, `log` |
| Comments and documentation | `section`, `divider`, `notes`, `date`, `todo`, `docfn`, `doctype`, `docenum`, `docvar`, `alertmsg` |
| Inputs | `input.int`, `input.float`, `input.bool`, `input.string`, `input.source`, `input.color`, `input.timeframe`, `input.symbol`, `input.session`, `input.time`, `input.price`, `input.text_area`, `inputs.inline`, `inputs.group` |
| Plots and drawings | `plot`, `plotshape`, `plotchar`, `plotarrow`, `plotcandle`, `plotbar`, `bgcolor`, `barcolor`, `hline`, `fill`, `gradient`, `label.new`, `line.new`, `box.new`, `table`, `polyline`, `debug` |
| Alerts | `alertcondition`, `alert`, `alert.json` |
| Requests, time and sessions | `request.security`, `request.security.tuple`, `request.security.confirmed`, `request.security_lower_tf`, `secfn`, `session`, `newbar`, `backtest`, `islast` |
| Strategy | `strategy.entry`, `strategy.exit`, `strategy.close`, `position`, `sltp`, `trail` |
| Technical analysis | `cross`, `mafn`, `bb`, `rsi`, `atrstop`, `breakout` |
| Collections | `array`, `map`, `matrix` |

A few worth trying first:

- `strategy.full` writes a `strategy()` call with every commonly used parameter on its own line, with choices for quantity type, currency and commission type.
- `sltp` adds percent based stop loss and take profit inputs and the two `strategy.exit()` calls that use them.
- `request.security.confirmed` inserts the non-repainting form of a higher timeframe request; `request.security.tuple` fetches open, high, low and close in one call.
- `bb`, `rsi` and `mafn` are complete, plotted indicator sections. `mafn` includes a moving average function selected by a string input.
- `table` creates a table once and fills it on the last bar; `debug` prints any value in a label on the last bar.
- `section`, `notes` and `date` keep long scripts readable; `docfn` and `doctype` write the `//@` blocks the outline and hover use.

### Structure, libraries and diagnostics

- **Outline.** Functions, methods, types with fields, enums with members and top-level variables in the Outline view and breadcrumbs.
- **Libraries.** Workspace files that call `library()` are indexed: their exports complete after the import alias and show up on hover. With `pinescript.libraries.remote` on, `import` completion also lists published TradingView libraries and hover shows their exports.
- **Compiler diagnostics (opt-in).** Set `pinescript.diagnostics.remote` to `true` to send the document to the TradingView compiler and see its errors and warnings inline.
- **Commands.** New Indicator / Strategy / Library from a template, Generate Docstring (also a lightbulb on declarations), Add Type Annotations, Open Reference for the built-in under the cursor.
- **Themes.** Pine Dark and Pine Light, tuned for every scope the grammar produces.
- **Highlighting, snippets and editor support** as before: the full v6 vocabulary, annotations, triple-quoted strings, format placeholders, hex colors, folding, auto-closing pairs and four-space indentation for `.pine` files.
- **Compiler diagnostics (opt-in).** Set `pinescript.diagnostics.remote` to `true` to send the document to the TradingView compiler and see its errors and warnings inline, on open, on save and shortly after you stop typing.
- **Commands.** New Indicator / Strategy / Library from a template, Generate Docstring (also a lightbulb on declarations), Add Type Annotations for untyped declarations, Open Reference for the built-in under the cursor.

### Highlighting and themes

- A grammar generated from the v6 reference: every namespace, keyword, annotation, triple-quoted string, format placeholder and hex color gets its own scope, so any theme works and the two bundled ones shine.
- **Pine Dark** and **Pine Light** are tuned for every scope the grammar produces and are checked in CI so that no token is left uncolored.
- Folding, bracket matching, auto-closing pairs, comment toggling and four-space indentation are configured for `.pine` files out of the box.

Files ending in `.pine` or `.pinescript`, or starting with `//@version=`, are recognized automatically.

Expand Down Expand Up @@ -97,7 +152,7 @@ scripts/
check-themes.mjs verifies both themes cover every grammar scope
themes/ Pine Dark and Pine Light
tests/
core/ vitest suites for src/extension
core/ vitest suites for src/extension and the snippet catalogue
unit/ scope assertions (vscode-tmgrammar-test)
snapshots/ full-file snapshots (vscode-tmgrammar-snap)
```
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "pine-script-syntax-highlighter",
"displayName": "Pine Script Syntax Highlighter",
"description": "Pine Script v6 for Visual Studio Code: highlighting, completion, hover documentation, signature help, snippets, themes and compiler diagnostics.",
"version": "3.0.0",
"version": "3.1.0",
"publisher": "ex-codes",
"author": {
"name": "Yankı Küçük",
Expand Down
Loading
Loading