Skip to content
Open
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
1 change: 0 additions & 1 deletion docs/design/promptly.md
Original file line number Diff line number Diff line change
Expand Up @@ -6587,7 +6587,6 @@ packages/chrome/
| Handlebars braces | Orange | `{{`, `}}` |
| Handlebars helper | Purple | `#if`, `#each`, `#role` |
| Variable | Cyan | `{{ name }}` |
| Dotprompt marker | Magenta | `<<<dotprompt:role>>>` |
| Comment | Gray italic | `{{! comment }}` |

| Component | Status | Location |
Expand Down
3 changes: 1 addition & 2 deletions packages/codemirror/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ CodeMirror 6 language support for Dotprompt (`.prompt`) files.

## Features

- **Syntax Highlighting**: YAML frontmatter, Handlebars templates, Dotprompt
markers
- **Syntax Highlighting**: YAML frontmatter, Handlebars templates
- **Autocompletion**: Helpers, frontmatter fields, model names
- **Theming**: Dark and light theme support

Expand Down
5 changes: 0 additions & 5 deletions packages/codemirror/src/language.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,6 @@ export const dotpromptStreamParser = {
return 'comment';
}

// Dotprompt markers
if (stream.match(/<<<dotprompt:[^>]+>>>/)) {
return 'keyword';
}

