feat/preview #3
|
@ -110,11 +110,16 @@ async function autocompleteCommand(textEditor: vscode.TextEditor, cancellationTo
|
||||||
|
|
||||||
// Split the completion text by new lines
|
// Split the completion text by new lines
|
||||||
const lines = completionText.split('\n');
|
const lines = completionText.split('\n');
|
||||||
|
|
||||||
// Create a decoration for each line of the response
|
// Create a decoration for each line of the response
|
||||||
const previewRanges = lines.map((line: string, idx: number) => {
|
const previewRanges = lines.map((line: string, idx: number) => {
|
||||||
const linePos = new vscode.Position(position.line + idx, 0);
|
// Determine the start and end positions for each line
|
||||||
const range = new vscode.Range(linePos, linePos); // Set range at the start of each new line
|
const startPos = new vscode.Position(position.line + idx, 0);
|
||||||
|
const endPos = new vscode.Position(position.line + idx, line.length);
|
||||||
|
|
||||||
|
// Create a range covering the whole line
|
||||||
|
const range = new vscode.Range(startPos, endPos);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
range,
|
range,
|
||||||
renderOptions: {
|
renderOptions: {
|
||||||
|
@ -126,7 +131,7 @@ async function autocompleteCommand(textEditor: vscode.TextEditor, cancellationTo
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
// Apply the decorations for multiline preview
|
// Apply the decorations for multiline preview
|
||||||
textEditor.setDecorations(previewDecorationType, previewRanges);
|
textEditor.setDecorations(previewDecorationType, previewRanges);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue