Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
2b124ac
* created JetBrains plugin (some issues with highlighting)
andjak Apr 3, 2025
abf532f
* formatting is not all blue anymore
andjak Apr 3, 2025
b1ba075
* fixed occaisional variable and function incorrect formatting
andjak Apr 3, 2025
faed84a
* most highlight colours correct
andjak Apr 4, 2025
962c08e
* some highlighting fixed
andjak Apr 4, 2025
78ac583
* fixed issue with some hardcoded variables
andjak Apr 4, 2025
d0d922a
* removed more hardcoded stuff (strategy.exit)
andjak Apr 4, 2025
412a531
Enhance PineScriptLexer to correctly identify function parameters and…
andjak Apr 4, 2025
7afd572
Refactor PineScriptLexer to enhance function parameter detection and …
andjak Apr 4, 2025
c7133dc
Refactor PineScriptSyntaxHighlighter to implement dynamic color handl…
andjak Apr 4, 2025
5a5bd20
Update color definitions in PineScriptSyntaxHighlighter for improved …
andjak Apr 4, 2025
0940825
Update function and built-in variable colors in PineScriptSyntaxHighl…
andjak Apr 4, 2025
37cd3a8
Update DARK_COMMENT_COLOR in PineScriptSyntaxHighlighter to a darker …
andjak Apr 4, 2025
a0830e9
Enhance Pine Script plugin by adding comprehensive completion support…
andjak Apr 4, 2025
0e5ec44
Refactor plugin.xml to remove unused completion contributor and updat…
andjak Apr 4, 2025
570a172
Enhance Pine Script completion support by adding context-aware sugges…
andjak Apr 4, 2025
4681806
Add script to automate Pine Script reference extraction and enhance c…
andjak Apr 4, 2025
2e1fd39
Refactor Pine Script reference extraction to use asynchronous process…
andjak Apr 5, 2025
2eda70a
Refactor Pine Script extraction functions for improved clarity and pe…
andjak Apr 5, 2025
e93bfb8
Refactor function detail extraction in Pine Script syntax updater
andjak Apr 5, 2025
a741436
Enhance fragment handling and selector logic in Pine Script syntax up…
andjak Apr 5, 2025
cd09a97
Add variable detail extraction and processing in Pine Script syntax u…
andjak Apr 6, 2025
bf6ee5c
Refactor description and remarks extraction in Pine Script syntax upd…
andjak Apr 6, 2025
f0b6a79
Add constant detail extraction and processing in Pine Script syntax u…
andjak Apr 6, 2025
14b7254
Add JSON definitions for Pine Script versions 3 to 6 and update synta…
andjak Apr 6, 2025
18ca215
Update Pine Script IntelliJ plugin dependencies and adjust syntax ext…
andjak Apr 6, 2025
8cdb1be
Enhance variable detection and completion suggestions in PineScriptCo…
andjak Apr 6, 2025
9573b70
Enhance function parameter completion in PineScriptCompletionContributor
andjak Apr 6, 2025
ed32161
Enhance completion logic in PineScriptCompletionContributor
andjak Apr 6, 2025
054fe29
Refine completion logic in PineScriptCompletionContributor
andjak Apr 7, 2025
3feb78d
Implement string literal detection in PineScriptCompletionContributor
andjak Apr 7, 2025
9c3164f
Enhance completion suggestions in PineScriptCompletionContributor
andjak Apr 7, 2025
55c7169
Enhance completion logic for '=' and ':=' in PineScriptCompletionCont…
andjak Apr 7, 2025
e242b1f
Refine completion priority levels in PineScriptCompletionContributor
andjak Apr 7, 2025
8b3fab2
Refine completion logic and priority handling in PineScriptCompletion…
andjak Apr 7, 2025
254a36a
Enhance auto-popup completion functionality in PineScriptCompletionCo…
andjak Apr 7, 2025
244d87b
Enhance auto-popup completion and logging in PineScript plugin
andjak Apr 7, 2025
3741da7
Refactor namespace handling in PineScriptCompletionContributor
andjak Apr 7, 2025
c9675f2
Enhance namespace member completion logic in PineScriptCompletionCont…
andjak Apr 7, 2025
1238799
Update insert handler in PineScriptCompletionContributor to add paren…
andjak Apr 7, 2025
bb2705f
Refine completion logic and priority handling in PineScriptCompletion…
andjak Apr 8, 2025
5474281
Enhance function call handling in PineScriptCompletionContributor
andjak Apr 8, 2025
68db7ec
Enhance completion handling and logging in PineScriptCompletionContri…
andjak Apr 8, 2025
4e857b7
Enhance string detection and completion logic in PineScriptCompletion…
andjak Apr 8, 2025
bcad9dc
Enhance completion logic and type inference in PineScriptCompletionCo…
andjak Apr 9, 2025
5a14d16
Add type information handling in PineScriptCompletionContributor
andjak Apr 12, 2025
594db75
Enhance type inference and completion logic in PineScriptCompletionCo…
andjak Apr 12, 2025
2ff749d
Enhance error handling and logging in PineScriptCompletionContributor
andjak Apr 12, 2025
c27f9ad
Refactor string detection and function call handling in PineScriptCom…
andjak Apr 14, 2025
ad48a7f
Enhance variable assignment handling and type inference in PineScript…
andjak Apr 14, 2025
0ff0bea
Refactor function call detection logic in PineScriptCompletionContrib…
andjak Apr 14, 2025
a8dab28
Manual autocomplete implementation
andjak Apr 21, 2025
73ba0ce
Refactor cursor position handling and logging in PineScriptCompletion…
andjak Apr 22, 2025
bd0f105
Refactor type inference logic in PineScriptCompletionContributor
andjak Apr 23, 2025
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
1,788 changes: 1,787 additions & 1 deletion .gitignore

