File tree 3 files changed +51
-4
lines changed
3 files changed +51
-4
lines changed Original file line number Diff line number Diff line change @@ -46,6 +46,7 @@ import { runTask } from "./commands/runTask";
46
46
import { TestKind } from "./TestExplorer/TestKind" ;
47
47
import { pickProcess } from "./commands/pickProcess" ;
48
48
import { openDocumentation } from "./commands/openDocumentation" ;
49
+ import showFolderSelectionQuickPick from "./utilities/folderQuickPick" ;
49
50
50
51
/**
51
52
* References:
@@ -147,10 +148,16 @@ export function register(ctx: WorkspaceContext): vscode.Disposable[] {
147
148
vscode . commands . registerCommand ( Commands . RUN_PLUGIN_TASK , ( ) => runPluginTask ( ) ) ,
148
149
vscode . commands . registerCommand ( Commands . RUN_TASK , name => runTask ( ctx , name ) ) ,
149
150
vscode . commands . registerCommand ( "swift.restartLSPServer" , async ( ) => {
150
- if ( ! ctx . currentFolder ) {
151
+ const folder =
152
+ ctx . currentFolder ??
153
+ ( await showFolderSelectionQuickPick (
154
+ ctx ,
155
+ "Select a folder to restart the LSP server for"
156
+ ) ) ;
157
+ if ( ! folder ) {
151
158
return ;
152
159
}
153
- const languageClientManager = ctx . languageClientManager . get ( ctx . currentFolder ) ;
160
+ const languageClientManager = ctx . languageClientManager . get ( folder ) ;
154
161
await languageClientManager . restart ( ) ;
155
162
} ) ,
156
163
vscode . commands . registerCommand ( "swift.reindexProject" , ( ) => reindexProject ( ctx ) ) ,
Original file line number Diff line number Diff line change @@ -17,14 +17,16 @@ import { FolderContext } from "../../FolderContext";
17
17
import { createSwiftTask , SwiftTaskProvider } from "../../tasks/SwiftTaskProvider" ;
18
18
import { WorkspaceContext } from "../../WorkspaceContext" ;
19
19
import { executeTaskWithUI , updateAfterError } from "../utilities" ;
20
+ import showFolderSelectionQuickPick from "../../utilities/folderQuickPick" ;
20
21
21
22
/**
22
23
* Executes a {@link vscode.Task task} to resolve this package's dependencies.
23
24
*/
24
25
export async function resolveDependencies ( ctx : WorkspaceContext ) {
25
- const current = ctx . currentFolder ;
26
+ const current =
27
+ ctx . currentFolder ??
28
+ ( await showFolderSelectionQuickPick ( ctx , "Select a folder to resolve dependencies for" ) ) ;
26
29
if ( ! current ) {
27
- ctx . outputChannel . log ( "currentFolder is not set." ) ;
28
30
return false ;
29
31
}
30
32
return await resolveFolderDependencies ( current ) ;
Original file line number Diff line number Diff line change
1
+ //===----------------------------------------------------------------------===//
2
+ //
3
+ // This source file is part of the VS Code Swift open source project
4
+ //
5
+ // Copyright (c) 2025 the VS Code Swift project authors
6
+ // Licensed under Apache License v2.0
7
+ //
8
+ // See LICENSE.txt for license information
9
+ // See CONTRIBUTORS.txt for the list of VS Code Swift project authors
10
+ //
11
+ // SPDX-License-Identifier: Apache-2.0
12
+ //
13
+ //===----------------------------------------------------------------------===//
14
+
15
+ import * as vscode from "vscode" ;
16
+ import { WorkspaceContext } from "../WorkspaceContext" ;
17
+ import { FolderContext } from "../FolderContext" ;
18
+
19
+ export default async function showFolderSelectionQuickPick (
20
+ ctx : WorkspaceContext ,
21
+ placeHolder : string = "Select a folder"
22
+ ) : Promise < FolderContext | undefined > {
23
+ const folders : vscode . QuickPickItem [ ] = ctx . folders . map ( folder => ( {
24
+ label : folder . name ,
25
+ description : folder . folder . fsPath . toString ( ) ,
26
+ } ) ) ;
27
+ const selected = await vscode . window . showQuickPick ( folders , {
28
+ title : "Toolchain Configuration" ,
29
+ placeHolder : placeHolder ,
30
+ canPickMany : false ,
31
+ } ) ;
32
+
33
+ if ( ! selected ) {
34
+ return undefined ;
35
+ }
36
+
37
+ return ctx . folders . find ( folder => folder . name === selected . label ) ;
38
+ }
You can’t perform that action at this time.
0 commit comments