pull/4884/head
Stéphane Tetsing 5 months ago committed by Aniket
parent 50814f91a3
commit 1fbe8ec4f8
  1. 2
      apps/remix-ide/src/app/plugins/solcoderAI.tsx
  2. 2
      libs/remix-ui/editor/src/lib/providers/documentationProvider.ts
  3. 12
      libs/remix-ui/editor/src/lib/remix-ui-editor.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<any> {

@ -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

@ -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,
},
]);

Loading…
Cancel
Save