aboutsummaryrefslogtreecommitdiff
path: root/editors/code/src/commands
diff options
context:
space:
mode:
Diffstat (limited to 'editors/code/src/commands')
-rw-r--r--editors/code/src/commands/inlay_hints.ts18
1 files changed, 17 insertions, 1 deletions
diff --git a/editors/code/src/commands/inlay_hints.ts b/editors/code/src/commands/inlay_hints.ts
index 5393a2bc9..ffaaaebcb 100644
--- a/editors/code/src/commands/inlay_hints.ts
+++ b/editors/code/src/commands/inlay_hints.ts
@@ -85,7 +85,11 @@ export class HintsUpdater {
85 if (newHints !== null) { 85 if (newHints !== null) {
86 const newDecorations = newHints.map(hint => ({ 86 const newDecorations = newHints.map(hint => ({
87 range: hint.range, 87 range: hint.range,
88 renderOptions: { after: { contentText: `: ${hint.label}` } } 88 renderOptions: {
89 after: {
90 contentText: `: ${this.truncateHint(hint.label)}`
91 }
92 }
89 })); 93 }));
90 return editor.setDecorations( 94 return editor.setDecorations(
91 typeHintDecorationType, 95 typeHintDecorationType,
@@ -94,6 +98,18 @@ export class HintsUpdater {
94 } 98 }
95 } 99 }
96 100
101 private truncateHint(label: string): string {
102 if (!Server.config.maxInlayHintLength) {
103 return label;
104 }
105
106 let newLabel = label.substring(0, Server.config.maxInlayHintLength);
107 if (label.length > Server.config.maxInlayHintLength) {
108 newLabel += '…';
109 }
110 return newLabel;
111 }
112
97 private async queryHints(documentUri: string): Promise<InlayHint[] | null> { 113 private async queryHints(documentUri: string): Promise<InlayHint[] | null> {
98 const request: InlayHintsParams = { 114 const request: InlayHintsParams = {
99 textDocument: { uri: documentUri } 115 textDocument: { uri: documentUri }