Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

refactor: Stop using the 'vscode.workspace.rootPath' API#443

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
jdneo merged 1 commit intomasterfromcs/issue-442
Oct 2, 2019
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletionsrc/commands/test.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -65,7 +65,7 @@ export async function testSolution(uri?: vscode.Uri): Promise<void> {
}
break;
case ":file":
const testFile: vscode.Uri[] | undefined = await showFileSelectDialog();
const testFile: vscode.Uri[] | undefined = await showFileSelectDialog(filePath);
if (testFile && testFile.length) {
const input: string = (await fse.readFile(testFile[0].fsPath, "utf-8")).trim();
if (input) {
Expand Down
19 changes: 15 additions & 4 deletionssrc/utils/uiUtils.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -80,8 +80,8 @@ export async function openKeybindingsEditor(query?: string): Promise<void> {
await vscode.commands.executeCommand("workbench.action.openGlobalKeybindings", query);
}

export async function showFileSelectDialog(): Promise<vscode.Uri[] | undefined> {
const defaultUri: vscode.Uri | undefined =vscode.workspace.rootPath ? vscode.Uri.file(vscode.workspace.rootPath) : undefined;
export async function showFileSelectDialog(fsPath?: string): Promise<vscode.Uri[] | undefined> {
const defaultUri: vscode.Uri | undefined =getBelongingWorkspaceFolderUri(fsPath);
const options: vscode.OpenDialogOptions = {
defaultUri,
canSelectFiles: true,
Expand All@@ -92,8 +92,19 @@ export async function showFileSelectDialog(): Promise<vscode.Uri[] | undefined>
return await vscode.window.showOpenDialog(options);
}

export async function showDirectorySelectDialog(): Promise<vscode.Uri[] | undefined> {
const defaultUri: vscode.Uri | undefined = vscode.workspace.rootPath ? vscode.Uri.file(vscode.workspace.rootPath) : undefined;
function getBelongingWorkspaceFolderUri(fsPath: string | undefined): vscode.Uri | undefined {
let defaultUri: vscode.Uri | undefined;
if (fsPath) {
const workspaceFolder: vscode.WorkspaceFolder | undefined = vscode.workspace.getWorkspaceFolder(vscode.Uri.file(fsPath));
if (workspaceFolder) {
defaultUri = workspaceFolder.uri;
}
}
return defaultUri;
}

export async function showDirectorySelectDialog(fsPath?: string): Promise<vscode.Uri[] | undefined> {
const defaultUri: vscode.Uri | undefined = getBelongingWorkspaceFolderUri(fsPath);
const options: vscode.OpenDialogOptions = {
defaultUri,
canSelectFiles: false,
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp