mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-24 12:19:20 +00:00
@@ -10,6 +10,7 @@
|
||||
"enabledApiProposals": [
|
||||
"inlayHints",
|
||||
"languageStatus",
|
||||
"markdownStringBaseUri",
|
||||
"resolvers",
|
||||
"workspaceTrust"
|
||||
],
|
||||
|
||||
@@ -209,7 +209,7 @@ class MyCompletionItem extends vscode.CompletionItem {
|
||||
if (!this.detail && detail.displayParts.length) {
|
||||
this.detail = Previewer.plainWithLinks(detail.displayParts, client);
|
||||
}
|
||||
this.documentation = this.getDocumentation(client, detail, this);
|
||||
this.documentation = this.getDocumentation(client, detail, this, this.document.uri);
|
||||
|
||||
const codeAction = this.getCodeActions(detail, filepath);
|
||||
const commands: vscode.Command[] = [{
|
||||
@@ -252,7 +252,8 @@ class MyCompletionItem extends vscode.CompletionItem {
|
||||
private getDocumentation(
|
||||
client: ITypeScriptServiceClient,
|
||||
detail: Proto.CompletionEntryDetails,
|
||||
item: MyCompletionItem
|
||||
item: MyCompletionItem,
|
||||
baseUri: vscode.Uri,
|
||||
): vscode.MarkdownString | undefined {
|
||||
const documentation = new vscode.MarkdownString();
|
||||
if (detail.source) {
|
||||
@@ -262,6 +263,8 @@ class MyCompletionItem extends vscode.CompletionItem {
|
||||
}
|
||||
Previewer.addMarkdownDocumentation(documentation, detail.documentation, detail.tags, client);
|
||||
|
||||
documentation.baseUri = baseUri;
|
||||
|
||||
return documentation.value.length ? documentation : undefined;
|
||||
}
|
||||
|
||||
|
||||
@@ -68,7 +68,8 @@ class TypeScriptHoverProvider implements vscode.HoverProvider {
|
||||
displayParts.push(data.displayString);
|
||||
parts.push(new vscode.MarkdownString().appendCodeblock(displayParts.join(' '), 'typescript'));
|
||||
}
|
||||
parts.push(markdownDocumentation(data.documentation, data.tags, this.client));
|
||||
const md = markdownDocumentation(data.documentation, data.tags, this.client, resource);
|
||||
parts.push(md);
|
||||
return parts;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ class TypeScriptSignatureHelpProvider implements vscode.SignatureHelpProvider {
|
||||
|
||||
const info = response.body;
|
||||
const result = new vscode.SignatureHelp();
|
||||
result.signatures = info.items.map(signature => this.convertSignature(signature));
|
||||
result.signatures = info.items.map(signature => this.convertSignature(signature, document.uri));
|
||||
result.activeSignature = this.getActiveSignature(context, info, result.signatures);
|
||||
result.activeParameter = this.getActiveParameter(info);
|
||||
|
||||
@@ -70,10 +70,10 @@ class TypeScriptSignatureHelpProvider implements vscode.SignatureHelpProvider {
|
||||
return info.argumentIndex;
|
||||
}
|
||||
|
||||
private convertSignature(item: Proto.SignatureHelpItem) {
|
||||
private convertSignature(item: Proto.SignatureHelpItem, baseUri: vscode.Uri) {
|
||||
const signature = new vscode.SignatureInformation(
|
||||
Previewer.plainWithLinks(item.prefixDisplayParts, this.client),
|
||||
Previewer.markdownDocumentation(item.documentation, item.tags.filter(x => x.name !== 'param'), this.client));
|
||||
Previewer.markdownDocumentation(item.documentation, item.tags.filter(x => x.name !== 'param'), this.client, baseUri));
|
||||
|
||||
let textIndex = signature.label.length;
|
||||
const separatorLabel = Previewer.plainWithLinks(item.separatorDisplayParts, this.client);
|
||||
@@ -84,7 +84,7 @@ class TypeScriptSignatureHelpProvider implements vscode.SignatureHelpProvider {
|
||||
signature.parameters.push(
|
||||
new vscode.ParameterInformation(
|
||||
[textIndex, textIndex + label.length],
|
||||
Previewer.markdownDocumentation(parameter.documentation, [], this.client)));
|
||||
Previewer.markdownDocumentation(parameter.documentation, [], this.client, baseUri)));
|
||||
|
||||
textIndex += label.length;
|
||||
signature.label += label;
|
||||
|
||||
@@ -30,7 +30,7 @@ suite('typescript.previewer', () => {
|
||||
markdownDocumentation(
|
||||
'x {@link http://www.example.com/foo} y {@link https://api.jquery.com/bind/#bind-eventType-eventData-handler} z',
|
||||
[],
|
||||
noopToResource
|
||||
noopToResource, undefined
|
||||
).value,
|
||||
'x [http://www.example.com/foo](http://www.example.com/foo) y [https://api.jquery.com/bind/#bind-eventType-eventData-handler](https://api.jquery.com/bind/#bind-eventType-eventData-handler) z');
|
||||
});
|
||||
@@ -40,7 +40,7 @@ suite('typescript.previewer', () => {
|
||||
markdownDocumentation(
|
||||
'x {@link http://www.example.com/foo abc xyz} y {@link http://www.example.com/bar|b a z} z',
|
||||
[],
|
||||
noopToResource
|
||||
noopToResource, undefined
|
||||
).value,
|
||||
'x [abc xyz](http://www.example.com/foo) y [b a z](http://www.example.com/bar) z');
|
||||
});
|
||||
@@ -50,7 +50,7 @@ suite('typescript.previewer', () => {
|
||||
markdownDocumentation(
|
||||
'x {@linkcode http://www.example.com/foo} y {@linkplain http://www.example.com/bar} z',
|
||||
[],
|
||||
noopToResource
|
||||
noopToResource, undefined
|
||||
).value,
|
||||
'x [`http://www.example.com/foo`](http://www.example.com/foo) y [http://www.example.com/bar](http://www.example.com/bar) z');
|
||||
});
|
||||
@@ -71,7 +71,7 @@ suite('typescript.previewer', () => {
|
||||
markdownDocumentation(
|
||||
'x {@link http://www.example.com/foo y {@link http://www.example.com/bar bar} z',
|
||||
[],
|
||||
noopToResource
|
||||
noopToResource, undefined
|
||||
).value,
|
||||
'x {@link http://www.example.com/foo y [bar](http://www.example.com/bar) z');
|
||||
});
|
||||
|
||||
@@ -199,9 +199,11 @@ export function markdownDocumentation(
|
||||
documentation: Proto.SymbolDisplayPart[] | string,
|
||||
tags: Proto.JSDocTagInfo[],
|
||||
filePathConverter: IFilePathToResourceConverter,
|
||||
baseUri: vscode.Uri | undefined,
|
||||
): vscode.MarkdownString {
|
||||
const out = new vscode.MarkdownString();
|
||||
addMarkdownDocumentation(out, documentation, tags, filePathConverter);
|
||||
out.baseUri = baseUri;
|
||||
return out;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
"../../src/vscode-dts/vscode.d.ts",
|
||||
"../../src/vscode-dts/vscode.proposed.inlayHints.d.ts",
|
||||
"../../src/vscode-dts/vscode.proposed.languageStatus.d.ts",
|
||||
"../../src/vscode-dts/vscode.proposed.markdownStringBaseUri.d.ts",
|
||||
"../../src/vscode-dts/vscode.proposed.resolvers.d.ts",
|
||||
"../../src/vscode-dts/vscode.proposed.workspaceTrust.d.ts",
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user