Skip to content

Commit

Permalink
Return early when fetching dependencies if client is not running (#2276)
Browse files Browse the repository at this point in the history
  • Loading branch information
vinistock authored Jul 9, 2024
1 parent e27dec2 commit 3b6770d
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions vscode/src/dependenciesTree.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import path from "path";

import * as vscode from "vscode";
import { State } from "vscode-languageclient";

import { STATUS_EMITTER, WorkspaceInterface } from "./common";

Expand Down Expand Up @@ -148,11 +149,17 @@ export class DependenciesTree
private async fetchDependencies(): Promise<BundlerTreeNode[]> {
this.gemRootFolders = {};

if (!this.currentWorkspace || !this.currentWorkspace.lspClient) {
if (!this.currentWorkspace) {
return [];
}

const resp = (await this.currentWorkspace.lspClient.sendRequest(
const client = this.currentWorkspace.lspClient;

if (!client || client.state !== State.Running) {
return [];
}

const resp = (await client.sendRequest(
"rubyLsp/workspace/dependencies",
{},
)) as [
Expand Down

0 comments on commit 3b6770d

Please sign in to comment.