Skip to content

Commit

Permalink
Revert "feat: add flutter dependency detection (nvim-flutter#326)"
Browse files Browse the repository at this point in the history
This reverts commit 7f93847.
  • Loading branch information
theniceboy committed Feb 2, 2024
1 parent fcc7b5b commit 54b44ce
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions lua/flutter-tools/dap.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,13 @@ end

local M = {}

local function has_flutter_dependency_in_pubspec()
local pubspec = vim.fn.glob("pubspec.yaml")
if pubspec == "" then return false end
local pubspec_content = vim.fn.readfile(pubspec)
local joined_content = table.concat(pubspec_content, "\n")

local flutter_dependency = string.match(joined_content, "flutter:\n[%s\t]*sdk:[%s\t]*flutter")
return flutter_dependency ~= nil
end

function M.setup(config)
local opts = config.debugger
require("flutter-tools.executable").get(function(paths)
local is_flutter_project = has_flutter_dependency_in_pubspec()
local root_patterns = { ".git", "pubspec.yaml" }
local current_dir = vim.fn.expand("%:p:h")
local root_dir = path.find_root(root_patterns, current_dir) or current_dir
local is_flutter_project = vim.loop.fs_stat(path.join(root_dir, ".metadata"))

if is_flutter_project then
dap.adapters.dart = {
Expand Down

0 comments on commit 54b44ce

Please sign in to comment.