mirror of
https://github.com/Myriad-Dreamin/tinymist.git
synced 2025-08-03 17:58:17 +00:00
feat: support rest code lens (#45)
This commit is contained in:
parent
2d2857e6f3
commit
be244840b2
2 changed files with 21 additions and 1 deletions
|
@ -39,7 +39,7 @@ impl CodeLensRequest {
|
||||||
res.push(doc_lens("Preview", vec!["preview".into()]));
|
res.push(doc_lens("Preview", vec!["preview".into()]));
|
||||||
res.push(doc_lens("Preview in ..", vec!["preview-in".into()]));
|
res.push(doc_lens("Preview in ..", vec!["preview-in".into()]));
|
||||||
res.push(doc_lens("Export PDF", vec!["export-pdf".into()]));
|
res.push(doc_lens("Export PDF", vec!["export-pdf".into()]));
|
||||||
res.push(doc_lens("Export ..", vec!["export-as".into()]));
|
res.push(doc_lens("Export as ..", vec!["export-as".into()]));
|
||||||
|
|
||||||
Some(res)
|
Some(res)
|
||||||
}
|
}
|
||||||
|
|
|
@ -245,9 +245,22 @@ async function commandRunCodeLens(...args: string[]): Promise<void> {
|
||||||
|
|
||||||
switch (args[0]) {
|
switch (args[0]) {
|
||||||
case "preview": {
|
case "preview": {
|
||||||
|
void vscode.commands.executeCommand(`typst-preview.preview`);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "preview-in": {
|
case "preview-in": {
|
||||||
|
// prompt for enum (doc, slide) with default
|
||||||
|
const mode = await vscode.window.showQuickPick(["doc", "slide"], {
|
||||||
|
title: "Preview Mode",
|
||||||
|
});
|
||||||
|
const target = await vscode.window.showQuickPick(["tab", "browser"], {
|
||||||
|
title: "Target to preview in",
|
||||||
|
});
|
||||||
|
|
||||||
|
const command =
|
||||||
|
(target === "tab" ? "preview" : "browser") + (mode === "slide" ? "-slide" : "");
|
||||||
|
|
||||||
|
void vscode.commands.executeCommand(`typst-preview.${command}`);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "export-pdf": {
|
case "export-pdf": {
|
||||||
|
@ -255,6 +268,13 @@ async function commandRunCodeLens(...args: string[]): Promise<void> {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "export-as": {
|
case "export-as": {
|
||||||
|
const fmt = await vscode.window.showQuickPick(["pdf"], {
|
||||||
|
title: "Format to export as",
|
||||||
|
});
|
||||||
|
|
||||||
|
if (fmt === "pdf") {
|
||||||
|
await commandShowPdf();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue