Skip to content
This repository has been archived by the owner on Jul 17, 2020. It is now read-only.

Commit

Permalink
since the marker gets destroyed each time, we completly remove the up…
Browse files Browse the repository at this point in the history
…date marker logic. also fixes #289
  • Loading branch information
tststs committed Feb 12, 2017
1 parent a6ff259 commit 029c796
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 65 deletions.
48 changes: 16 additions & 32 deletions lib/atom-ternjs-documentation.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,50 +74,35 @@ class Documentation {
});
})
.catch((err) => {

err && debug.handleReject(err.type, err.message);
});
}

show() {

if (!this.marker) {

let editor = atom.workspace.getActiveTextEditor();
let cursor = editor.getLastCursor();

if (!editor || !cursor) {

return;
}
const editor = atom.workspace.getActiveTextEditor();

this.marker = cursor.getMarker();
if (!editor) {

if (!this.marker) {
return;
}

return;
}
const marker = editor.getLastCursor && editor.getLastCursor().getMarker();

this.overlayDecoration = editor.decorateMarker(this.marker, {
if (!marker) {

type: 'overlay',
item: this.view,
class: 'atom-ternjs-documentation',
position: 'tale',
invalidate: 'touch'
});

} else {
return;
}

this.marker.setProperties({
this.overlayDecoration = editor.decorateMarker(marker, {

type: 'overlay',
item: this.view,
class: 'atom-ternjs-documentation',
position: 'tale',
invalidate: 'touch'
});
}
type: 'overlay',
item: this.view,
class: 'atom-ternjs-documentation',
position: 'tale',
invalidate: 'touch'
});
}

destroyOverlay() {
Expand All @@ -128,7 +113,6 @@ class Documentation {
}

this.overlayDecoration = null;
this.marker = null;
}

destroy() {
Expand Down
50 changes: 17 additions & 33 deletions lib/atom-ternjs-type.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ class Type {

this.view = undefined;
this.overlayDecoration = undefined;
this.marker = undefined;

this.view = new TypeView();
this.view.initialize(this);
Expand All @@ -34,42 +33,28 @@ class Type {

setPosition() {

if (!this.marker) {
const editor = atom.workspace.getActiveTextEditor();

const editor = atom.workspace.getActiveTextEditor();
if (!editor) {

if (!editor) {

return;
}

this.marker = editor.getLastCursor && editor.getLastCursor().getMarker();

if (!this.marker) {
return;
}

return;
}
const marker = editor.getLastCursor && editor.getLastCursor().getMarker();

this.overlayDecoration = editor.decorateMarker(this.marker, {
if (!marker) {

type: 'overlay',
item: this.view,
class: 'atom-ternjs-type',
position: 'tale',
invalidate: 'touch'
});

} else {
return;
}

this.marker.setProperties({
this.overlayDecoration = editor.decorateMarker(marker, {

type: 'overlay',
item: this.view,
class: 'atom-ternjs-type',
position: 'tale',
invalidate: 'touch'
});
}
type: 'overlay',
item: this.view,
class: 'atom-ternjs-type',
position: 'tale',
invalidate: 'touch'
});
}

queryType(editor, cursor) {
Expand Down Expand Up @@ -267,13 +252,12 @@ class Type {

destroyOverlay() {

this.marker = undefined;

if (this.overlayDecoration) {

this.overlayDecoration.destroy();
this.overlayDecoration = undefined;
}

this.overlayDecoration = null;
}
}

Expand Down

0 comments on commit 029c796

Please sign in to comment.