Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

chore: fix port NaN (#9752)

Liu Jif591dedd4a7a
diff --git a/frontend/src/components/MonacoEditor/lsp-client.ts b/frontend/src/components/MonacoEditor/lsp-client.ts
index 3cc5ca88ab..c46f91e919 100644
--- a/frontend/src/components/MonacoEditor/lsp-client.ts
+++ b/frontend/src/components/MonacoEditor/lsp-client.ts
@@ -35,14 +35,13 @@ export const createLanguageClient = (
};
export const createUrl = (
- hostname: string,
- port: number,
+ host: string,
path: string,
searchParams: Record<string, any> = {},
secure: boolean = location.protocol === "https:"
): string => {
const protocol = secure ? "wss" : "ws";
- const url = new URL(`${protocol}://${hostname}:${port}${path}`);
+ const url = new URL(`${protocol}://${host}${path}`);
for (const [key, value] of Object.entries(searchParams)) {
const v = value instanceof Array ? value.join(",") : value;
@@ -88,7 +87,7 @@ const state = {
};
const initializeRunner = async () => {
- const url = createUrl(location.hostname, parseInt(location.port, 10), "/lsp");
+ const url = createUrl(location.host, "/lsp");
const client = await createWebSocketAndStartClient(url).languageClient;
state.client = client;
return client;