Skip to content

Commit

Permalink
Merge pull request #632 from elm-tooling/add-port-comment
Browse files Browse the repository at this point in the history
Add block comment from port to hint
  • Loading branch information
razzeee committed Sep 17, 2021
2 parents f990cbf + f65fefb commit b4557be
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/util/hintHelper.ts
Expand Up @@ -20,7 +20,15 @@ export class HintHelper {
} else if (node.type === "port_annotation") {
const name = node.childForFieldName("name");
if (name && typeString) {
return this.formatHint(`${name.text} : ${typeString}`, "");
let comment = "";
if (
node.previousNamedSibling &&
node.previousNamedSibling.type === "block_comment"
) {
comment = node.previousNamedSibling.text;
}

return this.formatHint(`${name.text} : ${typeString}`, comment);
}
} else {
return this.createHintFromDefinition(node);
Expand Down

0 comments on commit b4557be

Please sign in to comment.