Skip to content

Commit

Permalink
Ensure that SignatureInformation has a non-null array
Browse files Browse the repository at this point in the history
While the LSP allows a SignatureInformation's parameters array to be
optional, Monaco does not so we should ensure that it is initialized
with a zero length array if the value from the language server is null
or undefined.

Signed-off-by: Remy Suen <remy.suen@gmail.com>
  • Loading branch information
rcjsuen authored and akosyakov committed Sep 3, 2018
1 parent 53f9664 commit 3f0a16a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/monaco-converter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,11 @@ export class ProtocolToMonacoConverter {
asSignatureInformation(item: SignatureInformation): monaco.languages.SignatureInformation {
let result = <monaco.languages.SignatureInformation>{ label: item.label };
if (item.documentation) { result.documentation = this.asDocumentation(item.documentation); }
if (item.parameters) { result.parameters = this.asParameterInformations(item.parameters); }
if (item.parameters) {
result.parameters = this.asParameterInformations(item.parameters);
} else {
result.parameters = [];
}
return result;
}

Expand Down

0 comments on commit 3f0a16a

Please sign in to comment.