mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 13:25:09 +00:00
Merge pull request #2297 from kiljacken/master
Add fancy truncation of type hints.
This commit is contained in:
commit
eec68e6f45
10 changed files with 134 additions and 35 deletions
|
@ -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 }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue