@@ -5,11 +5,7 @@ import {
55 onDidChangeConfiguration ,
66 registerCommand ,
77} from './utilities/common/vscodeapi'
8- import {
9- registerLogger ,
10- traceInfo ,
11- traceVerbose ,
12- } from './utilities/common/log'
8+ import { registerLogger , traceInfo , traceVerbose } from './utilities/common/log'
139import { onDidChangePythonInterpreter } from './utilities/common/python'
1410import { LSPClient } from './lsp/lsp'
1511import { AuthenticationProviderTobikoCloud } from './auth/auth'
@@ -18,12 +14,11 @@ import { signIn } from './commands/signin'
1814import { signInSpecifyFlow } from './commands/signinSpecifyFlow'
1915import { isErr } from './utilities/functional/result'
2016import {
17+ handleNotSginedInError ,
2118 handleSqlmeshLspNotFoundError ,
2219 handleSqlmeshLspDependenciesMissingError ,
23- handleNotSginedInError ,
2420} from './utilities/errors'
2521import { selector , completionProvider } from './completion/completion'
26- import { WebServer } from './web-server/server'
2722import { LineagePanel } from './webviews/lineagePanel'
2823
2924let lspClient : LSPClient | undefined
@@ -38,12 +33,6 @@ export async function activate(context: vscode.ExtensionContext) {
3833 )
3934 traceInfo ( 'Activating SQLMesh extension' )
4035
41- const webServerOutputChannel = createOutputChannel ( 'sqlmesh-webserver' )
42- context . subscriptions . push (
43- webServerOutputChannel ,
44- registerLogger ( webServerOutputChannel ) ,
45- )
46-
4736 traceInfo ( 'Registering authentication provider' )
4837 const authProvider = new AuthenticationProviderTobikoCloud ( )
4938 context . subscriptions . push (
@@ -95,6 +84,13 @@ export async function activate(context: vscode.ExtensionContext) {
9584 context . subscriptions . push ( lspClient )
9685 }
9786
87+ context . subscriptions . push (
88+ vscode . languages . registerCompletionItemProvider (
89+ selector ,
90+ completionProvider ( lspClient ) ,
91+ ) ,
92+ )
93+
9894 // Register the webview
9995 const lineagePanel = new LineagePanel ( context . extensionUri , lspClient )
10096 context . subscriptions . push (
@@ -109,8 +105,24 @@ export async function activate(context: vscode.ExtensionContext) {
109105 traceVerbose ( 'Restarting LSP client' )
110106 const restartResult = await lspClient . restart ( )
111107 if ( isErr ( restartResult ) ) {
112- handleNotSginedInError ( authProvider )
108+ switch ( restartResult . error . type ) {
109+ case 'not_signed_in' :
110+ await handleNotSginedInError ( authProvider )
111+ return
112+ case 'sqlmesh_lsp_not_found' :
113+ await handleSqlmeshLspNotFoundError ( )
114+ return
115+ case 'sqlmesh_lsp_dependencies_missing' :
116+ await handleSqlmeshLspDependenciesMissingError ( restartResult . error )
117+ return
118+ case 'generic' :
119+ await vscode . window . showErrorMessage (
120+ `Failed to restart LSP: ${ restartResult . error . message } ` ,
121+ )
122+ return
123+ }
113124 }
125+ context . subscriptions . push ( lspClient )
114126 }
115127 }
116128
0 commit comments