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
commit eec68e6f45
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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 }

View file

@ -43,6 +43,7 @@ export class Server {
initializationOptions: {
publishDecorations: true,
lruCapacity: Server.config.lruCapacity,
maxInlayHintLength: Server.config.maxInlayHintLength,
excludeGlobs: Server.config.excludeGlobs,
useClientWatching: Server.config.useClientWatching,
featureFlags: Server.config.featureFlags