Large diffs are not rendered by default.

28 changes: 28 additions & 0 deletions pine-script-intellij-plugin/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# IntelliJ IDEA
.idea/
*.iml
*.iws
*.ipr
out/

# Gradle
.gradle/
build/

# Java
*.class
*.jar
*.war
*.ear

# Log files
*.log

# OS-specific files
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db
67 changes: 67 additions & 0 deletions pine-script-intellij-plugin/BUILDING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Building the Pine Script JetBrains Plugin

This document describes how to build the Pine Script plugin for JetBrains IDEs.

## Prerequisites

- Java JDK 17 or newer
- Git

## Building from Source

1. Clone the repository:
```bash
git clone https://github.com/yourusername/pine-script-intellij-plugin.git
cd pine-script-intellij-plugin
```

2. Build the plugin:
```bash
./gradlew buildPlugin
```

This will generate the plugin ZIP file in the `build/distributions` directory.

## Installing the Plugin from the ZIP File

1. Open your JetBrains IDE (IntelliJ IDEA, WebStorm, etc.)
2. Go to **Settings/Preferences → Plugins**
3. Click on the gear icon and select **Install Plugin from Disk...**
4. Select the ZIP file from `build/distributions`
5. Restart your IDE

## Development Workflow

### Running the Plugin in Development Mode

To run the plugin in a separate IntelliJ IDEA instance:

```bash
./gradlew runIde
```

This will start a new IntelliJ IDEA instance with the plugin installed.

### Testing

To run the tests:

```bash
./gradlew test
```

### Continuous Integration

The project is set up to use GitHub Actions for CI. The workflow will build and test the plugin on every push.

## Troubleshooting

- **Problem**: Gradle fails to build
**Solution**: Make sure you have JDK 17 or newer installed and set as the project SDK in your IDE.

- **Problem**: The plugin doesn't show up after installation
**Solution**: Make sure to restart your IDE after installing the plugin.

## Documentation

