File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -235,7 +235,10 @@ impl Client {
235
235
236
236
pub ( crate ) async fn initialize ( & self ) -> Result < lsp:: InitializeResult > {
237
237
// TODO: delay any requests that are triggered prior to initialize
238
- let root = find_root ( None , & self . root_markers )
238
+ let root_path = find_root ( None , & self . root_markers ) ;
239
+
240
+ let root_uri = root_path
241
+ . clone ( )
239
242
. and_then ( |root| lsp:: Url :: from_file_path ( root) . ok ( ) ) ;
240
243
241
244
if self . config . is_some ( ) {
@@ -245,9 +248,10 @@ impl Client {
245
248
#[ allow( deprecated) ]
246
249
let params = lsp:: InitializeParams {
247
250
process_id : Some ( std:: process:: id ( ) ) ,
248
- // root_path is obsolete, use root_uri
249
- root_path : None ,
250
- root_uri : root,
251
+ // root_path is obsolete, but some clients like pyright still use it so we specify both.
252
+ // clients will prefer _uri if possible
253
+ root_path : root_path. and_then ( |path| path. to_str ( ) . map ( |path| path. to_owned ( ) ) ) ,
254
+ root_uri,
251
255
initialization_options : self . config . clone ( ) ,
252
256
capabilities : lsp:: ClientCapabilities {
253
257
workspace : Some ( lsp:: WorkspaceClientCapabilities {
You can’t perform that action at this time.
0 commit comments