Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
3552d57
WiP ghost inline completion provider
beatlevic Oct 13, 2025
595ab38
WiP ghost completion. Make sure ghost completion XML is correctly par…
beatlevic Oct 13, 2025
85c36aa
Merge branch 'main' into beatlevic/inline-ghost-completion
beatlevic Oct 13, 2025
acae4ac
Merge branch 'main' into beatlevic/inline-ghost-completion
beatlevic Oct 14, 2025
9ad72b9
Merge branch 'main' into beatlevic/inline-ghost-completion
beatlevic Oct 14, 2025
0a022ca
Fixed ghost integration test with completedChanges
beatlevic Oct 14, 2025
bc2ea9d
Merge branch 'main' into beatlevic/inline-ghost-completion
beatlevic Oct 14, 2025
a12bd38
Removed more 'precise' regex, which was not the case
beatlevic Oct 14, 2025
60bc10c
Reverted prompt in auto trigger strategy to make sure we don't break …
beatlevic Oct 14, 2025
158d7eb
Now we have both SVG and inline ghost at the cursor
beatlevic Oct 15, 2025
661563c
Getting close, but still unstable newlines or missing newlines
beatlevic Oct 16, 2025
fc25a71
Merge branch 'main' into beatlevic/inline-ghost-completion
beatlevic Oct 16, 2025
0d1c5b5
Merge branch 'main' into beatlevic/inline-ghost-completion
beatlevic Oct 17, 2025
5d102d3
Merge branch 'main' into beatlevic/inline-ghost-completion
beatlevic Oct 17, 2025
634ba22
Merge branch 'main' into beatlevic/inline-ghost-completion
beatlevic Oct 20, 2025
366d14c
Cleanup
beatlevic Oct 20, 2025
188eaca
Added onlyAdditions boolean
beatlevic Oct 20, 2025
2f731af
Make sure inline completion is not repeating input for search and rep…
beatlevic Oct 20, 2025
e74a07a
Added more inline completion test cases
beatlevic Oct 20, 2025
6f2b6cb
Fix for on line ghost completion plus next lines. Also added test case
beatlevic Oct 20, 2025
d1c3c0d
Merge branch 'main' into beatlevic/inline-ghost-completion-additions-…
beatlevic Oct 20, 2025
0048271
Merge branch 'main' into beatlevic/inline-ghost-completion-additions-…
beatlevic Oct 20, 2025
1700ace
Added more test cases and fixed newline edge case
beatlevic Oct 20, 2025
96b6519
Added XML malformation check. And prune groups for duplicates.
beatlevic Oct 20, 2025
57cde26
Remove empty deletions and additions
beatlevic Oct 20, 2025
cabe8bc
Merge branch 'main' into beatlevic/inline-ghost-completion-additions-…
beatlevic Oct 20, 2025
75f5fab
Fixed GhostInlineCompletionProvider.spec.ts and remove empty delete
beatlevic Oct 20, 2025
5a02433
Fixed incorrect order parsing
beatlevic Oct 20, 2025
ebe8f8c
Fix to hide and cancel autocompletion when intellisence suggests changes
beatlevic Oct 20, 2025
00fb34b
Check if this is an addition group that should be combined with previ…
beatlevic Oct 20, 2025
a8bfa2a
Merge branch 'main' into beatlevic/inline-ghost-completion-additions-…
beatlevic Oct 20, 2025
bc45284
Fix for multiline modification
beatlevic Oct 21, 2025
2fb2a14
Don't add unnecessary newlines when on empty line
beatlevic Oct 21, 2025
e6ac3b6
Added test case for not adding extra newline when LLM response starts…
beatlevic Oct 21, 2025
9924149
Allow repeated comment labels to be suggested
beatlevic Oct 21, 2025
597657b
Added ruby test case
beatlevic Oct 21, 2025
284e67f
Cleanup GhostProvider by moving code to GhostInlineCompletionProvider
beatlevic Oct 21, 2025
5aa69c5
Removed extracted content check for XML tags in GhostStreamingParser
beatlevic Oct 21, 2025
fae434c
Revert GhostStreamingParser changes
beatlevic Oct 21, 2025
89ccbe3
Moved GhostInlineCompletionProvider.comment-prefix.spec.ts into Ghost…
beatlevic Oct 21, 2025
ce6370a
Removed obsolete handle malformed streaming data gracefully integrati…
beatlevic Oct 21, 2025
c2de5cb
Skipping newline test which requires better stream parser atm
beatlevic Oct 21, 2025
f03a8f6
Merge branch 'main' into beatlevic/inline-ghost-completion-additions-…
beatlevic Oct 21, 2025
4e35428
Fixed Ghost streaming parser test with new parser.parseResponse, and …
beatlevic Oct 21, 2025
1ab0c9c
Revert pnpm-lock.yaml
beatlevic Oct 21, 2025
a0f9931
Updated AUTOCOMPLETE_DESIGN doc
beatlevic Oct 21, 2025
cb3327c
Cleanup and improved readability of the GhostInlineCompletionProvider
beatlevic Oct 21, 2025
ebdcd43
Fix to make sure we update internal suggestion state when applying in…
beatlevic Oct 21, 2025
0ca44d9
Added more documentation for the complex inline completion functions
beatlevic Oct 21, 2025
f3fc5e2
Merge branch 'main' into beatlevic/inline-ghost-completion-additions-…
beatlevic Oct 21, 2025
a48032a
Merge branch 'main' into beatlevic/inline-ghost-completion-additions-…
beatlevic Oct 22, 2025
d2167b5
Don't pass this.suggestions twice
beatlevic Oct 22, 2025
9928c5a
Cleanup of try/catches
beatlevic Oct 22, 2025
73d5a9a
Removed addtionsOnly option. And disabled display(SVG)Decorations inl…
beatlevic Oct 22, 2025
729147c
Renamed hasCommonPrefix to isPrefix
beatlevic Oct 22, 2025
a146c14
Renamed filterEmptyDeletions to removeOperationsWithEmptyContent
beatlevic Oct 22, 2025
c36cc15
Renamed shouldShowGroup to shouldHandleGroupInline
beatlevic Oct 22, 2025
c2b7729
Cleanup of redundant inlineSuggest.hide
beatlevic Oct 22, 2025
c117a3f
Merge branch 'main' into beatlevic/inline-ghost-completion-additions-…
beatlevic Oct 22, 2025
27126f2
Revert prompt change in AutoTriggerStrategy
beatlevic Oct 22, 2025
4d02c6e
Merge branch 'main' into beatlevic/inline-ghost-completion-additions-…
beatlevic Oct 22, 2025
28c29e7
Fixed incorrect getGroupType logic
beatlevic Oct 22, 2025
a46c95b
Merge branch 'main' into beatlevic/inline-ghost-completion-additions-…
beatlevic Oct 23, 2025
944ef3f
Merge branch 'main' into beatlevic/inline-ghost-completion-additions-…
beatlevic Oct 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
53 changes: 39 additions & 14 deletions src/services/ghost/GhostDecorations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,23 +52,28 @@ export class GhostDecorations {

/**
* Display deletion operations using simple border styling
* Returns the range for accumulation
*/
private displayDeleteOperationGroup(editor: vscode.TextEditor, group: GhostSuggestionEditOperation[]): void {
private createDeleteOperationRange(editor: vscode.TextEditor, group: GhostSuggestionEditOperation[]): vscode.Range {
const lines = group.map((x) => x.oldLine)
const from = Math.min(...lines)
const to = Math.max(...lines)

const start = editor.document.lineAt(from).range.start
const end = editor.document.lineAt(to).range.end
const range = new vscode.Range(start, end)

editor.setDecorations(this.deletionDecorationType, [{ range }])
return new vscode.Range(start, end)
}

/**
* Display suggestions using hybrid approach: SVG for edits/additions, simple styling for deletions
* Shows all groups that should use decorations
* @param suggestions - The suggestions state
* @param skipGroupIndices - Array of group indices to skip (they're shown as inline completion)
*/
public async displaySuggestions(suggestions: GhostSuggestionsState): Promise<void> {
public async displaySuggestions(
suggestions: GhostSuggestionsState,
skipGroupIndices: number[] = [],
): Promise<void> {
const editor = vscode.window.activeTextEditor
if (!editor) {
return
Expand Down Expand Up @@ -97,19 +102,39 @@ export class GhostDecorations {
this.clearAll()
return
}
const selectedGroup = groups[selectedGroupIndex]
const groupType = suggestionsFile.getGroupType(selectedGroup)

// Clear previous decorations
this.clearAll()

// Route to appropriate display method
if (groupType === "/") {
await this.displayEditOperationGroup(editor, selectedGroup)
} else if (groupType === "-") {
this.displayDeleteOperationGroup(editor, selectedGroup)
} else if (groupType === "+") {
await this.displayAdditionsOperationGroup(editor, selectedGroup)
// Accumulate deletion ranges to apply all at once
const deletionRanges: vscode.Range[] = []

// Display each group based on whether it should use decorations
for (let i = 0; i < groups.length; i++) {
const group = groups[i]
const groupType = suggestionsFile.getGroupType(group)

// Skip groups that are using inline completion
if (skipGroupIndices.includes(i)) {
continue
}

// Show decoration for this group
if (groupType === "/") {
await this.displayEditOperationGroup(editor, group)
} else if (groupType === "-") {
deletionRanges.push(this.createDeleteOperationRange(editor, group))
} else if (groupType === "+") {
await this.displayAdditionsOperationGroup(editor, group)
}
}

// Apply all deletion decorations at once
if (deletionRanges.length > 0) {
editor.setDecorations(
this.deletionDecorationType,
deletionRanges.map((range) => ({ range })),
)
}
}

Expand Down
Loading