Skip to content

Commit 54b44ce

Browse files
committed
Revert "feat: add flutter dependency detection (nvim-flutter#326)"
This reverts commit 7f93847.
1 parent fcc7b5b commit 54b44ce

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

lua/flutter-tools/dap.lua

+4-11
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,13 @@ end
1111

1212
local M = {}
1313

14-
local function has_flutter_dependency_in_pubspec()
15-
local pubspec = vim.fn.glob("pubspec.yaml")
16-
if pubspec == "" then return false end
17-
local pubspec_content = vim.fn.readfile(pubspec)
18-
local joined_content = table.concat(pubspec_content, "\n")
19-
20-
local flutter_dependency = string.match(joined_content, "flutter:\n[%s\t]*sdk:[%s\t]*flutter")
21-
return flutter_dependency ~= nil
22-
end
23-
2414
function M.setup(config)
2515
local opts = config.debugger
2616
require("flutter-tools.executable").get(function(paths)
27-
local is_flutter_project = has_flutter_dependency_in_pubspec()
17+
local root_patterns = { ".git", "pubspec.yaml" }
18+
local current_dir = vim.fn.expand("%:p:h")
19+
local root_dir = path.find_root(root_patterns, current_dir) or current_dir
20+
local is_flutter_project = vim.loop.fs_stat(path.join(root_dir, ".metadata"))
2821

2922
if is_flutter_project then
3023
dap.adapters.dart = {

0 commit comments

Comments
 (0)