-
-
Notifications
You must be signed in to change notification settings - Fork 821
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(oldfiles) : delete duplicated items in Windows #3103
base: master
Are you sure you want to change the base?
fix(oldfiles) : delete duplicated items in Windows #3103
Conversation
/// Problem : 1) Duplicated items are listed in oldfiles because of neovim problem. Example is like below. c:\Users\USERS\test\telescope.lua c:\Users\USERS/test/telescope.lua c:/Users/USERS/test/telescope.lua slash(/) makes neovim lua api cannot work properly in windows. and string comparison don't distinguish it is the same path This makes `file ~= current_file` condition cannot filter although it is same with the file 2) oldfiles show current session files also. /// Solution : 1-1) Taking gsub('/', '\\') all files from neovim lua api. 1-2) Add additional condition which checks whether the file is listed in results (='results_other') 2) separate `results` variable to 2 parts. First, 'results' as current session file list Second, 'results_other' as old file list which are filtered unnecessary file
technically yes, seems like an easy fix, we can include this. but can you reduce the comments by like 95% we only have to mention it once why we do and the formatting doesnt align with our style, this needs to be addressed as well |
lua/telescope/builtin/__internal.lua
Outdated
@@ -525,30 +525,50 @@ end | |||
internal.oldfiles = function(opts) | |||
opts = apply_cwd_only_aliases(opts) | |||
opts.include_current_session = vim.F.if_nil(opts.include_current_session, true) | |||
local has_win = vim.fn.has('win32') == 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please use utils.iswin()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK I'll try it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please use
utils.iswin()
New PR is submitted
…nvim into fix/oldfile_duplicated_list
1) remove unnecessary comments 2) formatting with stylua 3) use utils.iswin instead of vim.fn.has('win32')
Description
Example is like below.
slash(/) makes neovim lua api cannot work properly in windows.
and string comparison don't distinguish it is the same path
This makes
file ~= current_file
condition cannot filter although it is same with the fileFixes #1683
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Taking gsub('/', '\') all files from neovim lua api.
Add additional condition which checks whether the file is listed in results (='results_other')
separate
results
variable to 2 parts.First, 'results' as current session file list
Second, 'results_other' as old file list which are filtered unnecessary file
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
There is nothing for the user to configure.
Configuration:
Checklist: