Commit de729819 authored by ninabreznik's avatar ninabreznik Committed by yann300

Add getter (getActiveHighlights) and remove unused api reference

parent 5a404f06
......@@ -349,7 +349,6 @@ function run () {
// ---------------- ContextView -----------------------
this._components.contextView = new ContextView({
contextualListener: this._components.contextualListener,
editor: editor,
jumpTo: (position) => {
if (compiler.lastCompilationResult && compiler.lastCompilationResult.data) {
var lineColumn = offsetToLineColumnConverter.offsetToLineColumn(position, position.file, compiler.lastCompilationResult)
......
......@@ -115,6 +115,7 @@ class ContextView {
}
_render (node) {
console.log('rendering')
if (!node) return yo`<div></div>`
var self = this
var references = this._api.contextualListener.referencesOf(node)
......@@ -135,7 +136,7 @@ class ContextView {
if (currentName === this.refName) {
this.ref = this.ref === undefined ? 0 : this.ref
} else { this.ref = 0 }
var nodes = self._api.contextualListener._activeHighlights
var nodes = self._api.contextualListener.getActiveHighlights()
self._api.jumpTo(nodes[this.ref].position)
this.ref = (this.ref + 1) % nodes.length
this.refName = currentName
......@@ -146,7 +147,7 @@ class ContextView {
if (currentName === this.refName) {
this.ref = this.ref === undefined ? 0 : this.ref
} else { this.ref = 0 } // should be this.ref = ref of the selected node (loop through all nodes to find this one)
var nodes = self._api.contextualListener._activeHighlights
var nodes = self._api.contextualListener.getActiveHighlights()
this.ref = this.ref === undefined ? 0 : this.ref
self._api.jumpTo(nodes[nodes.length - 1 - this.ref].position)
this.ref = (this.ref + 1) % nodes.length
......
......@@ -37,6 +37,10 @@ class ContextualListener {
}, 1000)
}
getActiveHighlights () {
return [...this._activeHighlights]
}
declarationOf (node) {
if (node.attributes && node.attributes.referencedDeclaration) {
return this._index['FlatReferences'][node.attributes.referencedDeclaration]
......
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