Merge pull request #2297 from kiljacken/master

Add fancy truncation of type hints.
This commit is contained in:
Aleksey Kladov
2019-11-20 08:38:25 +03:00
committed by GitHub
10 changed files with 134 additions and 35 deletions

View File

@@ -87,7 +87,7 @@ export class HintsUpdater {
range: hint.range,
renderOptions: {
after: {
contentText: `: ${this.truncateHint(hint.label)}`
contentText: `: ${hint.label}`
}
}
}));
@@ -98,18 +98,6 @@ export class HintsUpdater {
}
}
private truncateHint(label: string): string {
if (!Server.config.maxInlayHintLength) {
return label;
}
let newLabel = label.substring(0, Server.config.maxInlayHintLength);
if (label.length > Server.config.maxInlayHintLength) {
newLabel += '…';
}
return newLabel;
}
private async queryHints(documentUri: string): Promise<InlayHint[] | null> {
const request: InlayHintsParams = {
textDocument: { uri: documentUri }