type converters, use namespace for Hover

This commit is contained in:
Johannes Rieken
2018-05-04 18:31:55 +02:00
parent c47296282a
commit 781520cbe1
3 changed files with 12 additions and 10 deletions

View File

@@ -318,7 +318,7 @@ export class ExtHostApiCommands {
position: position && typeConverters.Position.from(position)
};
return this._commands.executeCommand<modes.Hover[]>('_executeHoverProvider', args)
.then(tryMapWith(typeConverters.toHover));
.then(tryMapWith(typeConverters.Hover.to));
}
private _executeDocumentHighlights(resource: URI, position: types.Position): Thenable<types.DocumentHighlight[]> {

View File

@@ -200,7 +200,7 @@ class HoverAdapter {
value.range = new Range(pos, pos);
}
return typeConvert.fromHover(value);
return typeConvert.Hover.from(value);
});
}
}

View File

@@ -404,15 +404,17 @@ export const location = {
}
};
export function fromHover(hover: vscode.Hover): modes.Hover {
return <modes.Hover>{
range: Range.from(hover.range),
contents: MarkdownString.fromMany(hover.contents)
};
}
export namespace Hover {
export function from(hover: vscode.Hover): modes.Hover {
return <modes.Hover>{
range: Range.from(hover.range),
contents: MarkdownString.fromMany(hover.contents)
};
}
export function toHover(info: modes.Hover): types.Hover {
return new types.Hover(info.contents.map(MarkdownString.to), Range.to(info.range));
export function to(info: modes.Hover): types.Hover {
return new types.Hover(info.contents.map(MarkdownString.to), Range.to(info.range));
}
}
export function toDocumentHighlight(occurrence: modes.DocumentHighlight): types.DocumentHighlight {