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

Move from telescope/path to plenary/path #387

Closed
Conni2461 opened this issue Jan 4, 2021 · 12 comments · Fixed by #473
Closed

Move from telescope/path to plenary/path #387

Conni2461 opened this issue Jan 4, 2021 · 12 comments · Fixed by #473
Labels

Comments

@Conni2461
Copy link
Member

I think everything from telescope.path can already be found in plenary.path so we should use that module instead and remove telescope.path

@tjdevries
Copy link
Member

Yes, this is a good idea. At the time, plenary.path used vim.fn, which made it not available during certain times of telescope operaiton.

Should be OK now to use anywhere, since I switched impl in plenary.path.

@anott03
Copy link
Contributor

anott03 commented Jan 28, 2021

I'm trying to take this on... I see that in telescope.path there is path.separator. I don't see an equivalent in plenary.path. Can separator be moved somewhere else? Maybe to config?

@tjdevries
Copy link
Member

We can add it to plenary.path if it's not available there currently.

@anott03
Copy link
Contributor

anott03 commented Jan 28, 2021

I searched through plenary.path and didn't find anything related to separator. I'll just switch everything else for now and leave path.lua there until plenary is updated.

@anott03
Copy link
Contributor

anott03 commented Jan 28, 2021

The other thing I don't see in plenary.path is an equivalent to read_file_async. Should I open issues on plenary for missing functions?

@Conni2461
Copy link
Member Author

There is require'plenary.path'.path.sep as separator equivalent.

I would suggest you working on both at the same time. Like trying to replace something with plenary.path and when its missing there copy it over. So we end up with one PR per project.

There are also a lot of things used all over the place. E.g. we have a .. sep .. b everywhere and plenary.path has a join or you can do Path:new({a, b}) i think.
Or we have some vim.loop.fs_stat in the previewers to check if its a dir. We can replace it with plenary.path as well.

@anott03
Copy link
Contributor

anott03 commented Jan 28, 2021

@Conni2461 Thanks!

@anott03
Copy link
Contributor

anott03 commented Jan 28, 2021

As far as I can tell, I've gotten this working. The one thing I noticed: there are extensions that require telescope.path (the instance I came across was frecency). Should I leave path.lua in the project for now, or delete it and leave it up to extensions to move away from it?

@Conni2461
Copy link
Member Author

I kinda wanna remove the file. If its only frecency we could ask sunjon to update it the second we merge the PR.
Maybe we just get rid of all content and have only the signatures left which will error on calling. Similar to what tj decided to do with goto_file_selection

@anott03
Copy link
Contributor

anott03 commented Jan 28, 2021

Will do

@anott03
Copy link
Contributor

anott03 commented Jan 28, 2021

I am consistently getting the following error when I run tests. Does anyone know what it means? I'm struggling to make anything out of it. I'm also questioning whether it has anything to do with the changes I've been since I've gotten it when running tests on a clean version of the code. Functionality-wise, everything seems to be working fine.

Testing: 	@/home/an/dev/nvim/telescope.nvim/lua/tests/automated/pickers/scrolling_spec.lua	
Fail	||	scrolling strategies should handle cycling for full list	
            Vim:E474: Expected null: nvim: ../src/nvim/message.c:2266: msg_scroll_flush: Assertion `to_scroll >= 0' failed.
            
            stack traceback:
            	.../dev/nvim/telescope.nvim/lua/telescope/pickers/_test.lua:163: in function 'get_results_from_file'
            	.../dev/nvim/telescope.nvim/lua/telescope/pickers/_test.lua:217: in function 'run_file'
            	...cope.nvim/lua/tests/automated/pickers/scrolling_spec.lua:7: in function <...cope.nvim/lua/tests/automated/pickers/scrolling_spec.lua:6>

@Conni2461
Copy link
Member Author

Is the plenary version you are working on based on the current master?
I think i fixed a bug in plenary.scandir that caused that error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants