diff --git a/apps/remix-ide/src/app/editor/editor.js b/apps/remix-ide/src/app/editor/editor.js index 04a322a4e0..8779fdcfae 100644 --- a/apps/remix-ide/src/app/editor/editor.js +++ b/apps/remix-ide/src/app/editor/editor.js @@ -211,6 +211,7 @@ class Editor extends Plugin { } async _onChange (file) { + this.triggerEvent('didChangeFile', [file]) const currentFile = await this.call('fileManager', 'file') if (!currentFile) { return diff --git a/apps/remix-ide/src/app/plugins/code-parser.tsx b/apps/remix-ide/src/app/plugins/code-parser.tsx index d49b45842e..be91676f6e 100644 --- a/apps/remix-ide/src/app/plugins/code-parser.tsx +++ b/apps/remix-ide/src/app/plugins/code-parser.tsx @@ -51,8 +51,8 @@ export class CodeParser extends Plugin { } async onActivation() { - this.on('editor', 'contentChanged', async () => { - console.log('contentChanged') + this.on('editor', 'didChangeFile', async (file) => { + console.log('contentChanged', file) await this.getCurrentFileAST() await this.compile() }) @@ -156,7 +156,8 @@ export class CodeParser extends Plugin { fileStateIcon: '', text: errors.length, owner: 'code-parser', - bubble: true + bubble: true, + commment: errors.map((error) => error.message), } decorators.push(decorator) } diff --git a/libs/remix-ui/editor/src/lib/actions/editor.ts b/libs/remix-ui/editor/src/lib/actions/editor.ts index eb35640b00..2901488e4e 100644 --- a/libs/remix-ui/editor/src/lib/actions/editor.ts +++ b/libs/remix-ui/editor/src/lib/actions/editor.ts @@ -22,9 +22,9 @@ export const reducerActions = (models = initialState, action: Action) => { if (models[uri]) return models // already existing models[uri] = { language, uri, readOnly } let model - try{ + try { model = monaco.editor.createModel(value, language, monaco.Uri.parse(uri)) - }catch(e){ + } catch (e) { } models[uri].model = model @@ -60,20 +60,20 @@ export const reducerActions = (models = initialState, action: Action) => { case 'REVEAL_RANGE': { if (!editor) return models const range: IRange = { - startLineNumber: action.payload.startLineNumber +1, + startLineNumber: action.payload.startLineNumber + 1, startColumn: action.payload.startColumn, endLineNumber: action.payload.endLineNumber + 1, endColumn: action.payload.endColumn } // reset to start of line - if(action.payload.startColumn < 100){ + if (action.payload.startColumn < 100) { editor.revealRange({ startLineNumber: range.startLineNumber, startColumn: 1, endLineNumber: range.endLineNumber, endColumn: 1 }) - }else{ + } else { editor.revealRangeInCenter(range) } return models @@ -138,12 +138,12 @@ export const reducerListener = (plugin, dispatch, monaco, editor, events) => { plugin.on('editor', 'revealRange', (startLineNumber, startColumn, endLineNumber, endColumn) => { dispatch({ type: 'REVEAL_RANGE', - payload: { + payload: { startLineNumber, startColumn, endLineNumber, endColumn - }, + }, monaco, editor }) diff --git a/libs/remix-ui/file-decorators/src/lib/components/filedecorationicons/file-decoration-error-icon.tsx b/libs/remix-ui/file-decorators/src/lib/components/filedecorationicons/file-decoration-error-icon.tsx index 8a9393f294..ea128709ba 100644 --- a/libs/remix-ui/file-decorators/src/lib/components/filedecorationicons/file-decoration-error-icon.tsx +++ b/libs/remix-ui/file-decorators/src/lib/components/filedecorationicons/file-decoration-error-icon.tsx @@ -1,11 +1,34 @@ // eslint-disable-next-line no-use-before-define import React from 'react' +import { OverlayTrigger, Tooltip } from 'react-bootstrap' import { fileDecoration } from '../../types' const FileDecorationErrorIcon = (props: { fileState: fileDecoration }) => { - return <>{props.fileState.text} + + const getComments = function () { + if(props.fileState.commment){ + const commments = Array.isArray(props.fileState.commment) ? props.fileState.commment : [props.fileState.commment] + return commments.map((comment, index) => { + return
{comment}

+ }) + } + } + + return <> + + <>{getComments()} + + } + > + {props.fileState.text} + + } export default FileDecorationErrorIcon \ No newline at end of file diff --git a/libs/remix-ui/file-decorators/src/lib/types/index.ts b/libs/remix-ui/file-decorators/src/lib/types/index.ts index 9406724209..35178721e0 100644 --- a/libs/remix-ui/file-decorators/src/lib/types/index.ts +++ b/libs/remix-ui/file-decorators/src/lib/types/index.ts @@ -1,21 +1,10 @@ export enum fileDecorationType { Error = 'ERROR', Warning = 'WARNING', - Success = 'SUCCESS', - Loading = 'LOADING', - Unsaved = 'UNSAVED', - Untracked = 'UNTRACKED', - Modified = 'MODIFIED', - Staged = 'STAGED', - Committed = 'COMMITTED', - Deleted = 'DELETED', - Added = 'ADDED', - New = 'NEW', - Compiled = 'COMPILED', Custom = 'CUSTOM', None = 'NONE' } - + export type fileDecoration = { path: string, isDirectory: boolean, @@ -28,6 +17,7 @@ export enum fileDecorationType { owner: string, workspace?: any tooltip?: string + commment?: string[] | string } export interface FileType {