Skip to content

Commit 6950c43

Browse files
committed
temp
1 parent 23d149b commit 6950c43

3 files changed

Lines changed: 24 additions & 3 deletions

File tree

sqlmesh/lsp/main.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@
2323
ApiResponseGetLineage,
2424
ApiResponseGetModels,
2525
)
26+
27+
# Define the command constant
28+
EXTERNAL_MODEL_UPDATE_COLUMNS = "sqlmesh.external_model_update_columns"
29+
2630
from sqlmesh.lsp.completions import get_sql_completions
2731
from sqlmesh.lsp.context import (
2832
LSPContext,

vscode/extension/src/extension.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,7 @@ export async function activate(context: vscode.ExtensionContext) {
131131
'LSP restart failed',
132132
)
133133
}
134-
context.subscriptions.push(lspClient)
135-
context.subscriptions.push(setupTestController(lspClient))
134+
// Don't push to subscriptions again during restart - it's already there
136135
} else {
137136
lspClient = new LSPClient()
138137
const result = await lspClient.start(invokedByUser)

vscode/extension/src/lsp/lsp.ts

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,24 @@ export class LSPClient implements Disposable {
135135
serverOptions,
136136
clientOptions,
137137
)
138-
await this.client.start()
138+
try {
139+
await this.client.start()
140+
} catch (error: any) {
141+
// Ignore the specific error about command already being registered
142+
if (
143+
error?.message?.includes(
144+
"command 'sqlmesh.external_model_update_columns' already exists",
145+
)
146+
) {
147+
traceInfo(
148+
'Ignoring duplicate command registration error during restart',
149+
)
150+
// Continue normally - the client is still functional
151+
} else {
152+
// Re-throw other errors
153+
throw error
154+
}
155+
}
139156
return ok(undefined)
140157
}
141158

@@ -149,6 +166,7 @@ export class LSPClient implements Disposable {
149166
public async stop(stoppedByUser = false): Promise<void> {
150167
if (this.client) {
151168
await this.client.stop()
169+
await this.client.dispose()
152170
this.client = undefined
153171
// Reset supported methods state when the client stops
154172
this.supportedMethodsState = { type: 'not-fetched' }

0 commit comments

Comments
 (0)