Skip to content

Commit 30c8ca5

Browse files
committed
refactor: remove support for legacy internal markers across all editors
The primary goal of this change is to strictly remove support for legacy <<<dotprompt:...>>> internal markers from all authoring environments, as these are intended for internal runtime use and have been superseded by the Handlebars helper syntax. - Remove syntax highlighting and snippet support for internal <<<dotprompt:...>>> markers in VS Code, JetBrains, Vim, Monaco, and Emacs extensions. - Clean up dead token types and highlighting attributes in the JetBrains and Monaco implementations. - Update the core Tree-sitter grammar tests to remove legacy marker validation. - Independently transition all role and section snippets from block-based ({{#role}}) to inline marker ({{role}}) Handlebars helpers to simplify template authoring. - Restore cursor positioning (bash) and proper newlines to role snippets in VS Code to ensure consistent usability.
1 parent 0911cf9 commit 30c8ca5

File tree

29 files changed

+1126
-1519
lines changed

29 files changed

+1126
-1519
lines changed

docs/design/promptly.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6587,7 +6587,6 @@ packages/chrome/
65876587
| Handlebars braces | Orange | `{{`, `}}` |
65886588
| Handlebars helper | Purple | `#if`, `#each`, `#role` |
65896589
| Variable | Cyan | `{{ name }}` |
6590-
| Dotprompt marker | Magenta | `<<<dotprompt:role>>>` |
65916590
| Comment | Gray italic | `{{! comment }}` |
65926591

65936592
| Component | Status | Location |

packages/codemirror/README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ CodeMirror 6 language support for Dotprompt (`.prompt`) files.
44

55
## Features
66

7-
- **Syntax Highlighting**: YAML frontmatter, Handlebars templates, Dotprompt
8-
markers
7+
- **Syntax Highlighting**: YAML frontmatter, Handlebars templates
98
- **Autocompletion**: Helpers, frontmatter fields, model names
109
- **Theming**: Dark and light theme support
1110

packages/codemirror/src/language.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -155,11 +155,6 @@ export const dotpromptStreamParser = {
155155
return 'comment';
156156
}
157157

158-
// Dotprompt markers
159-
if (stream.match(/<<<dotprompt:[^>]+>>>/)) {
160-
return 'keyword';
161-
}
162-
163158
// Handlebars block start {{#helper
164159
if (stream.match(/\{\{#/)) {
165160
state.context = 'handlebars';

packages/emacs/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Provides a major mode for editing Dotprompt (`.prompt`) files with syntax highli
44

55
## Features
66

7-
- **Syntax Highlighting**: Handlebars helpers, partials, Dotprompt markers
7+
- **Syntax Highlighting**: Handlebars helpers, partials
88
- **LSP Integration**: Diagnostics, formatting, hover via eglot or lsp-mode
99
- **Format Buffer**: `C-c C-f` or `M-x dotprompt-format-buffer`
1010
- **Format on Save**: Optional automatic formatting

packages/emacs/dotprompt-mode.el

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
;;; Commentary:
2424

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

72-
;; Dotprompt markers <<<dotprompt:role:system>>> etc.
73-
'("<<<dotprompt:[^>]+>>>" . font-lock-preprocessor-face)
74-
7572
;; Handlebars block comments {{!-- ... --}}
7673
'("{{!--\\(.\\|\n\\)*?--}}" . font-lock-comment-face)
7774

packages/jetbrains/README.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Language support for Dotprompt (`.prompt`) files in JetBrains IDEs (IntelliJ IDE
44

55
## Features
66

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

3232
2. **Build the plugin**:
33+
3334
```bash
3435
cd packages/jetbrains
3536
gradle buildPlugin
@@ -49,8 +50,8 @@ bazel build //packages/jetbrains:dotprompt-intellij
4950

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

52-
> **Note**: For full plugin packaging (with plugin.xml, icons, LSP4IJ integration),
53-
> use the Gradle build. The Bazel target is useful for incremental compilation
53+
> **Note**: For full plugin packaging (with plugin.xml, icons, LSP4IJ integration),
54+
> use the Gradle build. The Bazel target is useful for incremental compilation
5455
> during development and IDE integration.
5556
5657
### Install promptly for LSP Features
@@ -80,10 +81,10 @@ Type these abbreviations and press Tab to expand:
8081

8182
| Abbreviation | Expands To |
8283
|--------------|------------|
83-
| `role` | Role block with customizable role name |
84-
| `system` | System role block |
85-
| `user` | User role block |
86-
| `model` | Model role block |
84+
| `role` | Role marker with customizable role name |
85+
| `system` | System role marker |
86+
| `user` | User role marker |
87+
| `model` | Model role marker |
8788
| `if` | Handlebars if block |
8889
| `ifelse` | Handlebars if-else block |
8990
| `unless` | Handlebars unless block |
@@ -92,7 +93,7 @@ Type these abbreviations and press Tab to expand:
9293
| `json` | JSON serialization helper |
9394
| `media` | Media embedding helper |
9495
| `history` | History insertion |
95-
| `section` | Named section block |
96+
| `section` | Named section marker |
9697
| `partial` | Partial template inclusion |
9798
| `comment` | Handlebars comment |
9899
| `prompt` | Complete prompt template |
@@ -121,6 +122,7 @@ Go to **Settings/Preferences** → **Languages & Frameworks** → **Dotprompt**:
121122
### Auto-Detection
122123

123124
The plugin automatically finds `promptly` in:
125+
124126
1. User-configured path (Settings)
125127
2. System PATH
126128
3. `~/.cargo/bin/promptly`

packages/jetbrains/src/main/kotlin/com/google/dotprompt/DotpromptLexer.kt

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import com.intellij.psi.tree.IElementType
2525
* This lexer recognizes:
2626
* - YAML frontmatter delimiters (---)
2727
* - Handlebars expressions ({{ ... }})
28-
* - Dotprompt markers (<<<dotprompt:...>>>)
2928
* - Comments ({{! ... }})
3029
*/
3130
class DotpromptLexer : LexerBase() {
@@ -85,14 +84,6 @@ class DotpromptLexer : LexerBase() {
8584
return
8685
}
8786

88-
// Check for Dotprompt marker
89-
if (lookingAt("<<<dotprompt:")) {
90-
val end = findEndOfMarker()
91-
tokenEnd = end
92-
tokenType = DotpromptTokenTypes.MARKER
93-
return
94-
}
95-
9687
// Check for Handlebars comment
9788
if (lookingAt("{{!")) {
9889
val end = findEndOfHandlebars()
@@ -141,17 +132,6 @@ class DotpromptLexer : LexerBase() {
141132
return true
142133
}
143134

144-
private fun findEndOfMarker(): Int {
145-
var pos = tokenStart
146-
while (pos < bufferEnd - 2) {
147-
if (buffer[pos] == '>' && buffer[pos + 1] == '>' && buffer[pos + 2] == '>') {
148-
return pos + 3
149-
}
150-
pos++
151-
}
152-
return bufferEnd
153-
}
154-
155135
private fun findEndOfHandlebars(): Int {
156136
var pos = tokenStart
157137
while (pos < bufferEnd - 1) {
@@ -175,8 +155,8 @@ class DotpromptLexer : LexerBase() {
175155
var pos = tokenStart + 1
176156
while (pos < bufferEnd) {
177157
if (lookingAtPos(pos, "---") ||
178-
lookingAtPos(pos, "{{") ||
179-
lookingAtPos(pos, "<<<dotprompt:")) {
158+
lookingAtPos(pos, "{{") ||
159+
lookingAtPos(pos, "}}")) {
180160
return pos
181161
}
182162
if (buffer[pos] == '\n' && state == STATE_FRONTMATTER) {

packages/jetbrains/src/main/kotlin/com/google/dotprompt/DotpromptSyntaxHighlighter.kt

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,6 @@ class DotpromptSyntaxHighlighter : SyntaxHighlighterBase() {
5353
DotpromptTokenTypes.YAML_VALUE -> YAML_VALUE_KEYS
5454
DotpromptTokenTypes.HANDLEBARS_OPEN -> HANDLEBARS_BRACE_KEYS
5555
DotpromptTokenTypes.HANDLEBARS_CLOSE -> HANDLEBARS_BRACE_KEYS
56-
DotpromptTokenTypes.HANDLEBARS_HELPER -> HANDLEBARS_HELPER_KEYS
57-
DotpromptTokenTypes.HANDLEBARS_VARIABLE -> HANDLEBARS_VARIABLE_KEYS
58-
DotpromptTokenTypes.MARKER -> MARKER_KEYS
5956
DotpromptTokenTypes.COMMENT -> COMMENT_KEYS
6057
DotpromptTokenTypes.HEADER_COMMENT -> COMMENT_KEYS
6158
else -> EMPTY_KEYS
@@ -81,18 +78,6 @@ class DotpromptSyntaxHighlighter : SyntaxHighlighterBase() {
8178
"DOTPROMPT_HANDLEBARS_BRACE",
8279
DefaultLanguageHighlighterColors.BRACES
8380
)
84-
private val HANDLEBARS_HELPER = TextAttributesKey.createTextAttributesKey(
85-
"DOTPROMPT_HANDLEBARS_HELPER",
86-
DefaultLanguageHighlighterColors.FUNCTION_CALL
87-
)
88-
private val HANDLEBARS_VARIABLE = TextAttributesKey.createTextAttributesKey(
89-
"DOTPROMPT_HANDLEBARS_VARIABLE",
90-
DefaultLanguageHighlighterColors.IDENTIFIER
91-
)
92-
private val MARKER = TextAttributesKey.createTextAttributesKey(
93-
"DOTPROMPT_MARKER",
94-
DefaultLanguageHighlighterColors.METADATA
95-
)
9681
private val COMMENT = TextAttributesKey.createTextAttributesKey(
9782
"DOTPROMPT_COMMENT",
9883
DefaultLanguageHighlighterColors.LINE_COMMENT
@@ -102,9 +87,6 @@ class DotpromptSyntaxHighlighter : SyntaxHighlighterBase() {
10287
private val YAML_KEY_KEYS = arrayOf(YAML_KEY)
10388
private val YAML_VALUE_KEYS = arrayOf(YAML_VALUE)
10489
private val HANDLEBARS_BRACE_KEYS = arrayOf(HANDLEBARS_BRACE)
105-
private val HANDLEBARS_HELPER_KEYS = arrayOf(HANDLEBARS_HELPER)
106-
private val HANDLEBARS_VARIABLE_KEYS = arrayOf(HANDLEBARS_VARIABLE)
107-
private val MARKER_KEYS = arrayOf(MARKER)
10890
private val COMMENT_KEYS = arrayOf(COMMENT)
10991
}
11092
}

packages/jetbrains/src/main/kotlin/com/google/dotprompt/DotpromptTokenTypes.kt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,6 @@ object DotpromptTokenTypes {
2727
@JvmField val YAML_VALUE = IElementType("YAML_VALUE", DotpromptLanguage.INSTANCE)
2828
@JvmField val HANDLEBARS_OPEN = IElementType("HANDLEBARS_OPEN", DotpromptLanguage.INSTANCE)
2929
@JvmField val HANDLEBARS_CLOSE = IElementType("HANDLEBARS_CLOSE", DotpromptLanguage.INSTANCE)
30-
@JvmField val HANDLEBARS_HELPER = IElementType("HANDLEBARS_HELPER", DotpromptLanguage.INSTANCE)
31-
@JvmField val HANDLEBARS_VARIABLE = IElementType("HANDLEBARS_VARIABLE", DotpromptLanguage.INSTANCE)
32-
@JvmField val MARKER = IElementType("MARKER", DotpromptLanguage.INSTANCE)
3330
@JvmField val COMMENT = IElementType("COMMENT", DotpromptLanguage.INSTANCE)
3431
@JvmField val HEADER_COMMENT = IElementType("HEADER_COMMENT", DotpromptLanguage.INSTANCE)
3532
@JvmField val TEXT = IElementType("TEXT", DotpromptLanguage.INSTANCE)

packages/jetbrains/src/main/resources/liveTemplates/Dotprompt.xml

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,31 +17,27 @@
1717
SPDX-License-Identifier: Apache-2.0
1818
-->
1919
<templateSet group="Dotprompt">
20-
<!-- Role blocks -->
21-
<template name="role" value="{{#role &quot;$ROLE$&quot;}}&#10;$CONTENT$&#10;{{/role}}" description="Handlebars role block" toReformat="false" toShortenFQNames="true">
20+
<!-- Role markers -->
21+
<template name="role" value="{{role &quot;$ROLE$&quot;}}&#10;$0" description="Handlebars role marker" toReformat="false" toShortenFQNames="true">
2222
<variable name="ROLE" expression="" defaultValue="&quot;user&quot;" alwaysStopAt="true"/>
23-
<variable name="CONTENT" expression="" defaultValue="" alwaysStopAt="true"/>
2423
<context>
2524
<option name="OTHER" value="true"/>
2625
</context>
2726
</template>
2827

29-
<template name="system" value="{{#role &quot;system&quot;}}&#10;$CONTENT$&#10;{{/role}}" description="System role block" toReformat="false" toShortenFQNames="true">
30-
<variable name="CONTENT" expression="" defaultValue="" alwaysStopAt="true"/>
28+
<template name="system" value="{{role &quot;system&quot;}}&#10;$0" description="System role marker" toReformat="false" toShortenFQNames="true">
3129
<context>
3230
<option name="OTHER" value="true"/>
3331
</context>
3432
</template>
3533

36-
<template name="user" value="{{#role &quot;user&quot;}}&#10;$CONTENT$&#10;{{/role}}" description="User role block" toReformat="false" toShortenFQNames="true">
37-
<variable name="CONTENT" expression="" defaultValue="" alwaysStopAt="true"/>
34+
<template name="user" value="{{role &quot;user&quot;}}&#10;$0" description="User role marker" toReformat="false" toShortenFQNames="true">
3835
<context>
3936
<option name="OTHER" value="true"/>
4037
</context>
4138
</template>
4239

43-
<template name="model" value="{{#role &quot;model&quot;}}&#10;$CONTENT$&#10;{{/role}}" description="Model role block" toReformat="false" toShortenFQNames="true">
44-
<variable name="CONTENT" expression="" defaultValue="" alwaysStopAt="true"/>
40+
<template name="model" value="{{role &quot;model&quot;}}&#10;$0" description="Model role marker" toReformat="false" toShortenFQNames="true">
4541
<context>
4642
<option name="OTHER" value="true"/>
4743
</context>
@@ -129,9 +125,8 @@
129125
</context>
130126
</template>
131127

132-
<template name="section" value="{{#section &quot;$NAME$&quot;}}&#10;$CONTENT$&#10;{{/section}}" description="Named section block" toReformat="false" toShortenFQNames="true">
128+
<template name="section" value="{{section &quot;$NAME$&quot;}}&#10;$0" description="Named section marker" toReformat="false" toShortenFQNames="true">
133129
<variable name="NAME" expression="" defaultValue="" alwaysStopAt="true"/>
134-
<variable name="CONTENT" expression="" defaultValue="" alwaysStopAt="true"/>
135130
<context>
136131
<option name="OTHER" value="true"/>
137132
</context>
@@ -154,7 +149,7 @@
154149
</template>
155150

156151
<!-- Full template -->
157-
<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">
152+
<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">
158153
<variable name="MODEL" expression="" defaultValue="&quot;gemini-2.5-flash&quot;" alwaysStopAt="true"/>
159154
<variable name="TEMPERATURE" expression="" defaultValue="&quot;0.7&quot;" alwaysStopAt="true"/>
160155
<variable name="VARIABLE" expression="" defaultValue="&quot;name&quot;" alwaysStopAt="true"/>

0 commit comments

Comments
 (0)