Update _highlightExpressions and contextView.js

pull/1/head
ninabreznik 7 years ago committed by yann300
parent 80be8091c3
commit b139c8db22
  1. 18
      src/app/editor/contextView.js
  2. 1
      src/app/editor/contextualListener.js

@ -29,8 +29,6 @@ var css = csjs`
} }
.name { .name {
font-weight : bold; font-weight : bold;
margin-right : 15px;
cursor : pointer;
} }
.jump { .jump {
cursor : pointer; cursor : pointer;
@ -42,6 +40,7 @@ var css = csjs`
} }
.referencesnb { .referencesnb {
float : right; float : right;
margin-left : 15px;
} }
` `
@ -133,17 +132,10 @@ class ContextView {
function next () { function next () {
var nodes = self._api.contextualListener.getActiveHighlights() var nodes = self._api.contextualListener.getActiveHighlights()
var currentName = node.attributes.name var currentName = node.attributes.name
var position = self.sourceMappingDecoder.decode(node.src)
if (currentName !== self.refName) self.ref = 0 if (currentName !== self.refName) self.ref = 0
var k = self.ref var k = self.ref
/// LOGS ///
nodes.forEach(node => console.log(node.position.start))
console.log('----')
console.log(k)
console.log('----')
var pos = nodes[k].position var pos = nodes[k].position
self._api.jumpTo(pos) self._api.jumpTo(pos)
@ -158,12 +150,6 @@ class ContextView {
var k = nodes.length - 1 - self.ref var k = nodes.length - 1 - self.ref
/// LOGS ///
nodes.forEach(node => console.log(node.position.start))
console.log('----')
console.log(k)
console.log('----')
var pos = nodes[k].position var pos = nodes[k].position
self._api.jumpTo(pos) self._api.jumpTo(pos)
@ -172,9 +158,9 @@ class ContextView {
} }
return yo`<div class=${css.line}> return yo`<div class=${css.line}>
<i class="fa fa-share ${css.jump}" aria-hidden="true" onclick=${jumpTo}></i>
<div title=${type} class=${css.type}>${type}</div> <div title=${type} class=${css.type}>${type}</div>
<div title=${node.attributes.name} class=${css.name}>${node.attributes.name}</div> <div title=${node.attributes.name} class=${css.name}>${node.attributes.name}</div>
<i class="fa fa-share ${css.jump}" aria-hidden="true" onclick=${jumpTo}></i>
<span class=${css.referencesnb}>${references}</span> <span class=${css.referencesnb}>${references}</span>
<i class="fa fa-chevron-up ${css.jump}" aria-hidden="true" onclick=${previous}></i> <i class="fa fa-chevron-up ${css.jump}" aria-hidden="true" onclick=${previous}></i>
<i class="fa fa-chevron-down ${css.jump}" aria-hidden="true" onclick=${next}></i> <i class="fa fa-chevron-down ${css.jump}" aria-hidden="true" onclick=${next}></i>

@ -120,6 +120,7 @@ class ContextualListener {
this._highlight(current, compilationResult) this._highlight(current, compilationResult)
} else { } else {
highlights(node.id) highlights(node.id)
this._highlight(node, compilationResult)
} }
} }

Loading…
Cancel
Save