fix(windows): convert posix paths before matching LSP watch globs (#374)
This commit is contained in:
parent
3283deec96
commit
f630887cd8
2 changed files with 16 additions and 0 deletions
|
|
@ -1,4 +1,5 @@
|
|||
local config = require("oil.config")
|
||||
local fs = require("oil.fs")
|
||||
local util = require("oil.util")
|
||||
local workspace = require("oil.lsp.workspace")
|
||||
|
||||
|
|
@ -17,23 +18,32 @@ M.will_perform_file_operations = function(actions)
|
|||
local src_adapter = assert(config.get_adapter_by_scheme(src_scheme))
|
||||
local dest_scheme, dest_path = util.parse_url(action.dest_url)
|
||||
local dest_adapter = assert(config.get_adapter_by_scheme(dest_scheme))
|
||||
src_path = fs.posix_to_os_path(src_path)
|
||||
dest_path = fs.posix_to_os_path(assert(dest_path))
|
||||
if src_adapter.name == "files" and dest_adapter.name == "files" then
|
||||
moves[src_path] = dest_path
|
||||
elseif src_adapter.name == "files" then
|
||||
table.insert(deletes, src_path)
|
||||
elseif dest_adapter.name == "files" then
|
||||
table.insert(creates, src_path)
|
||||
end
|
||||
elseif action.type == "create" then
|
||||
local scheme, path = util.parse_url(action.url)
|
||||
path = fs.posix_to_os_path(assert(path))
|
||||
local adapter = assert(config.get_adapter_by_scheme(scheme))
|
||||
if adapter.name == "files" then
|
||||
table.insert(creates, path)
|
||||
end
|
||||
elseif action.type == "delete" then
|
||||
local scheme, path = util.parse_url(action.url)
|
||||
path = fs.posix_to_os_path(assert(path))
|
||||
local adapter = assert(config.get_adapter_by_scheme(scheme))
|
||||
if adapter.name == "files" then
|
||||
table.insert(deletes, path)
|
||||
end
|
||||
elseif action.type == "copy" then
|
||||
local scheme, path = util.parse_url(action.dest_url)
|
||||
path = fs.posix_to_os_path(assert(path))
|
||||
local adapter = assert(config.get_adapter_by_scheme(scheme))
|
||||
if adapter.name == "files" then
|
||||
table.insert(creates, path)
|
||||
|
|
|
|||
|
|
@ -65,6 +65,12 @@ local function get_matching_paths(client, filters, paths)
|
|||
if ignore_case then
|
||||
glob = glob:lower()
|
||||
end
|
||||
|
||||
-- Some language servers use forward slashes as path separators on Windows (LuaLS)
|
||||
if fs.is_windows then
|
||||
glob = glob:gsub("/", "\\")
|
||||
end
|
||||
|
||||
---@type nil|vim.lpeg.Pattern
|
||||
local glob_pattern = vim.glob and vim.glob.to_lpeg and vim.glob.to_lpeg(glob)
|
||||
local matches = pattern.matches
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue