Skip to content

Commit

Permalink
only create one output channel for the language server (#7160)
Browse files Browse the repository at this point in the history
  • Loading branch information
hlshen committed May 10, 2024
1 parent d2e1172 commit 03176c5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
14 changes: 8 additions & 6 deletions firebase-vscode/src/data-connect/index.ts
Expand Up @@ -153,17 +153,19 @@ export function registerFdc(
);
const schemaCodeLensProvider = new SchemaCodeLensProvider(emulatorController);

// activate language client/serer
let client: LanguageClient;
const lsOutputChannel: vscode.OutputChannel = vscode.window.createOutputChannel(
"Firebase GraphQL Language Server",
);

// setup new language client on config change
context.subscriptions.push({
dispose: effect(() => {
const configs = dataConnectConfigs.value?.tryReadValue;
if (client) client.stop();
if (configs && configs.values.length > 0) {
client = setupLanguageClient(
context,
configs,
);
client = setupLanguageClient(context, configs, lsOutputChannel);
vscode.commands.executeCommand("fdc-graphql.start");
}
}),
Expand All @@ -179,7 +181,7 @@ export function registerFdc(
vscode.commands.executeCommand(
"firebase.dataConnect.executeIntrospection",
);
runEmulatorIssuesStream(configs,fdcService.localEndpoint.value);
runEmulatorIssuesStream(configs, fdcService.localEndpoint.value);
runDataConnectCompiler(configs, fdcService.localEndpoint.value);
}
}),
Expand All @@ -205,7 +207,7 @@ export function registerFdc(
return Disposable.from(
codeActions,
selectedProjectStatus,
{dispose: sub1},
{ dispose: sub1 },
{
dispose: effect(() => {
selectedProjectStatus.text = `$(mono-firebase) ${
Expand Down
6 changes: 1 addition & 5 deletions firebase-vscode/src/data-connect/language-client.ts
Expand Up @@ -12,12 +12,8 @@ import { ResolvedDataConnectConfigs } from "./config";
export function setupLanguageClient(
context,
configs: ResolvedDataConnectConfigs,
outputChannel: vscode.OutputChannel,
) {
// activate language client/serer
const outputChannel: vscode.OutputChannel = vscode.window.createOutputChannel(
"Firebase GraphQL Language Server",
);

const serverPath = path.join("dist", "server.js");
const serverModule = context.asAbsolutePath(serverPath);

Expand Down

0 comments on commit 03176c5

Please sign in to comment.