Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
57e1e0b
Add design spec for language features (3.0.0)
yankikucuk Sep 7, 2026
c4fa972
Add implementation plan for the 3.0.0 language features
yankikucuk Sep 7, 2026
f09615b
Update example screenshot
yankikucuk Sep 7, 2026
c49912e
Add TypeScript, esbuild and vitest toolchain with an empty extension …
yankikucuk Sep 7, 2026
93a98d1
Scrape the v6 reference into reference.json and keep grammar data con…
yankikucuk Sep 7, 2026
5f73203
Add reference index over the scraped v6 documentation
yankikucuk Sep 7, 2026
01a3317
Add line tokenizer for Pine Script
yankikucuk Sep 7, 2026
832da79
Add document model for functions, types, enums, variables and imports
yankikucuk Sep 7, 2026
9e4634e
Resolve enclosing calls and completion context at a cursor position
yankikucuk Sep 7, 2026
60da90f
Build hover and completion documentation as markdown
yankikucuk Sep 7, 2026
48ab99e
Add completion, hover, signature help and outline providers
yankikucuk Sep 7, 2026
1c139d7
Infer declaration types and add the Add Type Annotations command
yankikucuk Sep 7, 2026
838a139
Generate and merge annotation docstrings from a command and a code ac…
yankikucuk Sep 7, 2026
d7fb5b6
Add file templates, new-file commands and Open Reference
yankikucuk Sep 7, 2026
cbff3e8
Index workspace libraries and look up published TradingView libraries
yankikucuk Sep 7, 2026
eca44d0
Show TradingView compiler diagnostics when remote diagnostics are ena…
yankikucuk Sep 7, 2026
797b790
Add Pine Dark and Pine Light color themes with a scope coverage check
yankikucuk Sep 7, 2026
47b0d60
Read overload arguments reliably after selecting each overload
yankikucuk Sep 7, 2026
14d0f95
Resolve the annotation under the cursor on hover and test providers a…
yankikucuk Sep 7, 2026
bf5a77c
Release 3.0.0: language features, themes and compiler diagnostics
yankikucuk Sep 7, 2026
6adafd9
Apply formatting
yankikucuk Sep 7, 2026
b8c038c
Activate on Pine documents and replace the whole import path on compl…
yankikucuk Sep 7, 2026
1245d72
Keep operators inside comments in the comment color
yankikucuk Sep 7, 2026
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
55 changes: 44 additions & 11 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,46 @@ Node 20 or newer is required.

## Where things live

| Change you want to make | Edit this |
| --------------------------------------- | ------------------------------------------------------ |
| Add or remove a built-in function | `src/data/functions.json` |
| Add or remove a built-in variable | `src/data/variables.json` |
| Add or remove a built-in constant | `src/data/constants.json` |
| Add a compiler annotation (`//@...`) | `src/data/annotations.json` |
| Add a keyword, type or change a scope | `src/grammar.mjs` |
| Change folding, brackets or indentation | `language-configuration.json` |
| Add a snippet | `snippets/pinescript.code-snippets` |
| Never | `syntaxes/pinescript.tmLanguage.json` (generated file) |
| Change you want to make | Edit this |
| --------------------------------------- | --------------------------------------------------------------------------------------------------------- |
| Add or remove a built-in function | `src/data/functions.json` |
| Add or remove a built-in variable | `src/data/variables.json` |
| Add or remove a built-in constant | `src/data/constants.json` |
| Add a compiler annotation (`//@...`) | `src/data/annotations.json` |
| Add a keyword, type or change a scope | `src/grammar.mjs` |
| Change folding, brackets or indentation | `language-configuration.json` |
| Add a snippet | `snippets/pinescript.code-snippets` |
| Completion, hover, commands, inference | `src/extension/core/*` (logic) and `src/extension/providers/*`, `src/extension/commands/*` (VS Code glue) |
| Change a theme color | `themes/*.json` |
| Never | `syntaxes/pinescript.tmLanguage.json`, `src/data/reference.json`, `dist/` (generated) |

The data files are grouped by namespace. A function `ta.sma` goes under the `"ta"` key as `"sma"`. Identifiers without a namespace go under the `""` key. Nested namespaces such as `strategy.closedtrades` are their own key.

`src/extension/core` never imports `vscode`; that is what makes it testable with vitest. Providers and commands only translate between VS Code types and core types.

## Working on the extension

```sh
npm run watch # rebuild dist/extension.cjs on change
```

Press F5 to launch an Extension Development Host, then reload it after each rebuild. Tests for extension logic go in `tests/core`; `tests/core/fake-vscode.ts` stands in for the `vscode` module so providers can run under vitest too.

## Refreshing the reference data

```sh
npm install --no-save playwright-core
npx playwright-core install chromium
npm run scrape:reference
npm run build:grammar:check # lists built-ins to add to or remove from src/data/*.json
```

## Workflow

1. Make your change in `src/`.
2. Run `npm run build` to regenerate the grammar.
3. Add or update a test:
- `tests/core/*.test.ts` for extension logic.
- `tests/unit/*.pine` for a targeted scope assertion (see the existing files for the syntax; `^` markers under a token followed by the expected scopes).
- `tests/snapshots/*.pine` for a realistic script. Run `npm run test:snap:update` after intentional changes and review the `.snap` diff.
4. Run `npm test`. CI runs the same command and also fails if the generated grammar is out of date.
Expand All @@ -43,10 +65,21 @@ The data files are grouped by namespace. A function `ta.sma` goes under the `"ta

Built-in identifiers come from the [Pine Script v6 reference](https://www.tradingview.com/pine-script-reference/v6/). Please link the reference entry when adding one. Identifiers that were removed from the language are removed from the grammar too; we do not keep deprecated v3/v4 names.

## Manual checklist before a release

- Completion after `ta.`, inside `plot(`, after `//@`, after `import `
- Hover on `close`, `ta.sma`, a user function, an import line
- Signature help through all parameters of `plot(`
- Outline shows functions, types, enums, variables
- Generate Docstring on a function, a type and an enum
- Add Type Annotations on `tests/snapshots/strategy-v6.pine`
- Both themes on `tests/snapshots/strategy-v6.pine`
- With `pinescript.diagnostics.remote` on: an undeclared identifier is underlined

## Releasing

Maintainers only.

1. Update `CHANGELOG.md` and bump `version` in `package.json`.
2. Commit, then tag: `git tag v2.x.y && git push --tags`.
2. Commit, then tag: `git tag v3.x.y && git push --tags`.
3. The release workflow builds the `.vsix`, attaches it to a GitHub release and publishes to the Marketplace when the `VSCE_PAT` secret is configured.
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ A short Pine snippet or screenshot showing the highlighting before and after is
**Checklist**

- [ ] I edited `src/` (not the generated `syntaxes/pinescript.tmLanguage.json`) and ran `npm run build`
- [ ] I added or updated a test in `tests/unit` or `tests/snapshots` and `npm test` passes
- [ ] I added or updated a test in `tests/core`, `tests/unit` or `tests/snapshots` and `npm test` passes
- [ ] I ran `npm run format`
- [ ] New built-ins link to their entry in the Pine Script v6 reference
- [ ] `CHANGELOG.md` has an entry under **Unreleased**
21 changes: 18 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,29 @@ jobs:
run: npm run format:check

- name: Verify generated grammar is committed
run: npm run build:check
run: npm run build:grammar:check

- name: Run grammar tests
run: npm test
- name: Verify themes cover every grammar scope
run: npm run check:themes

- name: Type check
run: npm run typecheck

- name: Core tests
run: npm run test:core

- name: Grammar tests
run: npm run test:unit && npm run test:snap

- name: Bundle extension
run: npm run build:extension

- name: Package extension
run: npx vsce package --no-dependencies --out pine-script-syntax-highlighter.vsix

- name: Verify bundle in package
run: unzip -l pine-script-syntax-highlighter.vsix | grep -q 'extension/dist/extension.cjs'

- uses: actions/upload-artifact@v5
with:
name: vsix
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ jobs:

- run: npm ci
- run: npm test
- run: npm run build:extension

- name: Verify tag matches package version
run: |
Expand All @@ -35,6 +36,9 @@ jobs:
- name: Package
run: npx vsce package --no-dependencies --out "pine-script-syntax-highlighter-${GITHUB_REF_NAME}.vsix"

- name: Verify bundle in package
run: unzip -l *.vsix | grep -q 'extension/dist/extension.cjs'

- name: Create GitHub release
uses: softprops/action-gh-release@v2
with:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ node_modules/
.DS_Store
npm-debug.log*
.gstack/
dist/
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ node_modules/
*.vsix
CHANGELOG.md
package-lock.json
dist/
src/data/reference.json
8 changes: 5 additions & 3 deletions .vscodeignore
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
.vscode/**
.vscode-test/**
.github/**
.gstack/**
node_modules/**
src/**
scripts/**
tests/**
.gitignore
docs/**
.editorconfig
.gitignore
.prettierrc
.prettierignore
tsconfig.json
vitest.config.ts
package-lock.json
*.vsix
.gstack/**
26 changes: 25 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,29 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and

## [Unreleased]

## [3.0.0] - 2026-09-07

The extension becomes a full language extension. Highlighting is unchanged; everything below is new.

### Added

- Completion for built-ins, keywords, types, user symbols, named arguments, annotations and import paths, with documentation and signatures.
- Hover documentation for built-ins, user functions, types, enums, variables and imports.
- Signature help with overloads and named-argument awareness.
- Document outline (functions, methods, types, enums, top-level variables).
- Workspace library indexing and published TradingView library lookup for `import` completion and hover.
- Opt-in diagnostics from the TradingView compiler (`pinescript.diagnostics.remote`, off by default).
- Commands: New Indicator, New Strategy, New Library, Generate Docstring (with a code action), Add Type Annotations, Open Reference.
- Pine Dark and Pine Light color themes.
- `src/data/reference.json`, generated from the v6 reference, and a build check that keeps it in step with the grammar data.

### Changed

- Minimum VS Code version is 1.96.
- The package now ships a bundled extension entry point (`dist/extension.cjs`) built with esbuild.
- `npm run build` builds both the grammar and the extension; grammar-only scripts are `build:grammar` and `build:grammar:check`.
- `line.set_xy` was removed from the grammar data; it is not part of Pine Script v6.

## [2.0.1] - 2026-09-06

### Fixed
Expand Down Expand Up @@ -63,7 +86,8 @@ Complete rewrite targeting Pine Script v6. The grammar is now generated from dat

- Language operators, built-in variables and built-in functions for Pine Script v3/v4.

[Unreleased]: https://github.com/yankikucuk/pine-script-syntax-highlighter/compare/v2.0.1...HEAD
[Unreleased]: https://github.com/yankikucuk/pine-script-syntax-highlighter/compare/v3.0.0...HEAD
[3.0.0]: https://github.com/yankikucuk/pine-script-syntax-highlighter/compare/v2.0.1...v3.0.0
[2.0.1]: https://github.com/yankikucuk/pine-script-syntax-highlighter/compare/v2.0.0...v2.0.1
[2.0.0]: https://github.com/yankikucuk/pine-script-syntax-highlighter/compare/v1.0.5...v2.0.0
[1.0.5]: https://github.com/yankikucuk/pine-script-syntax-highlighter/releases/tag/v1.0.5
Expand Down
Loading
Loading