Update SourceHighlighter to ES6

pull/1/head
Grandschtroumpf 6 years ago
parent b5d9dc3c18
commit 34a297fc7f
  1. 27
      src/app/editor/sourceHighlighter.js

@ -1,20 +1,19 @@
'use strict' 'use strict'
var csjs = require('csjs-inject') const csjs = require('csjs-inject')
var globlalRegistry = require('../../global/registry') const globlalRegistry = require('../../global/registry')
var styleGuide = require('../ui/styles-guide/theme-chooser') const styleGuide = require('../ui/styles-guide/theme-chooser')
var styles = styleGuide.chooser() const styles = styleGuide.chooser()
class SourceHighlighter { class SourceHighlighter {
constructor (localRegistry) { constructor (localRegistry) {
const self = this this._components = {}
self._components = {} this._components.registry = localRegistry || globlalRegistry
self._components.registry = localRegistry || globlalRegistry
// dependencies // dependencies
self._deps = { this._deps = {
editor: self._components.registry.get('editor').api, editor: this._components.registry.get('editor').api,
config: self._components.registry.get('config').api, config: this._components.registry.get('config').api,
fileManager: self._components.registry.get('filemanager').api, fileManager: this._components.registry.get('filemanager').api,
compilerArtefacts: self._components.registry.get('compilersartefacts').api compilerArtefacts: this._components.registry.get('compilersartefacts').api
} }
this.statementMarker = null this.statementMarker = null
this.fullLineMarker = null this.fullLineMarker = null
@ -26,7 +25,7 @@ class SourceHighlighter {
if (this.fullLineMarker) this._deps.editor.removeMarker(this.fullLineMarker, this.source) if (this.fullLineMarker) this._deps.editor.removeMarker(this.fullLineMarker, this.source)
let lastCompilationResult = this._deps.compilerArtefacts['__last'] let lastCompilationResult = this._deps.compilerArtefacts['__last']
if (location && location.file !== undefined && lastCompilationResult) { if (location && location.file !== undefined && lastCompilationResult) {
var path = lastCompilationResult.getSourceName(location.file) const path = lastCompilationResult.getSourceName(location.file)
if (path) { if (path) {
this.currentSourceLocationFromfileName(lineColumnPos, path) this.currentSourceLocationFromfileName(lineColumnPos, path)
} }
@ -45,7 +44,7 @@ class SourceHighlighter {
this._deps.fileManager.switchFile(this.source) this._deps.fileManager.switchFile(this.source)
} }
var css = csjs` const css = csjs`
.highlightcode { .highlightcode {
position:absolute; position:absolute;
z-index:20; z-index:20;

Loading…
Cancel
Save