From 1fbe8ec4f8d972e3780ec9f1e406cc80f8e42232 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Tetsing?= Date: Mon, 17 Jun 2024 14:06:05 +0200 Subject: [PATCH] minors --- apps/remix-ide/src/app/plugins/solcoderAI.tsx | 2 +- .../src/lib/providers/documentationProvider.ts | 2 -- libs/remix-ui/editor/src/lib/remix-ui-editor.tsx | 12 ++++++------ 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/apps/remix-ide/src/app/plugins/solcoderAI.tsx b/apps/remix-ide/src/app/plugins/solcoderAI.tsx index 82eedb3e29..609c47032e 100644 --- a/apps/remix-ide/src/app/plugins/solcoderAI.tsx +++ b/apps/remix-ide/src/app/plugins/solcoderAI.tsx @@ -50,7 +50,7 @@ export class SolCoder extends Plugin { pushChatHistory(prompt, result){ const chat:ChatEntry = [prompt, result.data[0]] this.solgpt_chat_history.push(chat) - if (this.solgpt_chat_history.length >this.max_history){this.solgpt_chat_history.shift()} + if (this.solgpt_chat_history.length > this.max_history){this.solgpt_chat_history.shift()} } async code_generation(prompt): Promise { diff --git a/libs/remix-ui/editor/src/lib/providers/documentationProvider.ts b/libs/remix-ui/editor/src/lib/providers/documentationProvider.ts index 0450339124..3998ce8fb3 100644 --- a/libs/remix-ui/editor/src/lib/providers/documentationProvider.ts +++ b/libs/remix-ui/editor/src/lib/providers/documentationProvider.ts @@ -14,8 +14,6 @@ export class RemixSolidityDocumentationProvider implements monacoTypes.languages const item: monacoTypes.languages.InlineCompletion = { insertText: this.completion }; - console.log("provided docu completion") - return { items: [item], enableForwardStability: true diff --git a/libs/remix-ui/editor/src/lib/remix-ui-editor.tsx b/libs/remix-ui/editor/src/lib/remix-ui-editor.tsx index 78f18b5e81..7805223b87 100644 --- a/libs/remix-ui/editor/src/lib/remix-ui-editor.tsx +++ b/libs/remix-ui/editor/src/lib/remix-ui-editor.tsx @@ -739,12 +739,12 @@ export const EditorUI = (props: EditorUIProps) => { const message = intl.formatMessage({ id: 'editor.generateDocumentationByAI' }, { content, currentFunction: currentFunction.current }) const cm = await props.plugin.call('solcoder', 'code_explaining', message) - const natspecCom = "\n" + extractNatspecComments(cm) + const natSpecCom = "\n" + extractNatspecComments(cm) const cln = await props.plugin.call('codeParser', "getLineColumnOfNode", currenFunctionNode) const range = new monacoRef.current.Range(cln.start.line, cln.start.column, cln.start.line, cln.start.column) - const lines = natspecCom.split('\n') - const newnatspeccom = [] + const lines = natSpecCom.split('\n') + const newNatSpecCom = [] for (let i = 0; i < lines.length; i++) { let cont = false @@ -757,8 +757,8 @@ export const EditorUI = (props: EditorUIProps) => { } if (cont) {continue} - if (i <= 1) { newnatspeccom.push(' '.repeat(cln.start.column) + lines[i].trimStart()) } - else { newnatspeccom.push(' '.repeat(cln.start.column + 1) + lines[i].trimStart()) } + if (i <= 1) { newNatSpecCom.push(' '.repeat(cln.start.column) + lines[i].trimStart()) } + else { newNatSpecCom.push(' '.repeat(cln.start.column + 1) + lines[i].trimStart()) } } // TODO: activate the provider to let the user accept the documentation suggestion @@ -768,7 +768,7 @@ export const EditorUI = (props: EditorUIProps) => { editor.executeEdits('clipboard', [ { range: range, - text: newnatspeccom.join('\n'), + text: newNatSpecCom.join('\n'), forceMoveMarkers: true, }, ]);