Skip to content

Commit

Permalink
chore(participant): move state to history VSCODE-583
Browse files Browse the repository at this point in the history
  • Loading branch information
alenakhineika committed Sep 14, 2024
1 parent 3f720ab commit a8a0405
Show file tree
Hide file tree
Showing 2 changed files with 244 additions and 257 deletions.
32 changes: 32 additions & 0 deletions src/participant/markdown.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import * as vscode from 'vscode';

export function createMarkdownLink({
commandId,
data,
name,
}: {
commandId: string;
data?:
| {
[field: string]: any;
}
| string;
name: string;
}): vscode.MarkdownString {
const encodedData = data
? encodeURIComponent(
`["${
typeof data === 'string'
? data
: encodeURIComponent(JSON.stringify(data))
}"]`
)
: undefined;
const commandQueryString = data ? `?${encodedData}` : '';
const connName = new vscode.MarkdownString(
`- <a href="command:${commandId}${commandQueryString}">${name}</a>\n`
);
connName.supportHtml = true;
connName.isTrusted = { enabledCommands: [commandId] };
return connName;
}
Loading

0 comments on commit a8a0405

Please sign in to comment.