forked from terrastruct/d2-vscode
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4f0717d
commit 78b9273
Showing
6 changed files
with
137 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import { QuickPickItem, window } from "vscode"; | ||
|
||
/** | ||
* Container for D2 Sketch Mode | ||
*/ | ||
class SketchItem implements QuickPickItem { | ||
label: string; | ||
value: number; | ||
|
||
constructor(l: string, n: number) { | ||
this.label = l; | ||
this.value = n; | ||
} | ||
} | ||
|
||
/** | ||
* List of sketch modes with their numeric values | ||
*/ | ||
const sketches: SketchItem[] = [ | ||
new SketchItem("default", -1), | ||
new SketchItem("false", 0), | ||
new SketchItem("true", 1), | ||
]; | ||
|
||
const SketchSwitch = "--sketch="; | ||
|
||
export function GetSketchSwitch(sketch: string): string { | ||
let sketchVal = 0; | ||
for (const s in sketches) { | ||
if (sketches[s].label === sketch) { | ||
sketchVal = sketches[s].value; | ||
} | ||
} | ||
|
||
if (sketchVal === -1) { | ||
return ""; | ||
} | ||
|
||
return SketchSwitch + sketch; | ||
} | ||
|
||
/** | ||
* themePicker - This will show the quick pick list in | ||
* the command pallette when called | ||
*/ | ||
export class sketchPicker { | ||
showPicker(): Thenable<QuickPickItem | undefined> { | ||
return window.showQuickPick(sketches, { | ||
title: "Sketch", | ||
canPickMany: false, | ||
placeHolder: "Choose show as sketch...", | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters