Skip to content

Commit

Permalink
feat(lsp): added support for dynamic capabilities (#2594)
Browse files Browse the repository at this point in the history
  • Loading branch information
folke authored and jamestrew committed Jul 24, 2023
1 parent 1228f3b commit f8437d1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
3 changes: 2 additions & 1 deletion lua/telescope/_.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ local log = require "plenary.log"

local async = require "plenary.async"
local channel = require("plenary.async").control.channel
local utils = require "telescope.utils"

local M = {}

Expand All @@ -21,7 +22,7 @@ function AsyncJob.new(opts)
self.stderr = opts.stderr or M.NullPipe()

if opts.cwd and opts.cwd ~= "" then
self.uv_opts.cwd = vim.fn.expand(vim.fn.escape(opts.cwd, "$"))
self.uv_opts.cwd = utils.smart_path_expand(opts.cwd)
-- this is a "illegal" hack for windows. E.g. If the git command returns `/` rather than `\` as delimiter,
-- vim.fn.expand might just end up returning an empty string. Weird
-- Because empty string is not allowed in libuv the job will not spawn. Solution is we just set it to opts.cwd
Expand Down
3 changes: 2 additions & 1 deletion lua/telescope/from_entry.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ This file is still WIP, so expect some changes if you're trying to consume these
This will provide standard mechanism for accessing information from an entry.
--============================================================================= ]]
local utils = require "telescope.utils"

local from_entry = {}

Expand All @@ -30,7 +31,7 @@ function from_entry.path(entry, validate, escape)
-- TODO(conni2461): we are not going to return the expanded path because
-- this would lead to cache misses in the perviewer.
-- Requires overall refactoring in previewer interface
local expanded = vim.fn.expand(vim.fn.escape(path, "$?*[]"))
local expanded = utils.smart_path_expand(path)
if (vim.fn.filereadable(expanded) + vim.fn.isdirectory(expanded)) == 0 then
return
end
Expand Down
6 changes: 5 additions & 1 deletion lua/telescope/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ local get_status = require("telescope.state").get_status

local utils = {}

utils.smart_path_expand = function(path)
return path:match "^[%%#<]" and vim.fn.expand(path) or path
end

utils.get_separator = function()
return Path.path.sep
end
Expand Down Expand Up @@ -221,7 +225,7 @@ utils.transform_path = function(opts, path)
if opts.cwd then
cwd = opts.cwd
if not vim.in_fast_event() then
cwd = vim.fn.expand(opts.cwd)
cwd = utils.smart_path_expand(opts.cwd)
end
else
cwd = vim.loop.cwd()
Expand Down

0 comments on commit f8437d1

Please sign in to comment.