Skip to content
Merged
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
4 changes: 2 additions & 2 deletions lua/flutter-tools/executable.lua
Original file line number Diff line number Diff line change
Expand Up @@ -174,13 +174,13 @@ function M.get(callback)

if config.flutter_lookup_cmd then
return path_from_lookup_cmd(config.flutter_lookup_cmd, function(paths)
paths = {
cached_paths = {
flutter_bin = paths.flutter_bin,
flutter_sdk = paths.flutter_sdk,
dart_bin = paths.dart_bin,
dart_sdk = dart_sdk_root(paths),
}
callback(paths)
callback(cached_paths)
end)
end

Expand Down
5 changes: 4 additions & 1 deletion lua/flutter-tools/lsp/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -287,12 +287,15 @@ function M.attach()
if not is_valid_path(buffer_path) then return end

get_server_config(user_config, function(c)
-- This callback can run asynchronously, by which point the user may have
-- switched to or deleted the buffer we were asked to attach to.
if not api.nvim_buf_is_valid(buf) then return end
c.root_dir = M.get_project_root_dir()
or fs.dirname(fs.find(conf.root_patterns, {
path = buffer_path,
upward = true,
})[1])
vim.lsp.start(c)
vim.lsp.start(c, { bufnr = buf })
end)
end

Expand Down
Loading