@@ -2,12 +2,14 @@ import * as vscode from "vscode";
22import * as lsp from "vscode-languageclient/node" ;
33
44import { debugAdapter } from "./debugAdapter.ts" ;
5+
6+ import * as cmds from "./commands.ts" ;
7+
58import { kernelManager } from "./kernelManager.ts" ;
69import { languageClient } from "./languageClient.ts" ;
7- import { notebookSerializer } from "./notebookSerializer.ts" ;
810
911import { Logger } from "./logging.ts" ;
10- import * as cmds from "./commands .ts" ;
12+ import { notebookSerializer } from "./notebookSerializer .ts" ;
1113import { notebookType } from "./types.ts" ;
1214
1315export async function activate ( context : vscode . ExtensionContext ) {
@@ -42,28 +44,31 @@ export async function activate(context: vscode.ExtensionContext) {
4244 } ) ,
4345 ) ;
4446
45- await client . start ( ) . then ( ( ) => {
46- Logger . info ( "Extension.Lifecycle" , "LSP client started successfully" ) ;
47- // Forward logs from the LSP server
48- client . onNotification (
49- "window/logMessage" ,
50- ( { type, message } : lsp . LogMessageParams ) => {
51- const mapping = {
52- [ lsp . MessageType . Error ] : "error" ,
53- [ lsp . MessageType . Warning ] : "warn" ,
54- [ lsp . MessageType . Info ] : "info" ,
55- [ lsp . MessageType . Log ] : "info" ,
56- [ lsp . MessageType . Debug ] : "debug" ,
57- } as const ;
58- Logger [ mapping [ type ] ] ( "LSP.Server" , message ) ;
59- } ,
60- ) ;
61- } ) . catch ( ( error ) => {
62- Logger . error ( "Extension.Lifecycle" , "Failed to start LSP client" , error ) ;
63- vscode . window . showErrorMessage (
64- `Marimo language server failed to start ${ JSON . stringify ( error . message ) } ` ,
65- ) ;
66- } ) ;
47+ await client
48+ . start ( )
49+ . then ( ( ) => {
50+ Logger . info ( "Extension.Lifecycle" , "LSP client started successfully" ) ;
51+ // Forward logs from the LSP server
52+ client . onNotification (
53+ "window/logMessage" ,
54+ ( { type, message } : lsp . LogMessageParams ) => {
55+ const mapping = {
56+ [ lsp . MessageType . Error ] : "error" ,
57+ [ lsp . MessageType . Warning ] : "warn" ,
58+ [ lsp . MessageType . Info ] : "info" ,
59+ [ lsp . MessageType . Log ] : "info" ,
60+ [ lsp . MessageType . Debug ] : "debug" ,
61+ } as const ;
62+ Logger [ mapping [ type ] ] ( "LSP.Server" , message ) ;
63+ } ,
64+ ) ;
65+ } )
66+ . catch ( ( error ) => {
67+ Logger . error ( "Extension.Lifecycle" , "Failed to start LSP client" , error ) ;
68+ vscode . window . showErrorMessage (
69+ `Marimo language server failed to start ${ JSON . stringify ( error . message ) } ` ,
70+ ) ;
71+ } ) ;
6772 Logger . info ( "Extension.Lifecycle" , "Activation complete" ) ;
6873}
6974
0 commit comments