From d3423fc71194a6c3675af6cc3e65af321c2b659e Mon Sep 17 00:00:00 2001 From: filip mertens Date: Thu, 22 Sep 2022 10:09:27 +0200 Subject: [PATCH] fix comments --- .../parser/services/code-parser-antlr-service.ts | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/apps/remix-ide/src/app/plugins/parser/services/code-parser-antlr-service.ts b/apps/remix-ide/src/app/plugins/parser/services/code-parser-antlr-service.ts index 937420b452..f8f8ba0de5 100644 --- a/apps/remix-ide/src/app/plugins/parser/services/code-parser-antlr-service.ts +++ b/apps/remix-ide/src/app/plugins/parser/services/code-parser-antlr-service.ts @@ -69,13 +69,13 @@ export default class CodeParserAntlrService { } setFileParsingState(file: string, duration: number) { - + if (this.cache[file]) { if (this.cache[file].blockDuration) { - if(this.cache[file].blockDuration > this.parserTreshHold && duration > this.parserTreshHold) { + if (this.cache[file].blockDuration > this.parserTreshHold && duration > this.parserTreshHold) { this.cache[file].parsingEnabled = false this.plugin.call('notification', 'toast', `This file is big so some autocomplete features will be disabled.`) - } else{ + } else { this.cache[file].parsingEnabled = true } } @@ -122,7 +122,6 @@ export default class CodeParserAntlrService { try { this.plugin.currentFile = await this.plugin.call('fileManager', 'file') if (this.plugin.currentFile && this.plugin.currentFile.endsWith('.sol')) { - if (!this.plugin.currentFile) return const fileContent = text || await this.plugin.call('fileManager', 'readFile', this.plugin.currentFile) if (!this.cache[this.plugin.currentFile]) { this.cache[this.plugin.currentFile] = { @@ -137,8 +136,6 @@ export default class CodeParserAntlrService { } catch (e) { // do nothing } - } else { - // do nothing } } } catch (e) { @@ -243,13 +240,12 @@ export default class CodeParserAntlrService { } } if (this.plugin.currentFile && this.plugin.currentFile.endsWith('.sol')) { - if (!this.plugin.currentFile) return const fileContent = text || await this.plugin.call('fileManager', 'readFile', this.plugin.currentFile) try { const startTime = Date.now() const blocks = (SolidityParser as any).parseBlock(fileContent, { loc: true, range: true, tolerant: true }) this.setFileParsingState(this.plugin.currentFile, Date.now() - startTime) - if(blocks) this.cache[this.plugin.currentFile].blocks = blocks + if (blocks) this.cache[this.plugin.currentFile].blocks = blocks return blocks } catch (e) { // do nothing