File tree 1 file changed +11
-4
lines changed
1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change 11
11
12
12
local M = {}
13
13
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
+
14
24
function M .setup (config )
15
25
local opts = config .debugger
16
26
require (" flutter-tools.executable" ).get (function (paths )
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" ))
27
+ local is_flutter_project = has_flutter_dependency_in_pubspec ()
21
28
22
29
if is_flutter_project then
23
30
dap .adapters .dart = {
You can’t perform that action at this time.
0 commit comments