Unverified Commit 4a4852f4 authored by yann300's avatar yann300 Committed by GitHub

Merge pull request #1980 from ethereum/yann300-patch-35

Fix highlight reference
parents 826de86b 9c3ae5ff
'use strict' 'use strict'
const remixLib = require('remix-lib') const remixLib = require('remix-lib')
const csjs = require('csjs-inject')
const SourceMappingDecoder = remixLib.SourceMappingDecoder const SourceMappingDecoder = remixLib.SourceMappingDecoder
const AstWalker = remixLib.AstWalker const AstWalker = remixLib.AstWalker
const EventManager = require('../../lib/events') const EventManager = require('../../lib/events')
...@@ -115,10 +116,16 @@ class ContextualListener { ...@@ -115,10 +116,16 @@ class ContextualListener {
let lastCompilationResult = this._deps.compilersArtefacts['__last'] let lastCompilationResult = this._deps.compilersArtefacts['__last']
if (lastCompilationResult && lastCompilationResult.languageversion.indexOf('soljson') === 0) { if (lastCompilationResult && lastCompilationResult.languageversion.indexOf('soljson') === 0) {
let lineColumn = this._deps.offsetToLineColumnConverter.offsetToLineColumn(position, position.file, lastCompilationResult.getSourceCode().sources, lastCompilationResult.getAsts()) let lineColumn = this._deps.offsetToLineColumnConverter.offsetToLineColumn(position, position.file, lastCompilationResult.getSourceCode().sources, lastCompilationResult.getAsts())
let css = 'highlightreference' const css = csjs`
.highlightref_fullLine {
position:absolute;
z-index:2;
opacity: 0.4;
background-color: var(--info);
}
`
if (node.children && node.children.length) { if (node.children && node.children.length) {
// If node has children, highlight the entire line. if not, just highlight the current source position of the node. // If node has children, highlight the entire line. if not, just highlight the current source position of the node.
css = 'highlightreference'
lineColumn = { lineColumn = {
start: { start: {
line: lineColumn.start.line, line: lineColumn.start.line,
...@@ -132,7 +139,7 @@ class ContextualListener { ...@@ -132,7 +139,7 @@ class ContextualListener {
} }
const fileName = lastCompilationResult.getSourceName(position.file) const fileName = lastCompilationResult.getSourceName(position.file)
if (fileName) { if (fileName) {
return this.editor.addMarker(lineColumn, fileName, css) return this.editor.addMarker(lineColumn, fileName, css.highlightref_fullLine)
} }
} }
return null return null
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment