cleaned completion result

pull/5370/head
Stéphane Tetsing 9 months ago
parent da343ef1fa
commit 9874dbf4cb
  1. 3
      libs/remix-ui/editor/src/lib/providers/inlineCompletionProvider.ts

@ -84,7 +84,6 @@ export class RemixInLineCompletionProvider implements monacoTypes.languages.Inli
let result let result
try { try {
console.log('processing completion', word)
result = await this.props.plugin.call('copilot-suggestion', 'suggest', word) result = await this.props.plugin.call('copilot-suggestion', 'suggest', word)
const generatedText = (result as any).output[0].generated_text as string const generatedText = (result as any).output[0].generated_text as string
let clean = generatedText let clean = generatedText
@ -93,9 +92,7 @@ export class RemixInLineCompletionProvider implements monacoTypes.languages.Inli
clean = generatedText.replace('@custom:dev-run-script', '@custom:dev-run-script ') clean = generatedText.replace('@custom:dev-run-script', '@custom:dev-run-script ')
} }
clean = clean.replace(word, '').trimStart() clean = clean.replace(word, '').trimStart()
console.log('completion', clean, clean.split('\n')[0])
clean = clean.split('\n')[0].startsWith('\n') ? [clean.split('\n')[0], clean.split('\n')[1]].join('\n'): clean.split('\n')[0] clean = clean.split('\n')[0].startsWith('\n') ? [clean.split('\n')[0], clean.split('\n')[1]].join('\n'): clean.split('\n')[0]
console.log('completion after ', clean)
const item: monacoTypes.languages.InlineCompletion = { const item: monacoTypes.languages.InlineCompletion = {
insertText: clean insertText: clean

Loading…
Cancel
Save