This commit is contained in:
Johannes Rieken
2022-01-19 09:23:48 +01:00
parent c333d44ecd
commit 8ef8933a1a
10 changed files with 62 additions and 62 deletions

View File

@@ -1260,8 +1260,8 @@ class InlayHintsAdapter {
tooltip: hint.tooltip && typeConvert.MarkdownString.from(hint.tooltip),
position: typeConvert.Position.from(hint.position),
kind: typeConvert.InlayHintKind.from(hint.kind ?? InlayHintKind.Other),
whitespaceBefore: hint.whitespaceBefore,
whitespaceAfter: hint.whitespaceAfter,
whitespaceBefore: hint.paddingLeft,
whitespaceAfter: hint.paddingRight,
};
if (typeof hint.label === 'string') {
@@ -1269,11 +1269,10 @@ class InlayHintsAdapter {
} else {
result.label = hint.label.map(part => {
let r: modes.InlayHintLabelPart = { label: part.label };
r.collapsible = part.collapsible;
if (Location.isLocation(part.action)) {
r.action = typeConvert.location.from(part.action);
} else if (part.action) {
r.action = this._commands.toInternal(part.action, disposables);
if (Location.isLocation(part.location)) {
r.location = typeConvert.location.from(part.location);
} else if (part.command) {
r.command = this._commands.toInternal(part.command, disposables);
}
return r;
});

View File

@@ -1159,8 +1159,8 @@ export namespace InlayHint {
InlayHintKind.to(hint.kind)
);
res.tooltip = htmlContent.isMarkdownString(hint.tooltip) ? MarkdownString.to(hint.tooltip) : hint.tooltip;
res.whitespaceAfter = hint.whitespaceAfter;
res.whitespaceBefore = hint.whitespaceBefore;
res.paddingLeft = hint.paddingLeft;
res.paddingRight = hint.paddingRight;
return res;
}
}
@@ -1169,11 +1169,11 @@ export namespace InlayHintLabelPart {
export function to(converter: CommandsConverter, part: modes.InlayHintLabelPart): types.InlayHintLabelPart {
const result = new types.InlayHintLabelPart(part.label);
result.collapsible = part.collapsible;
if (modes.Command.is(part.action)) {
result.action = converter.fromInternal(part.action);
} else if (part.action) {
result.action = location.to(part.action);
if (modes.Command.is(part.command)) {
result.command = converter.fromInternal(part.command);
} else if (part.location) {
result.location = location.to(part.location);
}
return result;
}

View File

@@ -1424,24 +1424,23 @@ export enum InlayHintKind {
@es5ClassCompat
export class InlayHintLabelPart {
label: string;
collapsible?: boolean;
action?: vscode.Command | Location; // invokes provider
location?: Location;
command?: vscode.Command;
constructor(label: string) {
this.label = label;
}
toString(): string {
return this.label;
}
}
@es5ClassCompat
export class InlayHint implements vscode.InlayHint {
label: string | InlayHintLabelPart[];
tooltip?: string | vscode.MarkdownString;
position: Position;
kind?: vscode.InlayHintKind;
whitespaceBefore?: boolean;
whitespaceAfter?: boolean;
paddingLeft?: boolean;
paddingRight?: boolean;
constructor(label: string | InlayHintLabelPart[], position: Position, kind?: vscode.InlayHintKind) {
this.label = label;