autoload/lsp/util.vim | 14 +++++++++----- diff --git a/autoload/lsp/util.vim b/autoload/lsp/util.vim index 62d936ffc51e1cec6c08dea0a852966dd90a3bd0..2b157de1edea4de98ad9cfb6201e07d06e9e8d3a 100644 --- a/autoload/lsp/util.vim +++ b/autoload/lsp/util.vim @@ -111,17 +111,21 @@ var resolvedUris = {} # Convert a Vim filename to an LSP URI (file://) export def LspFileToUri(fname: string): string - if resolvedUris->has_key(fname) - return resolvedUris[fname] + var fname_full: string = fname->fnamemodify(':p') + + if resolvedUris->has_key(fname_full) + return resolvedUris[fname_full] endif - var uri: string = fname->fnamemodify(':p') + var uri: string if has("win32unix") # We're in Cygwin, convert POSIX style paths to Windows style. # The substitution is to remove the '^@' escape character from the end of # line. - uri = system($'cygpath -m {uri}')->substitute('^\(\p*\).*$', '\=submatch(1)', "") + uri = system($'cygpath -m {fname_full}')->substitute('^\(\p*\).*$', '\=submatch(1)', "") + else + uri = fname_full endif var on_windows: bool = false @@ -143,7 +147,7 @@ else uri = $'file://{uri}' endif - resolvedUris[fname] = uri + resolvedUris[fname_full] = uri return uri enddef