]> Sergey Matveev's repositories - vim-lsp.git/commitdiff
Use the CWD as the "rootUri" and initial "workspaceFolder"
authorAndreas Louv <andreas@louv.dk>
Fri, 7 Apr 2023 22:11:29 +0000 (00:11 +0200)
committerAndreas Louv <andreas@louv.dk>
Mon, 10 Apr 2023 12:22:07 +0000 (14:22 +0200)
autoload/lsp/lspserver.vim
doc/lsp.txt

index 89822e48cb59108ed34d9d108944cfd8e505432f..2d71cd9a0479c7d04ce7141dedd776b499f85e40 100644 (file)
@@ -153,14 +153,14 @@ def InitServer(lspserver: dict<any>, bnr: number)
       }
 
   # Compute the rootpath (based on the directory of the buffer)
-  var bufDir = bnr->bufname()->fnamemodify(':p:h')
   var rootPath = ''
   var rootSearchFiles = lspserver.rootSearchFiles
   if !rootSearchFiles->empty()
+    var bufDir = bnr->bufname()->fnamemodify(':p:h')
     rootPath = util.FindNearestRootDir(bufDir, rootSearchFiles)
   endif
   if rootPath == ''
-    rootPath = bufDir
+    rootPath = getcwd()
   endif
 
   lspserver.workspaceFolders = [rootPath]
index 8f40636d3f93f7b72e97acc913ac1800d6b52391..6ea8a030e78675cd64120a333672c528ab63eb06 100644 (file)
@@ -271,8 +271,7 @@ To add a language server, the following information is needed:
                        closest to the directory of the current buffer is used
                        as the workspace root.  If this parameter is not
                        specified or the files are not found, then the
-                       directory of the current buffer is used as the
-                       workspace root.
+                       current working directory is used as the workspace root.
 
 Aditionally the following configurations can be made: