MCPcopy Index your code
hub / github.com/LeetCode-OpenSource/vscode-leetcode / determineLeetCodeFolder

Function determineLeetCodeFolder

src/utils/workspaceUtils.ts:88–122  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

86}
87
88async function determineLeetCodeFolder(): Promise<string> {
89 let result: string;
90 const picks: Array<IQuickItemEx<string>> = [];
91 picks.push(
92 {
93 label: `Default location`,
94 detail: `${path.join(os.homedir(), ".leetcode")}`,
95 value: `${path.join(os.homedir(), ".leetcode")}`,
96 },
97 {
98 label: "$(file-directory) Browse...",
99 value: ":browse",
100 },
101 );
102 const choice: IQuickItemEx<string> | undefined = await vscode.window.showQuickPick(
103 picks,
104 { placeHolder: "Select where you would like to save your LeetCode files" },
105 );
106 if (!choice) {
107 result = "";
108 } else if (choice.value === ":browse") {
109 const directory: vscode.Uri[] | undefined = await showDirectorySelectDialog();
110 if (!directory || directory.length < 1) {
111 result = "";
112 } else {
113 result = directory[0].fsPath;
114 }
115 } else {
116 result = choice.value;
117 }
118
119 getWorkspaceConfiguration().update("workspaceFolder", result, vscode.ConfigurationTarget.Global);
120
121 return result;
122}
123
124enum OpenOption {
125 justOpenFile = "Just open the problem file",

Callers 1

selectWorkspaceFolderFunction · 0.85

Calls 2

Tested by

no test coverage detected