Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Telescope buffers incorrect path_display after commit 3b8399c #2997

Open
sibouras opened this issue Mar 21, 2024 · 7 comments · May be fixed by #3018
Open

Telescope buffers incorrect path_display after commit 3b8399c #2997

sibouras opened this issue Mar 21, 2024 · 7 comments · May be fixed by #3018
Assignees
Labels
bug Something isn't working Windows Relates to window operating system

Comments

@sibouras
Copy link

sibouras commented Mar 21, 2024

Description

bofore 3b8399c Telescope buffers path_display={'smart'} used to show relative paths, now it shows absolute paths with tilde

Neovim version

NVIM v0.10.0-dev-2559+g3814750d3
Build type: RelWithDebInfo
LuaJIT 2.1.1707061634

Operating system and version

windows 11

Telescope version / branch / rev

221778e

checkhealth telescope

telescope: require("telescope.health").check()

Checking for required plugins ~
- OK plenary installed.
- OK nvim-treesitter installed.

Checking external dependencies ~
- OK rg: found ripgrep 14.1.0 (rev e50df40a19)
- OK fd: found fd 9.0.0

===== Installed extensions ===== ~

Telescope Extension: `fzf` ~
- OK lib working as expected
- OK file_sorter correctly configured
- OK generic_sorter correctly configured

Steps to reproduce

:Telescope buffers path_display={'smart'}

Expected behavior

image

Actual behavior

image

Minimal config

vim.cmd [[set runtimepath=$VIMRUNTIME]]
vim.cmd [[set packpath=/tmp/nvim/site]]
local package_root = '/tmp/nvim/site/pack'
local install_path = package_root .. '/packer/start/packer.nvim'
local function load_plugins()
  require('packer').startup {
    {
      'wbthomason/packer.nvim',
      {
        'nvim-telescope/telescope.nvim',
        requires = {
          'nvim-lua/plenary.nvim',
          { 'nvim-telescope/telescope-fzf-native.nvim', run = 'make' },
        },
      },
      -- ADD PLUGINS THAT ARE _NECESSARY_ FOR REPRODUCING THE ISSUE
    },
    config = {
      package_root = package_root,
      compile_path = install_path .. '/plugin/packer_compiled.lua',
      display = { non_interactive = true },
    },
  }
end
_G.load_config = function()
  require('telescope').setup()
  require('telescope').load_extension('fzf')
  -- ADD INIT.LUA SETTINGS THAT ARE _NECESSARY_ FOR REPRODUCING THE ISSUE
end
if vim.fn.isdirectory(install_path) == 0 then
  print("Installing Telescope and dependencies.")
  vim.fn.system { 'git', 'clone', '--depth=1', 'https://github.com/wbthomason/packer.nvim', install_path }
end
load_plugins()
require('packer').sync()
vim.cmd [[autocmd User PackerComplete ++once echo "Ready!" | lua load_config()]]
@sibouras sibouras added the bug Something isn't working label Mar 21, 2024
@jamestrew jamestrew self-assigned this Mar 21, 2024
@jamestrew jamestrew added the Windows Relates to window operating system label Mar 21, 2024
@jamestrew
Copy link
Contributor

Can you give this PR a try?
#2999

@jamestrew
Copy link
Contributor

I wrote some unit tests (and ran them against Windows with github actions) for the function related to handling path_display here: #3013

I think I was able to fix the 'smart' option for path_display that was previously broken but I didn't find anything out of the ordinary for the 'shorten' and default '' option. Looks like I'll have to dust off my windows machine to debug this some more.

@sibouras
Copy link
Author

the smart option works great now for the non git pickers, but git_files and git_status are still broken for smart, shorten and the default ''

and there's a weird behavior with git_status path_display={'smart'}, it kinda works: the first time i run it the first result is bugged and files in the first level root directory like init.lua and lazy-lock.json are not supposed to be prefixed by ..\nvim\

here's a video to better show what's happening and maybe save you from touching windows:

telescope-path-display-windows.mp4

@jamestrew
Copy link
Contributor

Hmm... I starting to wonder if this is git setting related.
Doing git status on Windows powershell gives me unix style paths.
image
This combined with the fact that vim.loop.cwd gives me Windows path and the way we "carelessly" combined join them gives me a :Telescope git_status path_display={''} like this
image
this is BEFORE 3b8399c (on c816406)

I'm not sure how it wasn't broken for you before.

@sibouras
Copy link
Author

the most recent plenary commit nvim-lua/plenary.nvim#551 broke :Telescope git_status path_display={''} on c816406, try using the commit before it

@jamestrew
Copy link
Contributor

Ahh... nice find.
I see the issue now I believe - although the plenary change complicates things a little despite it having the right intentions. Man windows paths are finicky 😅

@sibouras
Copy link
Author

tell me about it lol

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Windows Relates to window operating system
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants