Skip to content

Commit

Permalink
feat: add root_patterns to config (#287)
Browse files Browse the repository at this point in the history
  • Loading branch information
MahanRahmati authored Sep 18, 2023
1 parent 974859e commit 0ba9698
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,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
fvm = false, -- takes priority over path, uses <workspace>/.fvm/flutter_sdk if enabled
widget_guides = {
enabled = false,
Expand Down
1 change: 1 addition & 0 deletions doc/flutter-tools.txt
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ both are set.
},
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
fvm = false, -- takes priority over path, uses <workspace>/.fvm/flutter_sdk if enabled
widget_guides = {
enabled = false,
Expand Down
1 change: 1 addition & 0 deletions lua/flutter-tools/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ M.debug_levels = {
local config = {
flutter_path = nil,
flutter_lookup_cmd = get_default_lookup(),
root_patterns = { ".git", "pubspec.yaml" },
fvm = false,
widget_guides = {
enabled = false,
Expand Down
3 changes: 1 addition & 2 deletions lua/flutter-tools/lsp/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ local fmt = string.format
local fs = vim.fs

local FILETYPE = "dart"
local ROOT_PATTERNS = { ".git", "pubspec.yaml" }

local M = {
lsps = {},
Expand Down Expand Up @@ -202,7 +201,7 @@ function M.attach()

get_server_config(user_config, function(c)
c.root_dir = M.get_lsp_root_dir()
or fs.dirname(fs.find(ROOT_PATTERNS, {
or fs.dirname(fs.find(conf.root_patterns, {
path = buffer_path,
upward = true,
})[1])
Expand Down

0 comments on commit 0ba9698

Please sign in to comment.