clearFileDecorators

flattentree
filip mertens 11 months ago
parent 77ebb1cb10
commit 92d230a0c0
  1. 6
      apps/remix-ide-e2e/src/tests/file_decorator.test.ts
  2. 32
      apps/remix-ide/src/app/plugins/parser/services/code-parser-compiler.ts
  3. 2
      libs/remix-ui/workspace/src/lib/components/flat-tree.tsx

@ -16,7 +16,7 @@ module.exports = {
.openFile('contracts/3_Ballot.sol')
.addFile('scripts/decorators.ts', { content: testScriptSet })
.pause(2000)
.executeScriptInTerminal('remix.exeCurrent()')
.click('[data-id="play-editor"]')
.pause(4000)
.useXpath()
.waitForElementContainsText('//*[@id="fileExplorerView"]//*[@data-id="file-decoration-error-contracts/2_Owner.sol"]', '2')
@ -37,7 +37,7 @@ module.exports = {
.useCss()
.addFile('scripts/clearballot.ts', { content: testScriptClearBallot })
.pause(2000)
.executeScriptInTerminal('remix.exeCurrent()')
.click('[data-id="play-editor"]')
.pause(4000)
.waitForElementNotPresent('[data-id="file-decoration-custom-contracts/3_Ballot.sol"]', 10000)
},
@ -45,7 +45,7 @@ module.exports = {
browser
.addFile('scripts/clearall.ts', { content: testScriptClear })
.pause(2000)
.executeScriptInTerminal('remix.exeCurrent()')
.click('[data-id="play-editor"]')
.pause(4000)
.waitForElementNotPresent('[data-id="file-decoration-error-contracts/2_Owner.sol"]', 10000)
.waitForElementNotPresent('[data-id="file-decoration-warning-contracts/1_Storage.sol"]', 10000)

@ -225,20 +225,10 @@ export default class CodeParserCompiler {
}
for (const fileName of filesWithOutErrors) {
const fileTarget = await this.plugin.call('fileManager', 'getPathFromUrl', fileName)
const decorator: fileDecoration = {
path: fileTarget.file,
isDirectory: false,
fileStateType: fileDecorationType.None,
fileStateLabelClass: '',
fileStateIconClass: '',
fileStateIcon: '',
text: '',
owner: 'code-parser',
bubble: false
}
decorators.push(decorator)
await this.plugin.call('fileDecorator', 'clearFileDecorators', fileTarget.file)
}
await this.plugin.call('fileDecorator', 'setFileDecorators', decorators)
if(decorators.length > 0)
await this.plugin.call('fileDecorator', 'setFileDecorators', decorators)
await this.plugin.call('editor', 'clearErrorMarkers', filesWithOutErrors)
}
@ -265,22 +255,8 @@ export default class CodeParserCompiler {
const decorators: fileDecoration[] = []
if (!sources) return
for (const fileName of Object.keys(sources)) {
const decorator: fileDecoration = {
path: fileName,
isDirectory: false,
fileStateType: fileDecorationType.None,
fileStateLabelClass: '',
fileStateIconClass: '',
fileStateIcon: '',
text: '',
owner: 'code-parser',
bubble: false
}
decorators.push(decorator)
await this.plugin.call('fileDecorator', 'clearFileDecorators', fileName)
}
await this.plugin.call('fileDecorator', 'setFileDecorators', decorators)
}
async getPositionForImportErrors(importedFileName: string, text: string) {

@ -145,7 +145,7 @@ export const FlatTree = (props: FlatTreeProps) => {
if (state.path === file.path) return true
if (state.bubble && file.isDirectory && state.path.startsWith(file.path)) return true
})
if (state && state.fileStateLabelClass) {
if (state) {
return <FileDecorationIcons file={file} fileDecorations={fileState} />
}
}

Loading…
Cancel
Save