@@ -50,6 +50,7 @@ async def create(
5050 base_path : Path = Path ("." ),
5151 initial_code : str = "" ,
5252 options : t .Mapping = {},
53+ initialize_params : types .InitializeParams | None = None ,
5354 pool : LSPProcessPool | None = None ,
5455 ) -> t .Self :
5556 """Create a new LSP session using the provided backend"""
@@ -65,14 +66,19 @@ async def create_lsp_process():
6566 await lsp_process .start ()
6667
6768 # Initialize LSP connection
68- await lsp_process .send .initialize (
69- {
70- "processId" : None ,
71- "rootUri" : f"file://{ base_path } " ,
72- "rootPath" : base_path_str ,
73- "capabilities" : backend .get_lsp_capabilities (),
74- }
75- )
69+ resolved_initialize_params : types .InitializeParams = {
70+ "processId" : None ,
71+ "rootUri" : f"file://{ base_path } " ,
72+ "rootPath" : base_path_str ,
73+ "capabilities" : backend .get_lsp_capabilities (),
74+ }
75+
76+ if initialize_params is not None :
77+ resolved_initialize_params = (
78+ resolved_initialize_params | initialize_params
79+ )
80+
81+ await lsp_process .send .initialize (resolved_initialize_params )
7682
7783 # Send initialized notification (required by LSP spec)
7884 await lsp_process .notify .initialized ({})
0 commit comments