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

shrink util implementation by using upstream functions, avoid util in configs #2079

Open
14 of 21 tasks
ranjithshegde opened this issue Aug 23, 2022 · 16 comments
Open
14 of 21 tasks
Assignees
Labels
enhancement New feature or request

Comments

@ranjithshegde
Copy link
Contributor

ranjithshegde commented Aug 23, 2022

Functions to deprecate

These functions can be replaced with relevant functions vim.fs:

These functions can be made private in the next releases seeing as user_commands part has already been signaled for eventual deprecation:

  • parse_user_command_options
  • create_module_commands

Proposal

  1. Soft-deprecate after release of nvim 0.8 + stabilization period.
  2. Internally redirect the calls to vim.fs.
  3. Replace the functions inside configs/[server].lua wherever relevant
  4. CI lints usage of banned/deprecated util functions. ci: check for deprecated util functions #3462
  5. Provide examples/docs that use the recommended functions
@justinmk

This comment was marked as outdated.

@glepnir

This comment was marked as outdated.

@justinmk

This comment was marked as outdated.

@glepnir

This comment was marked as outdated.

@justinmk
Copy link
Member

We don't necessarily need to remove lspconfig.util.root_pattern, we can start by updating their implementations to use vim.fs and minimizing code where possible. And where possible, show a deprecation message that explains how to use vim.fs directly instead of e.g. lspconfig.util.root_pattern. And update all of the examples in lspconfig docs to use vim.fs directly, instead of lspconfig.util.

@justinmk

This comment was marked as outdated.

@glepnir

This comment was marked as outdated.

@justinmk
Copy link
Member

justinmk commented Oct 2, 2024

Plan

what general strategy is for removing lspconfig functions

we should keep the util stuff around to avoid breaking downstream. meanwhile, in this repo:

once we have isolated most of util in that way, then we can think about when/how to fully remove them.

@dundargoc
Copy link
Member

Since we don't actually test/run any of the lua configs in CI to my knowledge, the best we can hope for is to make a string search of changed lines on PRs and complain if the deprecated function is used.

@justinmk
Copy link
Member

justinmk commented Oct 4, 2024

The "Proposal" in the main description of this issue is updated and correct. To be clear:

  • we don't need to remove anything on util, its interface can stay frozen for back-compat.
  • internally, the implementation of util should shrink as we update it to use stdlib features of the minimum-supported Nvim version.
  • as we bump the minimum required Nvim, we will add lint rules to the lspconfig CI which prevent configs from using util functions if the minimum supported Nvim (currently 0.9) has alternatives.

For example, search_ancestors currently doesn't use vim.fs.parents even though it has been available since Nvim 0.8

function M.search_ancestors(startpath, func)

@justinmk justinmk changed the title Replace functions from utils with upstream functions shrink util implementation by using upstream functions, avoid util in configs Oct 4, 2024
@justinmk
Copy link
Member

@dundargoc
Copy link
Member

I'm not really a fan of the suggested deprecation strategy. It creates extra CI work and makes the process harder because we now need to have bookkeeping of which util functions we use ourselves and which util functions are there for public use. What was so wrong about the previous deprecation strategy that we need to invent a new one on the spot?

@justinmk
Copy link
Member

justinmk commented Nov 26, 2024

There was no previous deprecation strategy for nvim-lspconfig. The goal is to shrink nvim-lspconfig in order to make progress towards upstreaming it, while minimizing damage to user trust.

Which part of the above plan, specifically, do you want to change, and how, specifically? (Other than the CI work, which is merely a way to reduce the code review burden of nvim-lspconfig, and something that will materialize depending on the whims of the people maintaining nvim-lspconfig: #3462 .)

@justinmk
Copy link
Member

Ok I see what you mean from the discussion in #3460

@justinmk
Copy link
Member

#3460 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.

@dundargoc
Copy link
Member

Which part of the above plan, specifically, do you want to change, and how, specifically?

The proposed strategy is alright I guess, it's just more safe/careful than my personal preference. And I like having one deprecation strategy over all our repos if possible to reduce the mental overhead of keeping track of different strategies.

But I can work with the strategy you outlined, it's not a dealbreaker and we can make progress like you said.

dundargoc added a commit to dundargoc/nvim-lspconfig that referenced this issue Nov 27, 2024
Use `vim.uv.fs_stat` instead.

Work on neovim#2079.
dundargoc added a commit to dundargoc/nvim-lspconfig that referenced this issue Nov 27, 2024
Use `vim.uv.fs_stat` instead.

Work on neovim#2079.
dundargoc added a commit to dundargoc/nvim-lspconfig that referenced this issue Nov 27, 2024
Use `vim.uv.fs_stat` instead.

Work on neovim#2079.
dundargoc added a commit to dundargoc/nvim-lspconfig that referenced this issue Dec 14, 2024
dundargoc added a commit that referenced this issue Dec 14, 2024
dundargoc added a commit to dundargoc/nvim-lspconfig that referenced this issue Dec 14, 2024
dundargoc added a commit to dundargoc/nvim-lspconfig that referenced this issue Dec 14, 2024
dundargoc added a commit to dundargoc/nvim-lspconfig that referenced this issue Dec 14, 2024
dundargoc added a commit that referenced this issue Dec 14, 2024
dundargoc added a commit to dundargoc/nvim-lspconfig that referenced this issue Dec 14, 2024
dundargoc added a commit that referenced this issue Dec 14, 2024
dundargoc added a commit to dundargoc/nvim-lspconfig that referenced this issue Dec 21, 2024
dundargoc added a commit to dundargoc/nvim-lspconfig that referenced this issue Dec 21, 2024
dundargoc added a commit to dundargoc/nvim-lspconfig that referenced this issue Dec 21, 2024
dundargoc added a commit to dundargoc/nvim-lspconfig that referenced this issue Dec 21, 2024
dundargoc added a commit to dundargoc/nvim-lspconfig that referenced this issue Dec 21, 2024
dundargoc added a commit to dundargoc/nvim-lspconfig that referenced this issue Dec 21, 2024
dundargoc added a commit to dundargoc/nvim-lspconfig that referenced this issue Dec 21, 2024
dundargoc added a commit that referenced this issue Dec 21, 2024
dundargoc added a commit to dundargoc/nvim-lspconfig that referenced this issue Dec 21, 2024
dundargoc added a commit to dundargoc/nvim-lspconfig that referenced this issue Dec 21, 2024
dundargoc added a commit that referenced this issue Dec 21, 2024
dundargoc added a commit to dundargoc/nvim-lspconfig that referenced this issue Dec 22, 2024
dundargoc added a commit that referenced this issue Dec 22, 2024
dundargoc added a commit to dundargoc/nvim-lspconfig that referenced this issue Dec 22, 2024
dundargoc added a commit to dundargoc/nvim-lspconfig that referenced this issue Dec 22, 2024
dundargoc added a commit to dundargoc/nvim-lspconfig that referenced this issue Dec 22, 2024
dundargoc added a commit to dundargoc/nvim-lspconfig that referenced this issue Dec 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants