aboutsummaryrefslogtreecommitdiffstats
path: root/lua/lspconfig/util.lua
diff options
context:
space:
mode:
Diffstat (limited to 'lua/lspconfig/util.lua')
-rw-r--r--lua/lspconfig/util.lua16
1 files changed, 8 insertions, 8 deletions
diff --git a/lua/lspconfig/util.lua b/lua/lspconfig/util.lua
index f721c7df..2a3adfcf 100644
--- a/lua/lspconfig/util.lua
+++ b/lua/lspconfig/util.lua
@@ -2,10 +2,10 @@ local vim = vim
local validate = vim.validate
local api = vim.api
local lsp = vim.lsp
-local uv = vim.uv
+local uv = vim.uv or vim.loop
local nvim_eleven = vim.fn.has 'nvim-0.11' == 1
-local is_windows = uv.os_uname().version:match 'Windows'
+local iswin = uv.os_uname().version:match 'Windows'
local M = {}
@@ -106,7 +106,7 @@ M.path = (function()
--- @param path string
--- @return string
local function sanitize(path)
- if is_windows then
+ if iswin then
path = path:sub(1, 1):upper() .. path:sub(2)
path = path:gsub('\\', '/')
end
@@ -135,7 +135,7 @@ M.path = (function()
--- @param path string
--- @return boolean
local function is_fs_root(path)
- if is_windows then
+ if iswin then
return path:match '^%a:$'
else
return path == '/'
@@ -145,7 +145,7 @@ M.path = (function()
--- @param filename string
--- @return boolean
local function is_absolute(filename)
- if is_windows then
+ if iswin then
return filename:match '^%a:' or filename:match '^\\\\'
else
return filename:match '^/'
@@ -163,7 +163,7 @@ M.path = (function()
end
local result = path:gsub(strip_sep_pat, ''):gsub(strip_dir_pat, '')
if #result == 0 then
- if is_windows then
+ if iswin then
return path:sub(1, 2):upper()
else
return '/'
@@ -227,7 +227,7 @@ M.path = (function()
return dir == root
end
- local path_separator = is_windows and ';' or ':'
+ local path_separator = iswin and ';' or ':'
return {
escape_wildcards = escape_wildcards,
@@ -332,7 +332,7 @@ function M.insert_package_json(config_files, field, fname)
if root_with_package then
-- only add package.json if it contains field parameter
- local path_sep = is_windows and '\\' or '/'
+ local path_sep = iswin and '\\' or '/'
for line in io.lines(root_with_package .. path_sep .. 'package.json') do
if line:find(field) then
config_files[#config_files + 1] = 'package.json'