From f70c4b8b883f78fe54fe7c7d5136695590799f80 Mon Sep 17 00:00:00 2001 From: brook hong Date: Fri, 29 Aug 2025 21:10:08 +0800 Subject: [PATCH] fix: use common files to find project root (#2651) --- lua/avante/utils/root.lua | 58 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 57 insertions(+), 1 deletion(-) diff --git a/lua/avante/utils/root.lua b/lua/avante/utils/root.lua index ed612e0..76661ca 100644 --- a/lua/avante/utils/root.lua +++ b/lua/avante/utils/root.lua @@ -17,7 +17,63 @@ local M = setmetatable({}, { ---@alias AvanteRootSpec string|string[]|AvanteRootFn ---@type AvanteRootSpec[] -M.spec = { "lsp", { ".git", "lua" }, "cwd" } +M.spec = { + "lsp", + { + -- Version Control + ".git", -- Git repository folder + ".svn", -- Subversion repository folder + ".hg", -- Mercurial repository folder + ".bzr", -- Bazaar repository folder + + -- Package Management + "package.json", -- Node.js/JavaScript projects + "composer.json", -- PHP projects + "Gemfile", -- Ruby projects + "requirements.txt", -- Python projects + "setup.py", -- Python projects + "pom.xml", -- Maven (Java) projects + "build.gradle", -- Gradle (Java) projects + "Cargo.toml", -- Rust projects + "go.mod", -- Go projects + "*.csproj", -- .NET projects + "*.sln", -- .NET solution files + + -- Build Configuration + "Makefile", -- Make build system + "CMakeLists.txt", -- CMake build system + "build.xml", -- Ant build system + "Rakefile", -- Ruby build tasks + "gulpfile.js", -- Gulp build system + "Gruntfile.js", -- Grunt build system + "webpack.config.js", -- Webpack configuration + + -- Project Configuration + ".editorconfig", -- Editor configuration + ".eslintrc", -- ESLint configuration + ".prettierrc", -- Prettier configuration + "tsconfig.json", -- TypeScript configuration + "tox.ini", -- Python testing configuration + "pyproject.toml", -- Python project configuration + ".gitlab-ci.yml", -- GitLab CI configuration + ".github", -- GitHub configuration folder + ".travis.yml", -- Travis CI configuration + "Jenkinsfile", -- Jenkins pipeline configuration + "docker-compose.yml", -- Docker Compose configuration + "Dockerfile", -- Docker configuration + + -- Framework-specific + "angular.json", -- Angular projects + "ionic.config.json", -- Ionic projects + "config.xml", -- Cordova projects + "pubspec.yaml", -- Flutter/Dart projects + "mix.exs", -- Elixir projects + "project.clj", -- Clojure projects + "build.sbt", -- Scala projects + "stack.yaml", -- Haskell projects + }, + "cwd", +} M.detectors = {}