Skip to content

Commit

Permalink
feat: add request token to markdown service calls
Browse files Browse the repository at this point in the history
  • Loading branch information
Andreas Gerlach committed Mar 18, 2019
1 parent 4fd3228 commit 16876c0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/datatip-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -317,14 +317,15 @@ module.exports = class DatatipManager {
const snippet = m.value.replace(regExpLSPPrefix, '');
return `<pre><code class="${editor.getGrammar().name.toLowerCase()}">${snippet}</code></pre>`;
}).join('\r\n');
this.renderer.render(s).then((html) => {
if (result.range.containsRange(this.currentMarkerRange)) {
const requestToken = `${position.row}:${position.column}`;
this.renderer.render(requestToken, s).then(({ token, html }) => {
if (token == requestToken) { // make sure we are still on the same position
dataTipView = new DataTipView({ htmlView: html });
this.dataTipMarkerDisposables = this.mountDataTipWithMarker(editor, result.range, position, dataTipView);
}
}).catch((err) => {
}).catch(({ token, error }) => {
this.hideDataTip();
console.error(err)
console.error(error);
});
}
});
Expand Down
1 change: 1 addition & 0 deletions styles/atom-ide-datatips.less
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
display: flex;
position: relative;
max-width: 800px;
max-height: 400px;
transition: background-color 0.15s ease;
padding: 8px;
white-space: pre-wrap;
Expand Down

0 comments on commit 16876c0

Please sign in to comment.