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

Function getActiveFilePath

src/utils/workspaceUtils.ts:62–78  ·  view source on GitHub ↗
(uri?: vscode.Uri)

Source from the content-addressed store, hash-verified

60}
61
62export async function getActiveFilePath(uri?: vscode.Uri): Promise<string | undefined> {
63 let textEditor: vscode.TextEditor | undefined;
64 if (uri) {
65 textEditor = await vscode.window.showTextDocument(uri, { preview: false });
66 } else {
67 textEditor = vscode.window.activeTextEditor;
68 }
69
70 if (!textEditor) {
71 return undefined;
72 }
73 if (textEditor.document.isDirty && !await textEditor.document.save()) {
74 vscode.window.showWarningMessage("Please save the solution file first.");
75 return undefined;
76 }
77 return wsl.useWsl() ? wsl.toWslPath(textEditor.document.uri.fsPath) : textEditor.document.uri.fsPath;
78}
79
80function isSubFolder(from: string, to: string): boolean {
81 const relative: string = path.relative(from, to);

Callers 3

testSolutionFunction · 0.90
submitSolutionFunction · 0.90
showSolutionFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected