Open miversen33 opened 2 years ago
Yes, we should enable such a use case (remote telescoping). Would you be willing to work towards a PR for that use case? Mostly because you'd be the first-mover actually using that functionality :)
I have no issue with it! I'll see if I can throw it together this weekend.
I am also facing the same issue, trying to simplify the uri to display it in a more readable way (e.g. the jdtls symbols). Turns out the transform path cuts too early, even before path display callback is called.
For now, what i did is something simple like that before configuring telescope
local path_transformer = utils.transform_path
utils.transform_path = function(opts, path)
if path and string.match(path, "^%w+://") ~= nil then
path = path:match("jdt://contents/[^/]*/(.*)?="):gsub("/", ".")
end
return path_transformer(opts, path)
end
Will also be awesome if you can give some actual documentation about the options that transform_path takes. It only mentions one property it will read, but nothing about what that property should be
@danielo515 the opts that transform path receives are the opts passed in to the picker it is invoked by. So opts contains pretty much everything, the previewer, finder etc. It is better if you don't mutate them in transform if you can avoid doing so, and just read them to accomplish your use case. The example above i gave is not the most robust, if the match fails, it will return nil and gsub will fail too but it was just a quick snippet.
Sorry, I was taking the context of the issue to propose to improve the
current docs on path_display
. Opening a new issue is such a big task for
something this small that I took a shortcut. Sorry
On Wed, Feb 1, 2023 at 9:25 AM Svetlozar Iliev @.***> wrote:
@danielo515 https://github.com/danielo515 the opts that transform path receives are the opts passed in to the picker it is invoked by. So opts contains pretty much everything, the previewer, finder etc. It is better if you don't mutate them in transform if you can avoid doing so, and just read them to accomplish your use case. The example above i gave is not the most robust, if the match fails, it will return nil and gsub will fail too but it was just a quick snippet.
— Reply to this email directly, view it on GitHub https://github.com/nvim-telescope/telescope.nvim/issues/1942#issuecomment-1411645668, or unsubscribe https://github.com/notifications/unsubscribe-auth/AARKJWMQIKU4DFQCD3IR3CLWVIMYVANCNFSM5WHAD2BA . You are receiving this because you were mentioned.Message ID: @.***>
Is your feature request related to a problem? Please describe. Telescope Utils contains a function called transform_path that is utilized by various pieces of telescope (and telescope plugins such as telescope-file-browser) to determine how to format a string to be displayed within telescope. This function immediately escapes (via returning the provided path) if the function determines that the path is a "URI", artificially limiting support for nonlocal resources.
Describe the solution you'd like I think the above is a fine default, but consider allowing an option to be provided that can say "yes allow URIs to be processed as well" would enable further development of plugins that could better consume and manage remote resources. For example
Describe alternatives you've considered NA
Additional context For a concrete example, I have an issue on my project's issue board that would be able to be better handled if Telescope provided the ability to allow URI's to be processed by a provided display function. From looking at the source code for utils.transform, it appears the logic is already there to handle using a function to format the display string, as a URI is being passed in (in my case), the ability to format the string is completely negated.
Edit: Fixed formatting because formatting hard