Giter VIP home page Giter VIP logo

Comments (2)

dpetka2001 avatar dpetka2001 commented on July 18, 2024 1

This only seems to provide the ability to find the root directory based on the markers provided into the function. This looks to me more equivalent to util.root.detectors.patterns specifically.

It doesn't account for the LSP servers root_dir. To use vim.fs.root for discovering LSP servers root_dir, we would have to specify every possible marker as a pattern for the root_dir of every LSP server (and that would also make it hardcoded and what if users wanted to change the LSP server's root_dir pattern in their personal configuration in nvim-lspconfig spec?).

util.root.detectors.lsp gets the root_dir directly from the LSP client.

So, personally I fail to see how this can replace the whole util.root.

from lazyvim.

konosubakonoakua avatar konosubakonoakua commented on July 18, 2024

https://neovim.io/doc/user/lua.html#vim.fs.root()

-- Find the root of a Python project, starting from file 'main.py'
vim.fs.root(vim.fs.joinpath(vim.env.PWD, 'main.py'), {'pyproject.toml', 'setup.py' })
-- Find the root of a git repository
vim.fs.root(0, '.git')
-- Find the parent directory containing any file with a .csproj extension
vim.fs.root(0, function(name, path)
  return name:match('%.csproj$') ~= nil
end)

from lazyvim.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.