mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-20 17:20:00 +00:00
Throw error if no folder is opened
This commit is contained in:
parent
6e535915bd
commit
a781a58fe2
3 changed files with 9 additions and 4 deletions
|
@ -30,14 +30,14 @@ export function configToServerOptions(config: Config) {
|
|||
};
|
||||
}
|
||||
|
||||
export async function createClient(config: Config, serverPath: string, workspaceFolder: vscode.WorkspaceFolder | null): Promise<lc.LanguageClient> {
|
||||
export async function createClient(config: Config, serverPath: string, workspaceFolder: vscode.WorkspaceFolder): Promise<lc.LanguageClient> {
|
||||
// '.' Is the fallback if no folder is open
|
||||
// TODO?: Workspace folders support Uri's (eg: file://test.txt).
|
||||
// It might be a good idea to test if the uri points to a file.
|
||||
|
||||
const run: lc.Executable = {
|
||||
command: serverPath,
|
||||
options: { cwd: workspaceFolder?.uri.fsPath ?? '.' },
|
||||
options: { cwd: workspaceFolder.uri.fsPath },
|
||||
};
|
||||
const serverOptions: lc.ServerOptions = {
|
||||
run,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue