# Compute the rootpath (based on the directory of the buffer)
var rootPath = ''
var rootSearchFiles = lspserver.rootSearchFiles
+ var bufDir = bnr->bufname()->fnamemodify(':p:h')
if !rootSearchFiles->empty()
- var bufDir = bnr->bufname()->fnamemodify(':p:h')
rootPath = util.FindNearestRootDir(bufDir, rootSearchFiles)
endif
if rootPath == ''
- rootPath = getcwd()
+ var cwd = getcwd()
+
+ # bufDir is within cwd
+ var bufDirPrefix = bufDir[0 : cwd->strcharlen() - 1]
+ if &fileignorecase
+ ? bufDirPrefix ==? cwd
+ : bufDirPrefix ==# cwd
+ rootPath = cwd
+ else
+ rootPath = bufDir
+ endif
endif
lspserver.workspaceFolders = [rootPath]
multiple directories are found, then the directory
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
- current working directory is used as the workspace root.
+ specified or the files are not found, then the current
+ working directory is used as the workspace root for
+ decendent files, for any other files the parent
+ directory of the file is used.
Aditionally the following configurations can be made: