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

fix(help_tags): show help tags on windows (#3126) #3127

Merged
merged 2 commits into from
May 26, 2024

Conversation

xudyang1
Copy link
Contributor

@xudyang1 xudyang1 commented May 21, 2024

On Windows, builtin.help_tags picker does not show any help tags.

To fix this, the following changes are needed:

  1. util.path_tail checks unix separator / on Windows and leave the original implementation intact on unix systems.

  2. Line endings should be taken carefully on Windows. vim.split with only newline \n character as separator may result in unexpected crash when parsing large files. When splits on lines are needed, call it with \r?\n, or even set up a wrapper function in utils is more prefered.

Fixes #3126

Description

Please include a summary of the change and which issue is fixed. Please also
include relevant motivation and context

Fixes #3126 (issue)

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list relevant details about your configuration

  • util.path_tail on Windows, Linux, and MacOS
  • util.split_lines on Windows, Linux and MacOS

Configuration:

  • Neovim version (nvim --version): 0.10.0
  • Operating system and version: Windows 10 22H2

Checklist:

  • My code follows the style guidelines of this project (stylua)
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (lua annotations)

@xudyang1 xudyang1 force-pushed the fix/help_tags branch 2 times, most recently from de194e8 to af64b8d Compare May 21, 2024 18:34
On Windows, `builtin.help_tags` picker does not show any help tags.

To fix this, the following changes are needed:

1. `util.path_tail` checks unix separator `/` on Windows and leave the
original implementation intact on unix systems.

2. Line endings should be taken carefully on Windows. `vim.split` with
   only newline `\n` character as separator may result in unexpected
   crash when parsing large files. When splits on lines are needed, call
   it with `\r?\n`, or even set up a wrapper function in utils is more
   prefered.

Fixes nvim-telescope#3126
Copy link
Contributor

@jamestrew jamestrew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I'll try to take a closer look in the coming days.

lua/tests/automated/utils_spec.lua Outdated Show resolved Hide resolved
Copy link
Contributor

@jamestrew jamestrew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple of minor things but otherwise looks good to me. Gave all the touched pickers/previewers a try and they work for me (at least on linux).

lua/telescope/init.lua Outdated Show resolved Hide resolved
lua/telescope/utils.lua Outdated Show resolved Hide resolved
@jamestrew jamestrew merged commit 349660c into nvim-telescope:master May 26, 2024
12 checks passed
@jamestrew
Copy link
Contributor

Thanks a lot!

@jamestrew jamestrew added the backport-0.1.x PR to be backported to 0.1.x (Neovim 0.7 compat) label May 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-0.1.x PR to be backported to 0.1.x (Neovim 0.7 compat)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: help_tags does not show any help tags on Windows
2 participants