opencode-quill 0.7.1 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/README.md +27 -17
- package/package.json +3 -2
- package/src/ghost.ts +36 -4
- package/src/keymap.ts +7 -1
- package/src/options.ts +2 -1
- package/src/predictor.ts +21 -6
- package/src/prose.ts +1 -1
- package/src/tui.tsx +2 -1
- package/tsconfig.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,18 @@ All notable changes are documented in this file using
|
|
|
4
4
|
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and
|
|
5
5
|
[Semantic Versioning](https://semver.org/).
|
|
6
6
|
|
|
7
|
+
## [0.9.0] - 2026-11-27
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- **composer:** Add opt-in suggestion alternatives (#32)
|
|
12
|
+
|
|
13
|
+
## [0.8.0] - 2026-11-27
|
|
14
|
+
|
|
15
|
+
### Added
|
|
16
|
+
|
|
17
|
+
- **predictor:** Reduce wrong suggestions and offer longer words after a complete word (#30)
|
|
18
|
+
|
|
7
19
|
## [0.7.1] - 2026-11-23
|
|
8
20
|
|
|
9
21
|
### Fixed
|
|
@@ -169,6 +181,8 @@ All notable changes are documented in this file using
|
|
|
169
181
|
- `/quill` command and command palette action to toggle autocomplete.
|
|
170
182
|
- Local installer script, full test suite, CI workflows, and release tooling.
|
|
171
183
|
|
|
184
|
+
[0.9.0]: https://github.com/ozandogrultan/opencode-quill/compare/v0.8.0...v0.9.0
|
|
185
|
+
[0.8.0]: https://github.com/ozandogrultan/opencode-quill/compare/v0.7.1...v0.8.0
|
|
172
186
|
[0.7.1]: https://github.com/ozandogrultan/opencode-quill/compare/v0.7.0...v0.7.1
|
|
173
187
|
[0.7.0]: https://github.com/ozandogrultan/opencode-quill/compare/v0.6.4...v0.7.0
|
|
174
188
|
[0.6.4]: https://github.com/ozandogrultan/opencode-quill/compare/v0.6.3...v0.6.4
|
package/README.md
CHANGED
|
@@ -90,7 +90,9 @@ A correction looks like this, with only ` → complete` dimmed:
|
|
|
90
90
|
or all-uppercase casing (`Cmplete` → `Complete`, `CMPLETE` → `COMPLETE`).
|
|
91
91
|
First-person contractions use a capital `I` in corrections and next-word
|
|
92
92
|
suggestions (`I'm`, `I'll`, `I've`, `I'd`). Lowercase contraction prefixes
|
|
93
|
-
are replaced on acceptance too (`i'v` → `I've`).
|
|
93
|
+
are replaced on acceptance too (`i'v` → `I've`). Typing the apostrophe
|
|
94
|
+
continues the word (`i'` offers `I'd`), and a word ending in an apostrophe
|
|
95
|
+
is never typo-corrected (`users'` stays as typed).
|
|
94
96
|
- **Learned casing is kept.** A word you usually capitalize mid-sentence is
|
|
95
97
|
suggested that way: `oz` shows ` → Ozan` and replaces the word, while `Oz`
|
|
96
98
|
completes with `an`.
|
|
@@ -199,8 +201,9 @@ Restart OpenCode after editing `cli.json`.
|
|
|
199
201
|
| `minSuggestedWordLength` | `number` | `0` | Minimum number of characters in a suggested word, for both prose and shell suggestions; `0` allows any length. |
|
|
200
202
|
| `acceptKeys` | `string[]` | `["tab", "right"]` | Keys that accept and insert the active word suggestion. |
|
|
201
203
|
| `dismissKeys` | `string[]` | `["escape"]` | Keys that dismiss the visible suggestion without inserting. |
|
|
202
|
-
| `cycleNextKeys` | `string[]` | `[]` |
|
|
203
|
-
| `cyclePreviousKeys` | `string[]` | `[]` |
|
|
204
|
+
| `cycleNextKeys` | `string[]` | `[]` | Opt-in keys for the next visible word suggestion, for example `["alt+n"]`. |
|
|
205
|
+
| `cyclePreviousKeys` | `string[]` | `[]` | Opt-in keys for the previous visible word suggestion, for example `["alt+p"]`. |
|
|
206
|
+
| `summonKeys` | `string[]` | `[]` | Opt-in keys to show candidates when no suggestion is visible, for example `["ctrl+y"]`. |
|
|
204
207
|
|
|
205
208
|
`completeAtLineEnd` uses prose context only up to the cursor while checking
|
|
206
209
|
code and attachment ranges across the full draft. It inserts only missing
|
|
@@ -209,12 +212,16 @@ replacements remain limited to chip-free draft ends. The suggestion must fit
|
|
|
209
212
|
the visible cursor row; it never overwrites the next line. Acceptance preserves
|
|
210
213
|
later lines, attachment metadata, host callbacks, and native undo/redo.
|
|
211
214
|
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
215
|
+
Quill shows one inline suggestion by default. Configure a cycle binding to
|
|
216
|
+
browse alternatives. A faint counter such as `1/3` shows which one is selected
|
|
217
|
+
when space allows. Cycling changes only the ghost text; Tab accepts the
|
|
218
|
+
selected suggestion. The list wraps and skips alternatives that do not fit on
|
|
219
|
+
the cursor row. Without a visible alternative, cycle keys fall through.
|
|
220
|
+
|
|
221
|
+
Summon is off by default. A configured summon key can show lower-confidence
|
|
222
|
+
candidates for the current draft when no suggestion is visible. It falls
|
|
223
|
+
through when Quill has no eligible candidate. Editing the draft or moving the
|
|
224
|
+
cursor resets the summoned list.
|
|
218
225
|
|
|
219
226
|
Custom keybindings can also be overridden using OpenCode's standard
|
|
220
227
|
`keybinds` map in `cli.json`:
|
|
@@ -222,10 +229,11 @@ Custom keybindings can also be overridden using OpenCode's standard
|
|
|
222
229
|
```jsonc
|
|
223
230
|
{
|
|
224
231
|
"keybinds": {
|
|
225
|
-
"quill.accept": "
|
|
232
|
+
"quill.accept": "tab",
|
|
226
233
|
"quill.dismiss": "ctrl+g",
|
|
227
234
|
"quill.next": "alt+n",
|
|
228
|
-
"quill.previous": "alt+p"
|
|
235
|
+
"quill.previous": "alt+p",
|
|
236
|
+
"quill.summon": "ctrl+y"
|
|
229
237
|
}
|
|
230
238
|
}
|
|
231
239
|
```
|
|
@@ -244,9 +252,8 @@ handlers remain in control. Dialogs and selections also suppress Quill.
|
|
|
244
252
|
- `/quill shell on` / `/quill shell off` — Set shell-mode autocomplete explicitly.
|
|
245
253
|
- `/quill clear casing` (alias `/quill reset casing`) — Forget only the learned word casing (`OpenCode`, `GitHub`), keeping the vocabulary and phrases.
|
|
246
254
|
- `/quill clear` (alias `/quill reset`) — Erase everything Quill has learned from your prompts and shell commands.
|
|
247
|
-
- `quill.next` / `quill.previous` — Keymap commands for cycling
|
|
248
|
-
|
|
249
|
-
OpenCode's `keybinds` map.
|
|
255
|
+
- `quill.next` / `quill.previous` / `quill.summon` — Keymap commands for cycling
|
|
256
|
+
or summoning word alternatives.
|
|
250
257
|
- **Command Palette (`Ctrl+P`)** — Includes **Word autocomplete: on/off** and
|
|
251
258
|
**Clear word autocomplete history**.
|
|
252
259
|
|
|
@@ -273,7 +280,7 @@ Quill learns from your own submitted prompts, never from assistant output:
|
|
|
273
280
|
syntax are never learned as adjacent.
|
|
274
281
|
- A word missing from the base vocabulary becomes suggestible only after it
|
|
275
282
|
has been seen more than once, and not while it is a prefix of a learned word
|
|
276
|
-
you use at least as often (`addr` yields to `addressed`).
|
|
283
|
+
you use at least three times as often (`addr` yields to `addressed`).
|
|
277
284
|
- Casing is learned from words written mid-sentence; sentence-initial
|
|
278
285
|
capitals are ignored.
|
|
279
286
|
|
|
@@ -286,8 +293,11 @@ Quill learns from your own submitted prompts, never from assistant output:
|
|
|
286
293
|
- **Current draft:** words already in the draft get a small boost.
|
|
287
294
|
- **Confidence gating:** a suggestion is shown only when it clears a
|
|
288
295
|
confidence threshold, which is stricter for next-word predictions than for
|
|
289
|
-
prefix completions
|
|
290
|
-
|
|
296
|
+
prefix completions and, in prose, for single-letter prefixes. If a typed
|
|
297
|
+
prose prefix of two or more letters is already a confident word, a longer
|
|
298
|
+
word is also offered when it scores at least 40% as high in the current
|
|
299
|
+
context (typing `local` offers `locally`). Shell mode shows nothing when
|
|
300
|
+
the typed command is already the most likely word.
|
|
291
301
|
- **Typo fallback:** when prefix completion is not confident enough, nearby
|
|
292
302
|
words are ranked with an edit penalty and a stricter confidence threshold.
|
|
293
303
|
Correction confidence is the edit-penalized model score. Suggestions must
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-quill",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "OpenCode prompt autocomplete: local n-gram word and next-word prediction shown as inline ghost text in the TUI composer, accepted with Tab.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -48,7 +48,8 @@
|
|
|
48
48
|
"test:changelog": "bash tests/changelog.sh",
|
|
49
49
|
"typecheck": "tsc --noEmit",
|
|
50
50
|
"lint:sh": "for script in install.sh tests/*.sh scripts/*.sh; do bash -n \"$script\" || exit; done",
|
|
51
|
-
"prepublishOnly": "bun run test && bun run typecheck"
|
|
51
|
+
"prepublishOnly": "bun run test && bun run typecheck",
|
|
52
|
+
"eval": "bun scripts/eval.ts"
|
|
52
53
|
},
|
|
53
54
|
"dependencies": {
|
|
54
55
|
"@opentui/core": "^0.9.7",
|
package/src/ghost.ts
CHANGED
|
@@ -42,7 +42,7 @@ export function findComposer(marker: Renderable | undefined, isEditor: (node: Re
|
|
|
42
42
|
export class ComposerGhost {
|
|
43
43
|
private shown: { text: string; offset: number; prediction: Prediction; marks: string; revision: number; predictor: WordPredictor } | undefined
|
|
44
44
|
private dismissed: { text: string; offset: number } | undefined
|
|
45
|
-
private memo: { text: string; offset: number; marks: string; revision: number; predictor: WordPredictor; predictions: Prediction[]; index: number } | undefined
|
|
45
|
+
private memo: { text: string; offset: number; marks: string; revision: number; predictor: WordPredictor; predictions: Prediction[]; index: number; summoned: boolean } | undefined
|
|
46
46
|
private disposed = false
|
|
47
47
|
private readonly draw: (buffer: OptimizedBuffer, delta: number) => void
|
|
48
48
|
|
|
@@ -54,6 +54,7 @@ export class ComposerGhost {
|
|
|
54
54
|
private readonly renderer: CliRenderer,
|
|
55
55
|
private readonly completeAtLineEnd = false,
|
|
56
56
|
private readonly shellPredictor?: WordPredictor,
|
|
57
|
+
private readonly showAlternativeCounter = () => false,
|
|
57
58
|
) {
|
|
58
59
|
this.draw = (buffer) => { if (!this.disposed) this.paint(buffer) }
|
|
59
60
|
renderer.addPostProcessFn(this.draw)
|
|
@@ -110,14 +111,14 @@ export class ComposerGhost {
|
|
|
110
111
|
if ((marks.length || offset !== text.length) && predictions[0]?.replace) predictions.length = 0
|
|
111
112
|
else if (marks.length || offset !== text.length) predictions.splice(0, predictions.length, ...predictions.filter((prediction) => !prediction.replace))
|
|
112
113
|
const last = this.shown
|
|
113
|
-
if (query && !query.next && offset === text.length && last && last.offset === last.text.length && this.memo?.index === 0 && last.revision === revision && last.predictor === predictor && last.marks === signature && !last.prediction.replace && text.startsWith(last.text)) {
|
|
114
|
+
if (query && !query.next && offset === text.length && last && last.offset === last.text.length && this.memo?.index === 0 && !this.memo.summoned && last.revision === revision && last.predictor === predictor && last.marks === signature && !last.prediction.replace && text.startsWith(last.text)) {
|
|
114
115
|
const typed = text.slice(last.text.length)
|
|
115
116
|
if (typed && last.prediction.suffix.startsWith(typed) && typed.length < last.prediction.suffix.length) {
|
|
116
117
|
const sticky = { ...last.prediction, suffix: last.prediction.suffix.slice(typed.length) }
|
|
117
118
|
predictions.splice(0, predictions.length, sticky, ...predictions.filter((prediction) => prediction.word !== sticky.word))
|
|
118
119
|
}
|
|
119
120
|
}
|
|
120
|
-
this.memo = { text, offset, marks: signature, revision, predictor, predictions, index: 0 }
|
|
121
|
+
this.memo = { text, offset, marks: signature, revision, predictor, predictions, index: 0, summoned: false }
|
|
121
122
|
return predictions[0]
|
|
122
123
|
}
|
|
123
124
|
|
|
@@ -144,7 +145,19 @@ export class ComposerGhost {
|
|
|
144
145
|
const y = this.editor.screenY + cursor.visualRow
|
|
145
146
|
buffer.pushScissorRect(x, y, room, 1)
|
|
146
147
|
try {
|
|
147
|
-
|
|
148
|
+
const color = this.color()
|
|
149
|
+
buffer.drawText(ghost, x, y, color, this.editor.backgroundColor)
|
|
150
|
+
const memo = this.memo!
|
|
151
|
+
if (memo.predictions.length > 1 && this.showAlternativeCounter()) {
|
|
152
|
+
const fitting = memo.predictions.filter((candidate) => this.fits(candidate))
|
|
153
|
+
if (fitting.length > 1) {
|
|
154
|
+
const counter = ` ${fitting.indexOf(prediction) + 1}/${fitting.length}`
|
|
155
|
+
const width = this.editor.editBuffer.measureText(ghost)
|
|
156
|
+
if (width + this.editor.editBuffer.measureText(counter) <= room) {
|
|
157
|
+
buffer.drawText(counter, x + width, y, dimGhostColor(color), this.editor.backgroundColor)
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
148
161
|
} finally {
|
|
149
162
|
buffer.popScissorRect()
|
|
150
163
|
}
|
|
@@ -186,6 +199,25 @@ export class ComposerGhost {
|
|
|
186
199
|
return this.visible() && this.memo!.predictions.some((prediction, index) => index !== this.memo!.index && this.fits(prediction))
|
|
187
200
|
}
|
|
188
201
|
|
|
202
|
+
summon(): boolean {
|
|
203
|
+
if (this.disposed || this.visible() || !eligibleComposer(this.view())) return false
|
|
204
|
+
const text = this.editor.plainText
|
|
205
|
+
const offset = this.offset()
|
|
206
|
+
const automatic = this.prediction(text, offset)
|
|
207
|
+
if (automatic && this.fits(automatic)) return false
|
|
208
|
+
const predictor = this.active()
|
|
209
|
+
const marks = this.editor.extmarks.getAll()
|
|
210
|
+
const query = completionQuery(text, offset, this.protectedRanges(marks), this.completeAtLineEnd, predictor.grammar)
|
|
211
|
+
if (!query) return false
|
|
212
|
+
const predictions = predictor.candidates(query, 5, true).filter((prediction) =>
|
|
213
|
+
(!(marks.length || offset !== text.length) || !prediction.replace) && this.fits(prediction))
|
|
214
|
+
if (!predictions.length) return false
|
|
215
|
+
this.dismissed = undefined
|
|
216
|
+
this.memo = { text, offset, marks: this.marksKey(), revision: predictor.modelRevision, predictor, predictions, index: 0, summoned: true }
|
|
217
|
+
this.editor.requestRender()
|
|
218
|
+
return true
|
|
219
|
+
}
|
|
220
|
+
|
|
189
221
|
cycle(direction: 1 | -1): boolean {
|
|
190
222
|
if (!this.canCycle()) return false
|
|
191
223
|
const memo = this.memo!
|
package/src/keymap.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { KeymapLayer } from "@opencode/plugin/tui/context"
|
|
2
2
|
import type { Options } from "./options"
|
|
3
3
|
|
|
4
|
-
type Suggestion = { visible(): boolean; accept(): boolean; dismiss(): boolean; canCycle(): boolean; cycle(direction: 1 | -1): boolean }
|
|
4
|
+
type Suggestion = { visible(): boolean; accept(): boolean; dismiss(): boolean; canCycle(): boolean; cycle(direction: 1 | -1): boolean; summon(): boolean }
|
|
5
5
|
|
|
6
6
|
export function completionLayer(options: Options, suggestion: () => Suggestion | undefined): KeymapLayer {
|
|
7
7
|
return {
|
|
@@ -29,6 +29,12 @@ export function completionLayer(options: Options, suggestion: () => Suggestion |
|
|
|
29
29
|
enabled: () => suggestion()?.canCycle() === true,
|
|
30
30
|
run: () => suggestion()?.cycle(direction) ? undefined : false,
|
|
31
31
|
})),
|
|
32
|
+
{
|
|
33
|
+
id: "quill.summon",
|
|
34
|
+
title: "Summon word suggestions",
|
|
35
|
+
bind: options.summonKeys.length ? options.summonKeys.join(",") : false,
|
|
36
|
+
run: () => suggestion()?.summon() ? undefined : false,
|
|
37
|
+
},
|
|
32
38
|
],
|
|
33
39
|
}
|
|
34
40
|
}
|
package/src/options.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type Options = { enabled: boolean; completeAtLineEnd: boolean; completeShell: boolean; minSuggestedWordLength: number; acceptKeys: string[]; dismissKeys: string[]; cycleNextKeys: string[]; cyclePreviousKeys: string[] }
|
|
1
|
+
export type Options = { enabled: boolean; completeAtLineEnd: boolean; completeShell: boolean; minSuggestedWordLength: number; acceptKeys: string[]; dismissKeys: string[]; cycleNextKeys: string[]; cyclePreviousKeys: string[]; summonKeys: string[] }
|
|
2
2
|
|
|
3
3
|
function keys(value: unknown, fallback: string[], name: string): string[] {
|
|
4
4
|
if (value === undefined) return fallback
|
|
@@ -22,6 +22,7 @@ export function resolveOptions(input: Readonly<Record<string, unknown>>): Option
|
|
|
22
22
|
dismissKeys: keys(input.dismissKeys, ["escape"], "dismissKeys"),
|
|
23
23
|
cycleNextKeys: keys(input.cycleNextKeys, [], "cycleNextKeys"),
|
|
24
24
|
cyclePreviousKeys: keys(input.cyclePreviousKeys, [], "cyclePreviousKeys"),
|
|
25
|
+
summonKeys: keys(input.summonKeys, [], "summonKeys"),
|
|
25
26
|
}
|
|
26
27
|
}
|
|
27
28
|
|
package/src/predictor.ts
CHANGED
|
@@ -14,6 +14,10 @@ export type Prompt = { id: string; text: string }
|
|
|
14
14
|
export type Prediction = { suffix: string; word: string; confidence: number; replace?: number }
|
|
15
15
|
|
|
16
16
|
const DISCOUNT = 0.5
|
|
17
|
+
const CONFIDENCE = 0.3
|
|
18
|
+
const SHORT_CONFIDENCE = 0.4
|
|
19
|
+
const EXACT_RATIO = 0.4
|
|
20
|
+
const FRAGMENT_RATIO = 3
|
|
17
21
|
const MIN_TYPO_SCORE = 0.000001
|
|
18
22
|
const PRIOR_LIMIT = 20_000
|
|
19
23
|
const WORD_LIMIT = 8000
|
|
@@ -240,7 +244,7 @@ export class WordPredictor {
|
|
|
240
244
|
const word = learned[index]
|
|
241
245
|
if (this.prior.has(word)) continue
|
|
242
246
|
for (let next = index + 1; next < learned.length && learned[next].startsWith(word); next++) {
|
|
243
|
-
if (!"/-.".includes(learned[next][word.length]) && counts.get(learned[next])! >= counts.get(word)!) {
|
|
247
|
+
if (!"/-.".includes(learned[next][word.length]) && counts.get(learned[next])! >= (this.grammar.prose ? FRAGMENT_RATIO : 1) * counts.get(word)!) {
|
|
244
248
|
fragments.add(word)
|
|
245
249
|
break
|
|
246
250
|
}
|
|
@@ -329,7 +333,7 @@ export class WordPredictor {
|
|
|
329
333
|
return resolved
|
|
330
334
|
}
|
|
331
335
|
|
|
332
|
-
candidates(query: CompletionQuery, limit = 5): Prediction[] {
|
|
336
|
+
candidates(query: CompletionQuery, limit = 5, summoned = false): Prediction[] {
|
|
333
337
|
const maximum = Number.isFinite(limit) ? Math.max(0, Math.min(5, Math.floor(limit))) : 5
|
|
334
338
|
if (!maximum) return []
|
|
335
339
|
const prefix = this.grammar.normalize(query.prefix)
|
|
@@ -368,12 +372,23 @@ export class WordPredictor {
|
|
|
368
372
|
if (this.minSuggestedWordLength && word !== prefix && [...word].length < this.minSuggestedWordLength) continue
|
|
369
373
|
ranked.push({ word, score, weight })
|
|
370
374
|
ranked.sort((a, b) => b.score - a.score)
|
|
371
|
-
if (ranked.length > maximum) ranked.pop()
|
|
375
|
+
if (ranked.length > maximum + (this.grammar.prose && candidates.has(prefix) && !query.next ? 1 : 0)) ranked.pop()
|
|
372
376
|
}
|
|
373
377
|
const predictions: Prediction[] = []
|
|
378
|
+
const exact = query.next ? 0 : ranked.find(({ word }) => word === prefix)?.score ?? 0
|
|
379
|
+
const short = [...prefix].length < 2
|
|
380
|
+
const threshold = this.grammar.prose && short ? SHORT_CONFIDENCE : CONFIDENCE
|
|
381
|
+
const exactConfident = this.grammar.prose && !short && exact >= threshold * (sum || 1)
|
|
374
382
|
for (const { word: best, score: bestScore, weight: bestWeight } of ranked) {
|
|
383
|
+
if (best === prefix && !query.next) {
|
|
384
|
+
if (!this.grammar.prose && !predictions.length) return []
|
|
385
|
+
continue
|
|
386
|
+
}
|
|
375
387
|
const confidence = bestWeight < 1 ? typoConfidence(bestScore, sum) : query.next ? bestScore : bestScore / (sum || 1)
|
|
376
|
-
|
|
388
|
+
const gate = query.next
|
|
389
|
+
? bestScore >= CONFIDENCE
|
|
390
|
+
: confidence! >= threshold || (exactConfident && bestScore >= EXACT_RATIO * exact)
|
|
391
|
+
if (!bestScore || confidence === undefined || (bestWeight === 1 && !gate && !summoned)) {
|
|
377
392
|
if (!predictions.length) return []
|
|
378
393
|
continue
|
|
379
394
|
}
|
|
@@ -389,10 +404,10 @@ export class WordPredictor {
|
|
|
389
404
|
predictions.push({ suffix: shouting ? suffix.toUpperCase() : suffix, word: best, confidence })
|
|
390
405
|
}
|
|
391
406
|
}
|
|
392
|
-
return predictions
|
|
407
|
+
return predictions.slice(0, maximum)
|
|
393
408
|
}
|
|
394
409
|
const completion = suggest()
|
|
395
|
-
if (completion.length || query.next || prefix.length < 3 || slash || candidates.has(prefix) || !this.grammar.prose) return completion
|
|
410
|
+
if (completion.length || query.next || prefix.length < 3 || slash || prefix.endsWith("'") || candidates.has(prefix) || !this.grammar.prose) return completion
|
|
396
411
|
for (const word of this.nearbyWords(prefix)) {
|
|
397
412
|
if (candidates.has(word)) continue
|
|
398
413
|
const weight = typoWeight(prefix, word)
|
package/src/prose.ts
CHANGED
|
@@ -2,7 +2,7 @@ const PART = "[\\p{L}\\p{M}]+(?:['’][\\p{L}\\p{M}]+)*"
|
|
|
2
2
|
const HYPHENATED = `${PART}(?:-${PART})*`
|
|
3
3
|
const EXTENSION = "(?:sh|md|json|jsonc|ts|tsx|js|jsx|mjs|cjs|yml|yaml|toml|lock|html|css|py|txt|rs|go|sql)"
|
|
4
4
|
const FILE = `${HYPHENATED}\\.${EXTENSION}`
|
|
5
|
-
const PREFIX = `(?:${FILE}|${HYPHENATED}
|
|
5
|
+
const PREFIX = `(?:${FILE}|${HYPHENATED}(?:['’]|-?(?:\\/(?:${HYPHENATED}-?)?)?))`
|
|
6
6
|
const WORD = new RegExp(`(?:${FILE}(?![\\p{L}\\p{M}\\p{N}])|${HYPHENATED}(?:\\/${HYPHENATED})?)`, "gu")
|
|
7
7
|
const WHOLE_WORD = new RegExp(`^(?:${FILE}|${HYPHENATED}(?:\\/${HYPHENATED})?)$`, "u")
|
|
8
8
|
const WORD_PREFIX = new RegExp(`^${PREFIX}$`, "u")
|
package/src/tui.tsx
CHANGED
|
@@ -71,7 +71,8 @@ export default Plugin.define({
|
|
|
71
71
|
selected: context.renderer.hasSelection,
|
|
72
72
|
enabled: !disposed && settings.enabled && (!shell || shellEnabled()) && currentEditor() === editor,
|
|
73
73
|
}
|
|
74
|
-
}, () => dimGhostColor(context.theme.text.muted), context.renderer, options.completeAtLineEnd, shellPredictor
|
|
74
|
+
}, () => dimGhostColor(context.theme.text.muted), context.renderer, options.completeAtLineEnd, shellPredictor,
|
|
75
|
+
() => ["quill.next", "quill.previous"].some((id) => context.keymap.shortcuts(id).length > 0))
|
|
75
76
|
}
|
|
76
77
|
|
|
77
78
|
const sessionInfo = (sessionID: string) =>
|