For more information about developing JetBrains plugins, see the [JetBrains Platform SDK Documentation](https://plugins.jetbrains.com/docs/intellij/welcome.html).
73 changes: 73 additions & 0 deletions pine-script-intellij-plugin/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Pine Script Plugin for JetBrains IDEs

This plugin provides Pine Script language support for JetBrains IDEs (IntelliJ IDEA, WebStorm, PyCharm, etc.).

## Features

- Syntax highlighting for Pine Script files (`.pine`, `.ps`, `.pinescript`)
- Code completion for built-in functions, variables, and methods
- Parameter information for function calls
- Color preview in editor
- Documentation on hover
- New Pine Script file templates (Indicator, Strategy, Library)

## Installation

### From JetBrains Marketplace

1. Open your JetBrains IDE
2. Go to Settings/Preferences → Plugins
3. Click on "Browse repositories..."
4. Search for "Pine Script"
5. Install the plugin
6. Restart your IDE

### Manual Installation

1. Download the plugin from [Releases](https://github.com/yourusername/pine-script-intellij-plugin/releases)
2. Open your JetBrains IDE
3. Go to Settings/Preferences → Plugins
4. Click on the gear icon
5. Select "Install Plugin from Disk..."
6. Choose the downloaded ZIP file
7. Restart your IDE

## Usage

### Creating New Pine Script Files

1. Right-click in the Project window
2. Select New → Pine Script File
3. Choose the type of file (Indicator, Strategy, Library, or Empty)
4. Enter the name of the file
5. Click OK

### Features

- **Syntax Highlighting**: Pine Script keywords, functions, and variables are highlighted automatically.
- **Code Completion**: Press Ctrl+Space to see completion suggestions as you type.
- **Parameter Info**: Press Ctrl+P inside function parentheses to see parameter information.
- **Documentation**: Hover over a function or keyword to see its documentation.
- **Color Preview**: Hex colors and color.NAME values show a color preview in the editor gutter.

## Building from Source

```bash
git clone https://github.com/yourusername/pine-script-intellij-plugin.git
cd pine-script-intellij-plugin
./gradlew buildPlugin
```

The plugin will be built in `build/distributions/`.

## Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

## License

This plugin is released under the MIT License. See the [LICENSE](LICENSE) file for details.

## Acknowledgements

This plugin was inspired by the [Pine Script VS Code Plugin](https://github.com/FFriZ/Pine-Script-v5-VS-Code).
7 changes: 7 additions & 0 deletions pine-script-intellij-plugin/bin/main/META-INF/filewatcher.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<component name="FileTypeManager" version="13">
<extensionMap>
<mapping ext="pine" type="Pine Script"/>
<mapping ext="ps" type="Pine Script"/>
<mapping ext="pinescript" type="Pine Script"/>
</extensionMap>
</component>
8 changes: 8 additions & 0 deletions pine-script-intellij-plugin/bin/main/META-INF/pine-script.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<bundles>
<language id="Pine Script">
<highlighting>
<grammar path="/grammar/pine-script.json"/>
<bundle path="/highlighting/pine-script.tmbundle"/>
</highlighting>
</language>
</bundles>
84 changes: 84 additions & 0 deletions pine-script-intellij-plugin/bin/main/META-INF/plugin.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
<idea-plugin>
<id>com.pinescript.plugin</id>
<name>Pine Script</name>
<vendor email="support@pinescript.org" url="https://www.pinescript.org">Pine Script</vendor>

<description><![CDATA[
<p>Pine Script language support for JetBrains IDEs.</p>
<p>Features:</p>
<ul>
<li>Syntax highlighting for Pine Script files (.pine, .ps, .pinescript)</li>
<li>Code completion for built-in functions, variables, and methods</li>
<li>Color preview in editor</li>
<li>Parameter information and documentation</li>
</ul>
]]></description>

<depends>com.intellij.modules.platform</depends>
<depends>org.jetbrains.plugins.textmate</depends>

<extensions defaultExtensionNs="com.intellij">
<!-- TextMate support -->
<TextMateInstaller/>

<!-- Register both TextMate bundles -->
<textmate.bundle name="pinescript-grammar" path="/textmate/pinescript.tmbundle"/>
<textmate.bundle name="pine-script-grammar" path="/highlighting/pine-script.tmbundle"/>

<!-- File type factory (legacy but more reliable approach) -->
<fileTypeFactory implementation="com.pinescript.plugin.language.PineScriptFileTypeFactory"/>

<!-- Register language and file type -->
<fileType name="Pine Script"
implementationClass="com.pinescript.plugin.language.PineScriptFileType"
language="Pine Script"
extensions="pine;ps;pinescript"/>

<!-- Map TextMate grammar scope to our language -->
<textmate.languageMapping mapping="source.pinescript" language="Pine Script"/>

<!-- Language parser definition -->
<lang.parserDefinition language="Pine Script"
implementationClass="com.pinescript.plugin.language.PineScriptParserDefinition"/>

<!-- Associate our custom syntax highlighter with our language -->
<lang.syntaxHighlighter language="Pine Script"
implementationClass="com.pinescript.plugin.editor.PineScriptSyntaxHighlighter"/>

<!-- Code completion -->
<completion.contributor language="Pine Script"
implementationClass="com.pinescript.plugin.completion.PineScriptCompletionContributor"
order="first"/>

<!-- Auto-popup completion configuration using CompletionConfidence for better reliability -->
<completion.confidence language="Pine Script"
implementationClass="com.pinescript.plugin.completion.PineScriptCompletionTrigger"
order="first" />

<!-- Enable auto-popup for dot, parenthesis, and comma characters -->
<completion.autocomplete.charFilter implementation="com.intellij.codeInsight.completion.DefaultCharFilter"
order="first" />

<!-- Custom typed handler specifically for auto completion (highest priority) -->
<typedHandler implementation="com.pinescript.plugin.completion.PineScriptAutoPopupCompletion"
order="first" id="pineScriptAutoPopup"/>

<!-- Color scheme -->
<bundledColorScheme path="/schemes/PineScriptScheme.xml"/>

<!-- Register file-specific annotation -->
<annotator language="Pine Script"
implementationClass="com.pinescript.plugin.annotator.PineScriptAnnotator"/>

<!-- Commenter for comments handling -->
<lang.commenter language="Pine Script"
implementationClass="com.pinescript.plugin.editor.PineScriptCommenter"/>
</extensions>

<actions>
<action id="PineScript.NewFile" class="com.pinescript.plugin.actions.NewPineScriptFileAction"
text="Pine Script File" description="Create new Pine Script file">
<add-to-group group-id="NewGroup" anchor="before" relative-to-action="NewFile"/>
</action>
</actions>
</idea-plugin>
53 changes: 53 additions & 0 deletions pine-script-intellij-plugin/bin/main/META-INF/plugin.xml.bak
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<idea-plugin>
<id>com.pinescript.plugin</id>
<name>Pine Script</name>
<vendor email="support@pinescript.org" url="https://www.pinescript.org">Pine Script</vendor>

<description><![CDATA[
<p>Pine Script language support for JetBrains IDEs.</p>
<p>Features:</p>
<ul>
<li>Syntax highlighting for Pine Script files (.pine, .ps, .pinescript)</li>
<li>Code completion for built-in functions, variables, and methods</li>
<li>Color preview in editor</li>
<li>Parameter information and documentation</li>
</ul>
]]></description>

<depends>com.intellij.modules.platform</depends>
<depends>org.jetbrains.plugins.textmate</depends>

<extensions defaultExtensionNs="com.intellij">
<!-- TextMate support -->
<TextMateInstaller/>

<!-- Register both TextMate bundles -->
<textmate.bundle name="pinescript-grammar" path="/textmate/pinescript.tmbundle"/>
<textmate.bundle name="pine-script-grammar" path="/highlighting/pine-script.tmbundle"/>

<!-- Register language and file type -->
<fileType name="Pine Script"
implementationClass="com.pinescript.plugin.language.PineScriptFileType"
language="Pine Script"
extensions="pine;ps;pinescript"/>

<!-- Map TextMate grammar scope to our language -->
<textmate.languageMapping mapping="source.pinescript" language="Pine Script"/>

<!-- Associate our custom syntax highlighter with our language -->
<lang.syntaxHighlighter language="Pine Script"
implementationClass="com.pinescript.plugin.editor.PineScriptSyntaxHighlighter"/>

<!-- Code completion -->
<completion.contributor language="Pine Script"
implementationClass="com.pinescript.plugin.completion.PineScriptCompletionContributor"
order="first"/>
</extensions>

<actions>
<action id="PineScript.NewFile" class="com.pinescript.plugin.actions.NewPineScriptFileAction"
text="Pine Script File" description="Create new Pine Script file">
<add-to-group group-id="NewGroup" anchor="before" relative-to-action="NewFile"/>
</action>
</actions>
</idea-plugin>
54 changes: 54 additions & 0 deletions pine-script-intellij-plugin/bin/main/META-INF/plugin.xml.bak2
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<idea-plugin>
<id>com.pinescript.plugin</id>
<name>Pine Script</name>
<vendor email="support@pinescript.org" url="https://www.pinescript.org">Pine Script</vendor>

<description><![CDATA[
<p>Pine Script language support for JetBrains IDEs.</p>
<p>Features:</p>
<ul>
<li>Syntax highlighting for Pine Script files (.pine, .ps, .pinescript)</li>
<li>Code completion for built-in functions, variables, and methods</li>
<li>Color preview in editor</li>
<li>Parameter information and documentation</li>
</ul>
]]></description>

<depends>com.intellij.modules.platform</depends>
<depends>org.jetbrains.plugins.textmate</depends>

<extensions defaultExtensionNs="com.intellij">
<!-- TextMate support -->
<TextMateInstaller/>

<!-- Register both TextMate bundles -->
<textmate.bundle name="pinescript-grammar" path="/textmate/pinescript.tmbundle"/>
<textmate.bundle name="pine-script-grammar" path="/highlighting/pine-script.tmbundle"/>

<!-- Register language and file type -->
<fileType name="Pine Script"
implementationClass="com.pinescript.plugin.language.PineScriptFileType"
language="Pine Script"
extensions="pine;ps;pinescript"/>

<!-- Map TextMate grammar scope to our language -->
<textmate.languageMapping mapping="source.pinescript" language="Pine Script"/>

<!-- Associate our custom syntax highlighter with our language -->
<lang.syntaxHighlighter language="Pine Script"
implementationClass="com.pinescript.plugin.editor.PineScriptSyntaxHighlighter"/>

<!-- Code completion -->
<completion.contributor language="Pine Script"
implementationClass="com.pinescript.plugin.completion.PineScriptCompletionContributor"
order="first"/>
<!-- Color scheme -->
<bundledColorScheme path="/schemes/PineScriptScheme"/> </extensions>

<actions>
<action id="PineScript.NewFile" class="com.pinescript.plugin.actions.NewPineScriptFileAction"
text="Pine Script File" description="Create new Pine Script file">
<add-to-group group-id="NewGroup" anchor="before" relative-to-action="NewFile"/>
</action>
</actions>
</idea-plugin>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Define characters that should trigger auto-popup in Pine Script
# The dot character is used for namespace member completion
# Parenthesis and comma are used for function parameter completion
autoPopupChars=.,(
Loading