// Handlebars block start {{#helper
if (stream.match(/\{\{#/)) {
state.context = 'handlebars';
Expand Down
2 changes: 1 addition & 1 deletion packages/emacs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Provides a major mode for editing Dotprompt (`.prompt`) files with syntax highli

## Features

- **Syntax Highlighting**: Handlebars helpers, partials, Dotprompt markers
- **Syntax Highlighting**: Handlebars helpers, partials
- **LSP Integration**: Diagnostics, formatting, hover via eglot or lsp-mode
- **Format Buffer**: `C-c C-f` or `M-x dotprompt-format-buffer`
- **Format on Save**: Optional automatic formatting
Expand Down
5 changes: 1 addition & 4 deletions packages/emacs/dotprompt-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
;;; Commentary:

;; Major mode for editing Dotprompt files (.prompt).
;; Provides syntax highlighting for markers, helpers, and partials.
;; Provides syntax highlighting for helpers and partials.
;; Includes LSP integration via eglot or lsp-mode for diagnostics,
;; formatting, and hover documentation when `promptly` is installed.
;;
Expand Down Expand Up @@ -69,9 +69,6 @@
;; YAML numeric values
'(":\\s-+\\([0-9]+\\.?[0-9]*\\)$" 1 font-lock-constant-face)

;; Dotprompt markers <<<dotprompt:role:system>>> etc.
'("<<<dotprompt:[^>]+>>>" . font-lock-preprocessor-face)

;; Handlebars block comments {{!-- ... --}}
'("{{!--\\(.\\|\n\\)*?--}}" . font-lock-comment-face)

Expand Down
18 changes: 10 additions & 8 deletions packages/jetbrains/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Language support for Dotprompt (`.prompt`) files in JetBrains IDEs (IntelliJ IDE

## Features

- **Syntax Highlighting**: YAML frontmatter, Handlebars templates, Dotprompt markers
- **Syntax Highlighting**: YAML frontmatter, Handlebars templates
- **LSP Integration**: Real-time diagnostics, formatting, and hover documentation (via LSP4IJ)
- **Live Templates**: Type `role`, `if`, `each`, `json` + Tab for quick insertions
- **Code Comments**: Block comment support using `{{! ... }}`
Expand All @@ -30,6 +30,7 @@ Language support for Dotprompt (`.prompt`) files in JetBrains IDEs (IntelliJ IDE
1. **Prerequisites**: Ensure you have Gradle and JDK 17+ installed

2. **Build the plugin**:

```bash
cd packages/jetbrains
gradle buildPlugin
Expand All @@ -49,8 +50,8 @@ bazel build //packages/jetbrains:dotprompt-intellij

This produces `bazel-bin/packages/jetbrains/dotprompt-intellij.jar`.

> **Note**: For full plugin packaging (with plugin.xml, icons, LSP4IJ integration),
> use the Gradle build. The Bazel target is useful for incremental compilation
> **Note**: For full plugin packaging (with plugin.xml, icons, LSP4IJ integration),
> use the Gradle build. The Bazel target is useful for incremental compilation
> during development and IDE integration.

### Install promptly for LSP Features
Expand Down Expand Up @@ -80,10 +81,10 @@ Type these abbreviations and press Tab to expand:

| Abbreviation | Expands To |
|--------------|------------|
| `role` | Role block with customizable role name |
| `system` | System role block |
| `user` | User role block |
| `model` | Model role block |
| `role` | Role marker with customizable role name |
| `system` | System role marker |
| `user` | User role marker |
| `model` | Model role marker |
| `if` | Handlebars if block |
| `ifelse` | Handlebars if-else block |
| `unless` | Handlebars unless block |
Expand All @@ -92,7 +93,7 @@ Type these abbreviations and press Tab to expand:
| `json` | JSON serialization helper |
| `media` | Media embedding helper |
| `history` | History insertion |
| `section` | Named section block |
| `section` | Named section marker |
| `partial` | Partial template inclusion |
| `comment` | Handlebars comment |
| `prompt` | Complete prompt template |
Expand Down Expand Up @@ -121,6 +122,7 @@ Go to **Settings/Preferences** → **Languages & Frameworks** → **Dotprompt**:
### Auto-Detection

The plugin automatically finds `promptly` in:

1. User-configured path (Settings)
2. System PATH
3. `~/.cargo/bin/promptly`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import com.intellij.psi.tree.IElementType
* This lexer recognizes:
* - YAML frontmatter delimiters (---)
* - Handlebars expressions ({{ ... }})
* - Dotprompt markers (<<<dotprompt:...>>>)
* - Comments ({{! ... }})
*/
class DotpromptLexer : LexerBase() {
Expand Down Expand Up @@ -85,14 +84,6 @@ class DotpromptLexer : LexerBase() {
return
}

// Check for Dotprompt marker
if (lookingAt("<<<dotprompt:")) {
val end = findEndOfMarker()
tokenEnd = end
tokenType = DotpromptTokenTypes.MARKER
return
}

// Check for Handlebars comment
if (lookingAt("{{!")) {
val end = findEndOfHandlebars()
Expand Down Expand Up @@ -141,17 +132,6 @@ class DotpromptLexer : LexerBase() {
return true
}

private fun findEndOfMarker(): Int {
var pos = tokenStart
while (pos < bufferEnd - 2) {
if (buffer[pos] == '>' && buffer[pos + 1] == '>' && buffer[pos + 2] == '>') {
return pos + 3
}
pos++
}
return bufferEnd
}

private fun findEndOfHandlebars(): Int {
var pos = tokenStart
while (pos < bufferEnd - 1) {
Expand All @@ -175,8 +155,8 @@ class DotpromptLexer : LexerBase() {
var pos = tokenStart + 1
while (pos < bufferEnd) {
if (lookingAtPos(pos, "---") ||
lookingAtPos(pos, "{{") ||
lookingAtPos(pos, "<<<dotprompt:")) {
lookingAtPos(pos, "{{") ||
lookingAtPos(pos, "}}")) {
return pos
}
if (buffer[pos] == '\n' && state == STATE_FRONTMATTER) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,6 @@ class DotpromptSyntaxHighlighter : SyntaxHighlighterBase() {
DotpromptTokenTypes.YAML_VALUE -> YAML_VALUE_KEYS
DotpromptTokenTypes.HANDLEBARS_OPEN -> HANDLEBARS_BRACE_KEYS
DotpromptTokenTypes.HANDLEBARS_CLOSE -> HANDLEBARS_BRACE_KEYS
DotpromptTokenTypes.HANDLEBARS_HELPER -> HANDLEBARS_HELPER_KEYS
DotpromptTokenTypes.HANDLEBARS_VARIABLE -> HANDLEBARS_VARIABLE_KEYS
DotpromptTokenTypes.MARKER -> MARKER_KEYS
DotpromptTokenTypes.COMMENT -> COMMENT_KEYS
DotpromptTokenTypes.HEADER_COMMENT -> COMMENT_KEYS
else -> EMPTY_KEYS
Expand All @@ -81,18 +78,6 @@ class DotpromptSyntaxHighlighter : SyntaxHighlighterBase() {
"DOTPROMPT_HANDLEBARS_BRACE",
DefaultLanguageHighlighterColors.BRACES
)
private val HANDLEBARS_HELPER = TextAttributesKey.createTextAttributesKey(
"DOTPROMPT_HANDLEBARS_HELPER",
DefaultLanguageHighlighterColors.FUNCTION_CALL
)
private val HANDLEBARS_VARIABLE = TextAttributesKey.createTextAttributesKey(
"DOTPROMPT_HANDLEBARS_VARIABLE",
DefaultLanguageHighlighterColors.IDENTIFIER
)
private val MARKER = TextAttributesKey.createTextAttributesKey(
"DOTPROMPT_MARKER",
DefaultLanguageHighlighterColors.METADATA
)
private val COMMENT = TextAttributesKey.createTextAttributesKey(
"DOTPROMPT_COMMENT",
DefaultLanguageHighlighterColors.LINE_COMMENT
Expand All @@ -102,9 +87,6 @@ class DotpromptSyntaxHighlighter : SyntaxHighlighterBase() {
private val YAML_KEY_KEYS = arrayOf(YAML_KEY)
private val YAML_VALUE_KEYS = arrayOf(YAML_VALUE)
private val HANDLEBARS_BRACE_KEYS = arrayOf(HANDLEBARS_BRACE)
private val HANDLEBARS_HELPER_KEYS = arrayOf(HANDLEBARS_HELPER)
private val HANDLEBARS_VARIABLE_KEYS = arrayOf(HANDLEBARS_VARIABLE)
private val MARKER_KEYS = arrayOf(MARKER)
private val COMMENT_KEYS = arrayOf(COMMENT)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ object DotpromptTokenTypes {
@JvmField val YAML_VALUE = IElementType("YAML_VALUE", DotpromptLanguage.INSTANCE)
@JvmField val HANDLEBARS_OPEN = IElementType("HANDLEBARS_OPEN", DotpromptLanguage.INSTANCE)
@JvmField val HANDLEBARS_CLOSE = IElementType("HANDLEBARS_CLOSE", DotpromptLanguage.INSTANCE)
@JvmField val HANDLEBARS_HELPER = IElementType("HANDLEBARS_HELPER", DotpromptLanguage.INSTANCE)
@JvmField val HANDLEBARS_VARIABLE = IElementType("HANDLEBARS_VARIABLE", DotpromptLanguage.INSTANCE)
@JvmField val MARKER = IElementType("MARKER", DotpromptLanguage.INSTANCE)
@JvmField val COMMENT = IElementType("COMMENT", DotpromptLanguage.INSTANCE)
@JvmField val HEADER_COMMENT = IElementType("HEADER_COMMENT", DotpromptLanguage.INSTANCE)
@JvmField val TEXT = IElementType("TEXT", DotpromptLanguage.INSTANCE)
Expand Down
19 changes: 7 additions & 12 deletions packages/jetbrains/src/main/resources/liveTemplates/Dotprompt.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,31 +17,27 @@
SPDX-License-Identifier: Apache-2.0
-->
<templateSet group="Dotprompt">
<!-- Role blocks -->
<template name="role" value="{{#role &quot;$ROLE$&quot;}}&#10;$CONTENT$&#10;{{/role}}" description="Handlebars role block" toReformat="false" toShortenFQNames="true">
<!-- Role markers -->
<template name="role" value="{{role &quot;$ROLE$&quot;}}&#10;$0" description="Handlebars role marker" toReformat="false" toShortenFQNames="true">
<variable name="ROLE" expression="" defaultValue="&quot;user&quot;" alwaysStopAt="true"/>
<variable name="CONTENT" expression="" defaultValue="" alwaysStopAt="true"/>
<context>
<option name="OTHER" value="true"/>
</context>
</template>

<template name="system" value="{{#role &quot;system&quot;}}&#10;$CONTENT$&#10;{{/role}}" description="System role block" toReformat="false" toShortenFQNames="true">
<variable name="CONTENT" expression="" defaultValue="" alwaysStopAt="true"/>
<template name="system" value="{{role &quot;system&quot;}}&#10;$0" description="System role marker" toReformat="false" toShortenFQNames="true">
<context>
<option name="OTHER" value="true"/>
</context>
</template>

<template name="user" value="{{#role &quot;user&quot;}}&#10;$CONTENT$&#10;{{/role}}" description="User role block" toReformat="false" toShortenFQNames="true">
<variable name="CONTENT" expression="" defaultValue="" alwaysStopAt="true"/>
<template name="user" value="{{role &quot;user&quot;}}&#10;$0" description="User role marker" toReformat="false" toShortenFQNames="true">
<context>
<option name="OTHER" value="true"/>
</context>
</template>

<template name="model" value="{{#role &quot;model&quot;}}&#10;$CONTENT$&#10;{{/role}}" description="Model role block" toReformat="false" toShortenFQNames="true">
<variable name="CONTENT" expression="" defaultValue="" alwaysStopAt="true"/>
<template name="model" value="{{role &quot;model&quot;}}&#10;$0" description="Model role marker" toReformat="false" toShortenFQNames="true">
<context>
<option name="OTHER" value="true"/>
</context>
Expand Down Expand Up @@ -129,9 +125,8 @@
</context>
</template>

<template name="section" value="{{#section &quot;$NAME$&quot;}}&#10;$CONTENT$&#10;{{/section}}" description="Named section block" toReformat="false" toShortenFQNames="true">
<template name="section" value="{{section &quot;$NAME$&quot;}}&#10;$0" description="Named section marker" toReformat="false" toShortenFQNames="true">
<variable name="NAME" expression="" defaultValue="" alwaysStopAt="true"/>
<variable name="CONTENT" expression="" defaultValue="" alwaysStopAt="true"/>
<context>
<option name="OTHER" value="true"/>
</context>
Expand All @@ -154,7 +149,7 @@
</template>

<!-- Full template -->
<template name="prompt" value="---&#10;model: $MODEL$&#10;config:&#10; temperature: $TEMPERATURE$&#10;input:&#10; schema:&#10; $VARIABLE$: string&#10;---&#10;&#10;{{#role &quot;system&quot;}}&#10;$SYSTEM_PROMPT$&#10;{{/role}}&#10;&#10;{{#role &quot;user&quot;}}&#10;$USER_PROMPT$&#10;{{/role}}" description="Complete prompt template" toReformat="false" toShortenFQNames="true">
<template name="prompt" value="---&#10;model: $MODEL$&#10;config:&#10; temperature: $TEMPERATURE$&#10;input:&#10; schema:&#10; $VARIABLE$: string&#10;---&#10;&#10;{{role &quot;system&quot;}}&#10;$SYSTEM_PROMPT$&#10;&#10;{{role &quot;user&quot;}}&#10;$USER_PROMPT$" description="Complete prompt template" toReformat="false" toShortenFQNames="true">
<variable name="MODEL" expression="" defaultValue="&quot;gemini-2.5-flash&quot;" alwaysStopAt="true"/>
<variable name="TEMPERATURE" expression="" defaultValue="&quot;0.7&quot;" alwaysStopAt="true"/>
<variable name="VARIABLE" expression="" defaultValue="&quot;name&quot;" alwaysStopAt="true"/>
Expand Down
24 changes: 11 additions & 13 deletions packages/monaco/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Monaco Editor language support for Dotprompt (`.prompt`) files.

## Features

- **Syntax Highlighting**: YAML frontmatter, Handlebars templates, Dotprompt markers
- **Syntax Highlighting**: YAML frontmatter, Handlebars templates
- **Autocompletion**: Helpers, frontmatter fields, model names, role snippets
- **Hover Documentation**: Helper and frontmatter field documentation
- **Bracket Matching**: Auto-closing for `{{ }}`, `{{# }}`, etc.
Expand Down Expand Up @@ -38,13 +38,11 @@ config:
temperature: 0.7
---

{{#role "system"}}
{{role "system"}}
You are a helpful assistant.
{{/role}}

{{#role "user"}}
Hello, {{ name }}!
{{/role}}`,
{{role "user"}}
Hello, {{ name }}!`,
language: 'dotprompt',
theme: 'vs-dark',
});
Expand Down Expand Up @@ -167,8 +165,8 @@ The completion provider offers:

| Context | Completions |
|---------|-------------|
| `{{` | Handlebars helpers, Dotprompt helpers |
| `{{#` | Block helpers (if, each, role, section) |
| `{{` | Handlebars helpers, Dotprompt helpers (role, section, json, etc.) |
| `{{#` | Block helpers (if, each, with, ifEquals) |
| `{{>` | Partial template reference |
| `model:` | Model names (Gemini, GPT, Claude) |
| Frontmatter | Field names (model, config, input, output) |
Expand All @@ -182,11 +180,11 @@ Token types available for theming:
| `delimiter.frontmatter` | `---` delimiters |
| `delimiter.handlebars` | `{{` and `}}` |
| `delimiter.handlebars.block` | `{{#` and `{{/` |
| `keyword.handlebars` | if, each, with, etc. |
| `keyword.dotprompt` | role, json, history, etc. |
| `keyword.yaml` | YAML frontmatter keys |
| `keyword.marker` | `<<<dotprompt:...>>>` |
| `variable` | Template variables |
| keyword.handlebars | if, each, with, etc. |
| keyword.dotprompt | role, json, history, etc. |
| keyword.yaml | YAML frontmatter keys |
| variable | Template variables |

| `variable.partial` | Partial names |
| `variable.special` | @index, @first, etc. |
| `comment.block` | `{{! comment }}` |
Expand Down
Loading
Loading