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

refactor: remove internal implementation of util.path.dirname #3460

Merged
merged 1 commit into from
Nov 26, 2024

Conversation

dundargoc
Copy link
Member

Instead, just return the result of vim.fs.dirname.

Instead, just return the result of vim.fs.dirname.
@dundargoc dundargoc requested a review from justinmk November 26, 2024 11:27
@dundargoc dundargoc marked this pull request as ready for review November 26, 2024 11:30
@dundargoc dundargoc requested a review from glepnir as a code owner November 26, 2024 11:30
@glepnir
Copy link
Member

glepnir commented Nov 26, 2024

LGTM.. Actually it can be removed. see #3434
Although the test passed. But the test here is a bit weak. I am afraid that hasty merge will break some uses. . So it has been in draft state.

@dundargoc
Copy link
Member Author

Actually it can be removed.

@justinmk pulled out a deprecation strategy in #2079 (comment), I interpret his comment to mean we shouldn't remove any functions from util yet.

@glepnir
Copy link
Member

glepnir commented Nov 26, 2024

Yes. A safe approach :D. But I want to make lspconfig become a pure configuration collection. It would be helpful to exploit some of the functions of lspconfig step by step? If possible, is it a good idea to use deprecate here? Point to vim.fs.dirname so that any other plugins or users who use this function will remove the dependency on util.path.dirname.

@dundargoc
Copy link
Member Author

Yeah, kinda agree. I've written a complaint in the issue.

@justinmk
Copy link
Member

This is a good example of why removing util.dirname gains almost nothing. Keeping the skeleton around is low cost. Because we'll just freeze it once everything is upstreamed. And meanwhile, shrinking the actual implementation gives us a clear picture of which logic still doesn't have an upstream equivalent. The mere presence of util.dirname doesn't harm anything, though, yes, we will need to update something like .github/ci/run_sanitizer.sh to prevent future uses of util.dirname in configs.

As we hollow-out the guts of util, it will become almost empty. We can later decide whether we want to delete it entirely, and that can be done as one big "breaking" step instead of many incremental "breaking" steps.

So this is a good change, and we should continue to make this kind of change. The possible future breaking change can wait until later. There is no need to do it right now. Let's just focus on shrinking the implementation, first.

@justinmk justinmk merged commit 3eaab29 into neovim:master Nov 26, 2024
11 checks passed
@@ -155,20 +155,7 @@ M.path = (function()
--- @param path T
--- @return T
local function dirname(path)
Copy link
Member

@justinmk justinmk Nov 26, 2024

Choose a reason for hiding this comment

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

a @deprecated token would help too, and the docstring can mention "use vim.fs"

done in #3462

@dundargoc dundargoc deleted the refactor/dirname branch November 26, 2024 19:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants