Skip to content

Commit b40c4f8

Browse files
Merge pull request #31 from atom-ide-community/fix/datatip-leftovers
fix: datatip leftovers, max-height for large documentation
2 parents 8b055c3 + 4fd3228 commit b40c4f8

3 files changed

Lines changed: 13 additions & 6 deletions

File tree

lib/datatip-manager.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -313,14 +313,19 @@ module.exports = class DatatipManager {
313313
else if (result.markedStrings.length > 0) {
314314
let s = result.markedStrings.map((m) => {
315315
if (m.type === "markdown") return m.value;
316-
const regExpLSPPrefix = /^\((method|property|parameter)\)\W/;
316+
const regExpLSPPrefix = /^\((method|property|parameter|alias)\)\W/;
317317
const snippet = m.value.replace(regExpLSPPrefix, '');
318318
return `<pre><code class="${editor.getGrammar().name.toLowerCase()}">${snippet}</code></pre>`;
319319
}).join('\r\n');
320320
this.renderer.render(s).then((html) => {
321-
dataTipView = new DataTipView({ htmlView: html });
322-
this.dataTipMarkerDisposables = this.mountDataTipWithMarker(editor, result.range, position, dataTipView);
323-
}).catch((err) => console.log(err));
321+
if (result.range.containsRange(this.currentMarkerRange)) {
322+
dataTipView = new DataTipView({ htmlView: html });
323+
this.dataTipMarkerDisposables = this.mountDataTipWithMarker(editor, result.range, position, dataTipView);
324+
}
325+
}).catch((err) => {
326+
this.hideDataTip();
327+
console.error(err)
328+
});
324329
}
325330
});
326331
}

styles/atom-ide-datatips-marked.less

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
font-family: var(--editor-font-family);
1111
font-size: var(--editor-font-size);
1212
max-width: 800px;
13+
max-height: 400px;
1314
overflow: auto;
1415
padding: 8px;
1516
white-space: normal;

styles/atom-ide-datatips.less

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,13 @@
1111
white-space: normal;
1212
pointer-events: all;
1313
max-width: 800px;
14+
max-height: 400px;
1415
overflow: none;
15-
16+
1617
p {
1718
margin-left: 8px;
1819
margin-right: 8px;
19-
20+
2021
&:last-child { margin-bottom: 8px; }
2122
}
2223
}

0 commit comments

Comments
 (0)