telescope-project.nvim
telescope-project.nvim copied to clipboard
Configurable scope for project directory
Resolves #61
I think the default behaviour of this should be roughly the same as before but without the surprise $CWD
changes, additionally there is an optional flag to scope switching to a project to the current tab.
Feedback welcome :pray:
Looking good. Can you add a 2 tests that use default and changed cwd_scope
?
Hey @matu3ba I'm no longer using this project. I tried to pass over control to you previously but failed. As you still seem to be invested and I appreciate your opinions, I'm wondering if you could message me on MRs to merge, as I don't want to let the community down but also dont have the time to invest in this at the moment. If you have tested and are happy with this one I will merge?
If you have tested and are happy with this one I will merge?
It works, but I really want basic test coverage, because PATH/CWD stuff is too easy to mess up (dynamic environment etc).
Yeah sorry - I did see the request for test coverage and tbh I forgot.
I'll sort it tomorrow 👍
https://github.com/ccakes/telescope-project.nvim/blob/a4bd660120aa4ce9acd687194617bd49ea8cb796/lua/tests/utils_spec.lua#L53
Ok I added some test coverage, but this one fails and I'm not sure why. If I print the :cwd
after calling utils.change_project_dir
it looks correct, but haslocaldir
isn't returning what I'd expect.
Any ideas?
I dont understand why you use assert.equal(0, vim.api.nvim_call_function("haslocaldir", {1}))
before utils.change_project_dir(test_dir.filename, "tab"))
or "local".
I would debug print the path (pwd
inside neovim) to a file in /tmp
to see what is going on including the list of directories + files it sees, like this (you can delete lines ending with DEBUG by running :g/.*DEBUG$/del
):
-- Debugging
-- :g/.*DEBUG$/del
-- local fp = assert(io.open("/tmp/tmpfile", "w")) --DEBUG
-- for index,tables in pairs(repo_paths) do --DEBUG
-- fp:write(index) --DEBUG
-- fp:write(", ") --DEBUG
-- fp:write(tables) --DEBUG
-- fp:write("\n") --DEBUG
-- end --DEBUG
-- fp.close() --DEBUG
-- local fp = assert(io.open("/tmp/tmpfile", "w")) --DEBUG
-- for index,tables in ipairs(repo_paths) do --DEBUG
-- fp:write(index) --DEBUG
-- fp:write(", ") --DEBUG
-- fp:write(tostring(tables)) --DEBUG
-- fp:write("\n") --DEBUG
-- end --DEBUG
-- fp.close() --DEBUG
I dont understand why you expect 2 numbers(:h haslocaldir
):
The result is a Number, which is 1 when the window has set a
local path via |:lcd| or when {winnr} is -1 and the tabpage
has set a local path via |:tcd|, otherwise 0.