Skip to content

Commit

Permalink
Merge pull request #17 from atom-ide-community/fix/activeParam
Browse files Browse the repository at this point in the history
fix: error handling in promise, activeParameter capturing
  • Loading branch information
appelgriebsch authored Mar 21, 2019
2 parents 7962b90 + e9d3ce7 commit ae3fa99
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 13 deletions.
11 changes: 5 additions & 6 deletions lib/signature-help-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -236,21 +236,20 @@ module.exports = class SignatureHelpManager {
markedString.push(markdownDoc);
}

const activeParam = signature.parameters ? signature.parameters[result.activeParameter || 0].label : undefined;
const activeParam = signature.parameters ? signature.parameters[result.activeParameter || 0] : undefined;

const s = markedString.join('\r\n');
const requestToken = `${position.row}:${position.column}`;
this.renderer.render(requestToken, s).then(({ token, html }) => {
this.renderer.render(s).then((html) => {
if (editor.getLastCursor().getBufferRow() == position.row) { // make sure we are still on the same position
if (activeParam) {
this.highlightParameter(html, activeParam);
this.highlightParameter(html, activeParam.label);
}
this.unmountDataTip();
const signatureHelpView = new SignatureHelpView({ htmlView: html });
this.signatureHelpDisposables = this.mountSignatureHelp(editor, position, signatureHelpView);
}
}).catch(({ token, error }) => {
console.error(token, error);
}).catch((err) => {
console.error(err);
});
});
}
Expand Down
4 changes: 2 additions & 2 deletions styles/atom-ide-signature-help-marked.less
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
color: @syntax-text-color;
font-family: var(--editor-font-family);
font-size: var(--editor-font-size);
max-width: 800px;
max-height: 400px;
max-height: 24em;
max-width: 64em;
overflow: auto;
white-space: normal;

Expand Down
10 changes: 5 additions & 5 deletions styles/atom-ide-signature-help.less
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
position: relative;
white-space: normal;
pointer-events: all;
max-width: 800px;
max-height: 400px;
max-height: 24em;
max-width: 64em;
overflow: none;

p {
Expand All @@ -23,7 +23,7 @@
}

.signature-overlay {
z-index: 12 !important; // HACK: exceed the z-index of
z-index: 4 !important; // HACK: exceed the z-index of
// .atom-dock-resize-handle-resizable, so that
// mouseleaves aren't triggered when the cursor enters
// the resizable
Expand All @@ -33,8 +33,8 @@
background-color: @syntax-background-color;
display: flex;
position: relative;
max-width: 800px;
max-height: 400px;
max-height: 24em;
max-width: 64em;
transition: background-color 0.15s ease;
padding: 8px;
white-space: pre-wrap;
Expand Down

0 comments on commit ae3fa99

Please sign in to comment.