From 6bc7bd7c60cb98c57ffc1a58a681c1f14d669ada Mon Sep 17 00:00:00 2001 From: TJ DeVries Date: Mon, 17 Jul 2023 13:20:09 -0400 Subject: [PATCH] fix: handle non-file uris for lsp (#2604) (cherry picked from commit 47c755d737702df7a39b640c8d9c473a728be1df) --- lua/telescope/utils.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lua/telescope/utils.lua b/lua/telescope/utils.lua index 1d60a54..7926dcf 100644 --- a/lua/telescope/utils.lua +++ b/lua/telescope/utils.lua @@ -193,8 +193,9 @@ utils.is_path_hidden = function(opts, path_display) or type(path_display) == "table" and (vim.tbl_contains(path_display, "hidden") or path_display.hidden) end -local is_uri = function(filename) - return string.match(filename, "^%w+://") ~= nil +local URI_SCHEME_PATTERN = "^([a-zA-Z]+[a-zA-Z0-9.+-]*):.*" +utils.is_uri = function(filename) + return filename:match(URI_SCHEME_PATTERN) ~= nil end local calc_result_length = function(truncate_len) @@ -217,7 +218,7 @@ utils.transform_path = function(opts, path) if path == nil then return end - if is_uri(path) then + if utils.is_uri(path) then return path end