pull/5370/head
filip mertens 2 years ago
parent b6b41b185e
commit 5b3c2652f4
  1. 6
      apps/remix-ide/src/app/plugins/parser/code-parser.tsx
  2. 4
      apps/remix-ide/src/app/plugins/parser/services/code-parser-antlr-service.ts

@ -73,7 +73,7 @@ export class CodeParser extends Plugin {
getLastNodeInLine: (ast: string) => Promise<any> getLastNodeInLine: (ast: string) => Promise<any>
listAstNodes: () => Promise<any> listAstNodes: () => Promise<any>
getANTLRBlockAtPosition: (position: any, text?: string) => Promise<any> getANTLRBlockAtPosition: (position: any, text?: string) => Promise<any>
getCurrentFileAST: (text?: string) => Promise<ParseResult> setCurrentFileAST: (text?: string) => Promise<ParseResult>
constructor(astWalker: any) { constructor(astWalker: any) {
super(profile) super(profile)
@ -109,7 +109,7 @@ export class CodeParser extends Plugin {
this.getLastNodeInLine = this.antlrService.getLastNodeInLine.bind(this.antlrService) this.getLastNodeInLine = this.antlrService.getLastNodeInLine.bind(this.antlrService)
this.listAstNodes = this.antlrService.listAstNodes.bind(this.antlrService) this.listAstNodes = this.antlrService.listAstNodes.bind(this.antlrService)
this.getANTLRBlockAtPosition = this.antlrService.getANTLRBlockAtPosition.bind(this.antlrService) this.getANTLRBlockAtPosition = this.antlrService.getANTLRBlockAtPosition.bind(this.antlrService)
this.getCurrentFileAST = this.antlrService.getCurrentFileAST.bind(this.antlrService) this.setCurrentFileAST = this.antlrService.setCurrentFileAST.bind(this.antlrService)
this.on('editor', 'didChangeFile', async (file) => { this.on('editor', 'didChangeFile', async (file) => {
@ -126,7 +126,7 @@ export class CodeParser extends Plugin {
await this.call('editor', 'discardLineTexts') await this.call('editor', 'discardLineTexts')
const completionSettings = await this.call('config', 'getAppParameter', 'auto-completion') const completionSettings = await this.call('config', 'getAppParameter', 'auto-completion')
if (completionSettings) { if (completionSettings) {
this.antlrService.getCurrentFileAST() this.antlrService.setCurrentFileAST()
} }
await this.handleChangeEvents() await this.handleChangeEvents()
}) })

@ -85,7 +85,7 @@ export default class CodeParserAntlrService {
enableWorker() { enableWorker() {
if (!this.workerTimer) { if (!this.workerTimer) {
this.workerTimer = setInterval(() => { this.workerTimer = setInterval(() => {
this.getCurrentFileAST() this.setCurrentFileAST()
}, 5000) }, 5000)
} }
} }
@ -118,7 +118,7 @@ export default class CodeParserAntlrService {
* @param text * @param text
* @returns * @returns
*/ */
async getCurrentFileAST(text: string | null = null) { async setCurrentFileAST(text: string | null = null) {
try { try {
this.plugin.currentFile = await this.plugin.call('fileManager', 'file') this.plugin.currentFile = await this.plugin.call('fileManager', 'file')
if (this.plugin.currentFile && this.plugin.currentFile.endsWith('.sol')) { if (this.plugin.currentFile && this.plugin.currentFile.endsWith('.sol')) {

Loading…
Cancel
Save