fix highlight

pull/1701/head^2
yann300 3 years ago
parent 3d146aa32e
commit dd9786860f
  1. 4
      apps/debugger/src/app/debugger-api.ts
  2. 2
      apps/remix-ide/src/app/editor/contextualListener.js
  3. 8
      apps/remix-ide/src/app/editor/editor.js
  4. 2
      apps/remix-ide/src/app/tabs/test-tab.js
  5. 4
      libs/remix-ui/static-analyser/src/lib/ErrorRenderer.tsx

@ -44,9 +44,7 @@ export const DebuggerApiMixin = (Base) => class extends Base {
}
async highlight (lineColumnPos, path) {
await this.call('fileManager', 'open', path)
await this.call('editor', 'gotoLine', lineColumnPos.start.line, lineColumnPos.start.column)
await this.call('editor', 'highlight', lineColumnPos, path)
await this.call('editor', 'highlight', lineColumnPos, path, '', { focus: true })
}
async getFile (path) {

@ -141,7 +141,7 @@ class ContextualListener extends Plugin {
}
const fileName = lastCompilationResult.getSourceName(position.file)
if (fileName) {
return this.call('editor', 'highlight', lineColumn, fileName)
return this.call('editor', 'highlight', lineColumn, fileName, '', { focus: false })
}
}
return null

@ -466,10 +466,12 @@ class Editor extends Plugin {
await this.addDecoration(annotation, filePath, 'sourceAnnotationsPerFile')
}
async highlight (position, filePath) {
async highlight (position, filePath, highlightColor, opt = { focus: true }) {
filePath = filePath || this.currentFile
await this.call('fileManager', 'open', filePath)
this.gotoLine(position.start.line, position.start.column)
if (opt.focus) {
await this.call('fileManager', 'open', filePath)
this.gotoLine(position.start.line, position.start.column)
}
await this.addDecoration({ position }, filePath, 'markerPerFile')
}

@ -224,7 +224,7 @@ module.exports = class TestTab extends ViewPlugin {
runningTests[fileName].content
)
await this.call('editor', 'discardHighlight')
await this.call('editor', 'highlight', location, fileName)
await this.call('editor', 'highlight', location, fileName, '', { focus: true })
}
}

@ -27,9 +27,7 @@ const ErrorRenderer = ({ message, opt, editor }: ErrorRendererProps) => {
const handlePointToErrorOnClick = async (location, fileName) => {
await editor.call('editor', 'discardHighlight')
await editor.call('fileManager', 'open', fileName)
await editor.call('editor', 'gotoLine', location.start.line, location.start.column)
await editor.call('editor', 'highlight', location, fileName)
await editor.call('editor', 'highlight', location, fileName, '', { focus: true })
}
if (!message) return

Loading…
Cancel
Save