+ async onWorkspaceFolderChanges() {
+ const workspace = fetchWorkspace();
+ if (workspace.kind === "Detached Files" && this.workspace.kind === "Detached Files") {
+ if (workspace.files !== this.workspace.files) {
+ if (this.client?.isRunning()) {
+ // Ideally we wouldn't need to tear down the server here, but currently detached files
+ // are only specified at server start
+ await this.stopAndDispose();
+ await this.start();
+ }
+ return;
+ }
+ }
+ if (workspace.kind === "Workspace Folder" && this.workspace.kind === "Workspace Folder") {
+ return;
+ }
+ if (workspace.kind === "Empty") {
+ await this.stopAndDispose();
+ return;
+ }
+ if (this.client?.isRunning()) {
+ await this.restart();
+ }