Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ require("flutter-tools").setup {
},
flutter_path = "<full/path/if/needed>", -- <-- this takes priority over the lookup
flutter_lookup_cmd = nil, -- example "dirname $(which flutter)" or "asdf where flutter"
root_patterns = { ".git", "pubspec.yaml" }, -- patterns to find the root of your flutter project
root_patterns = { "pubspec.yaml", ".git" }, -- patterns to find the root of your flutter project
fvm = false, -- takes priority over path, uses <workspace>/.fvm/flutter_sdk if enabled
default_run_args= nil, -- Default options for run command (i.e `{ flutter = "--no-version-check" }`). Configured separately for `dart run` and `flutter run`.
widget_guides = {
Expand Down
2 changes: 1 addition & 1 deletion lua/flutter-tools/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ local config = {
flutter_path = nil,
flutter_lookup_cmd = get_default_lookup(),
pre_run_callback = nil,
root_patterns = { ".git", "pubspec.yaml" },
root_patterns = { "pubspec.yaml", ".git" },
fvm = false,
default_run_args = nil,
widget_guides = {
Expand Down
6 changes: 5 additions & 1 deletion lua/flutter-tools/lsp/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -287,8 +287,12 @@ function M.attach()
if not is_valid_path(buffer_path) then return end

get_server_config(user_config, function(c)
local root_patterns = conf.root_patterns
if conf.fvm then
root_patterns = vim.tbl_map(function(pattern) return ".fvm" .. pattern end, root_patterns)
end
c.root_dir = M.get_project_root_dir()
or fs.dirname(fs.find(conf.root_patterns, {
or fs.dirname(fs.find(root_patterns, {
path = buffer_path,
upward = true,
})[1])
Expand Down