summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2025-08-17 00:16:08 +0300
committerPaul Buetow <paul@buetow.org>2025-08-17 00:16:08 +0300
commit3b186ca95e2e18537c38363b1f5296e327f6df07 (patch)
tree0b809a2f6c0080f69261c0da733d7a1f7136a4ac
parentdc383b4faef881f3bb22816f42c53a79236a4152 (diff)
lsp/config: include ';' and '?' in default trigger characters
- Default trigger set when unset now [., :, /, _, ;, ?] - Update README and example config accordingly
-rw-r--r--IDEAS.md4
-rw-r--r--README.md55
-rw-r--r--config.json.example2
-rw-r--r--internal/lsp/server.go2
4 files changed, 21 insertions, 42 deletions
diff --git a/IDEAS.md b/IDEAS.md
index ba9b204..70f6537 100644
--- a/IDEAS.md
+++ b/IDEAS.md
@@ -24,7 +24,9 @@
* [ ] Be a replacement for 'github copilot cli'
* [ ] Be able to perform inline chats (keeping history in the document)
* [ ] Be able to switch the underlying model via a prompt
-* [ ] Fine tune when LLM completions are triggered, as it seems that there are some cases where the LLM is asked but Helix is not suggesting any completions
+* [ ] Fine tune when Large Language Model (LLM) completions trigger, as it seems that there are some cases where the Large Language Model (LLM) receives a request but Helix isn't suggesting any completions. There seems to be something odd with the in logic. Investigate the TriggerChar logic and make sure it matches Helix's expectations.
+* [ ] Only one code completion should run at a time, even if multiple triggers occur simultaneously
+* [ ] Create "generate unit test" code action for selected code block
Be able to select code blocks and perform code actions on them
diff --git a/README.md b/README.md
index 07e916c..bffb1d6 100644
--- a/README.md
+++ b/README.md
@@ -46,40 +46,30 @@ Notes:
- Token estimation for truncation uses a simple 4 chars/token heuristic.
- Full-file context is only included by default when defining a new function to balance quality, latency, and cost.
-### Flags quick reference
-
-| Flag | Description |
-|------------|--------------------------------------|
-| `-log` | Path to log file (optional). |
-| `-version` | Print version and exit. |
-
-Configuration is via a JSON file only. Environment variables are not used
-except for `OPENAI_API_KEY`.
-
-### JSON config file
-
- Location: `~/.config/hexai/config.json`
- Example:
```
{
"max_tokens": 4000,
- "context_mode": "always-full", // minimal | window | file-on-new-func | always-full
+ "context_mode": "always-full",
"context_window_lines": 120,
"max_context_tokens": 4000,
"log_preview_limit": 100,
"no_disk_io": true,
- "trigger_characters": [".", ":", "/", "_", ";"],
- "provider": "ollama", // or "openai"
- // OpenAI-only options
+ "trigger_characters": [".", ":", "/", "_", ";", "?"],
+ "provider": "ollama",
"openai_model": "gpt-4.1",
"openai_base_url": "https://api.openai.com/v1",
- // Ollama-only options
"ollama_model": "qwen2.5-coder:latest",
"ollama_base_url": "http://localhost:11434"
}
```
+* context_mode: minimal | window | file-on-new-func | always-full
+* provider: ollama or openai
+* openai_model, openai_base_url: OpenAI-only options
+* ollama_model, ollama_base_url: Ollama-only options
Minimal config (defaults to OpenAI):
```
@@ -88,30 +78,17 @@ Minimal config (defaults to OpenAI):
Ensure `OPENAI_API_KEY` is set in your environment.
-### Environment
-
-- Only `OPENAI_API_KEY` is read from the environment when `provider` is `openai`.
-
## Inline triggers
Hexai supports inline trigger tags you can type in your code to request an
action from the LLM and then clean up the tag automatically.
-- `;text;`: Do what is written in `text`, then remove just the `;text;` marker.
- - Strict form: no space after the first `;` and no space before the last `;`.
+- ``: Do what is written in `text`, then remove just the `` marker.
+ - Strict form: no space after the first ``.
- An optional single space immediately after the closing `;` is also removed.
- Multiple markers per line are supported.
- - Example: `// TODO ;rename this function to add;` removes only the marker.
-
-- `;;text;`: Do what is written in `text`, then remove the entire line.
- - Strict form: no space after `;;` and no space before the closing `;`.
- - Any line containing such a marker is deleted after processing.
- - Example:
- ```
- some() ;;extract helper; // this entire line is removed
- ```
-
-- Spaced variants such as `; text ;` or `;; spaced ;` are ignored.
+ - Example: `// TODO ` removes only the marker.
+- Spaced variants such as `; text ; spaced ;` are ignored.
## Code actions
@@ -124,12 +101,12 @@ Hexai provides code actions that operate only on the current selection in Helix:
Diagnostics outside the selection are not modified.
Instruction sources (first one found wins):
-- Strict marker: `;text;` (no space after first `;`, none before last `;`).
+
+- Strict marker: `` (no space after first ``).
- Line comments: `// text`, `# text`, `-- text`.
- Single-line block comments: `/* text */`, `<!-- text -->`.
Notes:
-- Only the earliest instruction in the selection is used; Hexai removes that
- marker/comment from the selection before sending it to the LLM.
-- The action returns only the transformed code and replaces exactly the
- selected range.
+
+- Only the earliest instruction in the selection is used; Hexai removes that marker/comment from the selection before sending it to the LLM.
+- The action returns only the transformed code and replaces exactly the selected range.
diff --git a/config.json.example b/config.json.example
index a964947..ca97076 100644
--- a/config.json.example
+++ b/config.json.example
@@ -5,7 +5,7 @@
"max_context_tokens": 4000,
"log_preview_limit": 100,
"no_disk_io": true,
- "trigger_characters": [".", ":", "/", "_", ";"],
+ "trigger_characters": [".", ":", "/", "_", ";", "?"],
"provider": "openai",
diff --git a/internal/lsp/server.go b/internal/lsp/server.go
index f828ec8..cc7d88e 100644
--- a/internal/lsp/server.go
+++ b/internal/lsp/server.go
@@ -74,7 +74,7 @@ func NewServer(r io.Reader, w io.Writer, logger *log.Logger, opts ServerOptions)
s.startTime = time.Now()
s.llmClient = opts.Client
if len(opts.TriggerCharacters) == 0 {
- s.triggerChars = []string{".", ":", "/", "_"}
+ s.triggerChars = []string{".", ":", "/", "_", ";", "?"}
} else {
s.triggerChars = append([]string{}, opts.TriggerCharacters...)
}