remove excessive console logs in suggestion service and workspacetemplate

pull/5370/head
Joseph Izang 1 year ago
parent 68c3e07144
commit d8d5dd49eb
  1. 5
      apps/remix-ide/src/app/plugins/copilot/suggestion-service/copilot-suggestion.ts
  2. 8
      apps/remix-ide/src/app/plugins/copilot/suggestion-service/suggestion-service.ts
  3. 20
      apps/vyper/src/app/components/CompilerButton.tsx

@ -1,5 +1,6 @@
import {Plugin} from '@remixproject/engine' import {Plugin} from '@remixproject/engine'
import {SuggestionService, SuggestOptions} from './suggestion-service' import {SuggestionService, SuggestOptions} from './suggestion-service'
//@ts-ignore
const _paq = (window._paq = window._paq || []) //eslint-disable-line const _paq = (window._paq = window._paq || []) //eslint-disable-line
const profile = { const profile = {
@ -26,7 +27,7 @@ export class CopilotSuggestion extends Plugin {
}) })
this.service.events.on('ready', (data) => { this.service.events.on('ready', (data) => {
this.ready = true this.ready = true
}) })
} }
status () { status () {
@ -64,7 +65,7 @@ export class CopilotSuggestion extends Plugin {
importsContent += '\n\n' + (await this.call('contentImport', 'resolve', imp)).content importsContent += '\n\n' + (await this.call('contentImport', 'resolve', imp)).content
} catch (e) { } catch (e) {
console.log(e) console.log(e)
} }
} }
return importsContent return importsContent
} }

@ -58,11 +58,11 @@ export class SuggestionService {
this.responses[e.data.id](null, e.data) this.responses[e.data.id](null, e.data)
} else { } else {
this.responses[e.data.id]('aborted') this.responses[e.data.id]('aborted')
} }
delete this.responses[e.data.id] delete this.responses[e.data.id]
this.current = null this.current = null
} }
// Generation complete: re-enable the "Generate" button // Generation complete: re-enable the "Generate" button
break; break;
} }
@ -95,6 +95,6 @@ export class SuggestionService {
if (error) return reject(error) if (error) return reject(error)
resolve(result) resolve(result)
} }
}) })
} }
} }

@ -24,7 +24,7 @@ function CompilerButton({contract, setOutput, compilerUrl, resetCompilerState}:
async function compileContract() { async function compileContract() {
resetCompilerState() resetCompilerState()
try { try {
await remixClient.discardHighlight() // await remixClient.discardHighlight()
let _contract: any let _contract: any
try { try {
_contract = await remixClient.getContract() _contract = await remixClient.getContract()
@ -73,27 +73,27 @@ function CompilerButton({contract, setOutput, compilerUrl, resetCompilerState}:
start: {line: line - 1, column: 10}, start: {line: line - 1, column: 10},
end: {line: line - 1, column: 10} end: {line: line - 1, column: 10}
} }
remixClient.highlight(lineColumnPos as any, _contract.name, '#e0b4b4') // remixClient.highlight(lineColumnPos as any, _contract.name, '#e0b4b4')
} else { } else {
const regex = output.message.match(/line ((\d+):(\d+))+/g) const regex = output?.message?.match(/line ((\d+):(\d+))+/g)
const errors = output.message.split(/line ((\d+):(\d+))+/g) // extract error message const errors = output?.message?.split(/line ((\d+):(\d+))+/g) // extract error message
if (regex) { if (regex) {
let errorIndex = 0 let errorIndex = 0
regex.map((errorLocation) => { regex.map((errorLocation) => {
const location = errorLocation.replace('line ', '').split(':') const location = errorLocation?.replace('line ', '').split(':')
let message = errors[errorIndex] let message = errors[errorIndex]
errorIndex = errorIndex + 4 errorIndex = errorIndex + 4
if (message && message.split('\n\n').length > 0) { if (message && message?.split('\n\n').length > 0) {
try { try {
message = message.split('\n\n')[message.split('\n\n').length - 1] message = message?.split('\n\n')[message.split('\n\n').length - 1]
} catch (e) {} } catch (e) {}
} }
if (location.length > 0) { if (location?.length > 0) {
const lineColumnPos = { const lineColumnPos = {
start: {line: parseInt(location[0]) - 1, column: 10}, start: {line: parseInt(location[0]) - 1, column: 10},
end: {line: parseInt(location[0]) - 1, column: 10} end: {line: parseInt(location[0]) - 1, column: 10}
} }
remixClient.highlight(lineColumnPos as any, _contract.name, message) // remixClient.highlight(lineColumnPos as any, _contract.name, message)
} }
}) })
} }
@ -101,7 +101,7 @@ function CompilerButton({contract, setOutput, compilerUrl, resetCompilerState}:
throw new Error(output.message) throw new Error(output.message)
} }
// SUCCESS // SUCCESS
remixClient.discardHighlight() // remixClient.discardHighlight()
remixClient.changeStatus({ remixClient.changeStatus({
key: 'succeed', key: 'succeed',
type: 'success', type: 'success',

Loading…
Cancel
Save