Skip to content

Commit da79571

Browse files
committed
fix - removes path caching when using fvm and removes paths reset function is no longer used
1 parent 2cbaee7 commit da79571

File tree

3 files changed

+9
-10
lines changed

3 files changed

+9
-10
lines changed

lua/flutter-tools/commands.lua

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,6 @@ function M.fvm_use(sdk_name)
524524
fvm_use_job:after_success(vim.schedule_wrap(function(j)
525525
ui.notify(utils.join(j:result()))
526526
shutdown()
527-
executable.reset_paths()
528527
lsp.restart()
529528

530529
fvm_use_job = nil

lua/flutter-tools/executable.lua

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,6 @@ end
6262
---@type table<string, string>
6363
local _paths = nil
6464

65-
function M.reset_paths() _paths = nil end
66-
6765
---Execute user's lookup command and pass it to the job callback
6866
---@param lookup_cmd string
6967
---@param callback fun(t: table<string, string>?)
@@ -105,22 +103,25 @@ end
105103
---@param callback fun(paths: table<string, string>)
106104
---@return nil
107105
function M.get(callback)
108-
if _paths then return callback(_paths) end
109106
if config.fvm then
110107
local fvm_root = fvm_utils.find_fvm_root()
111108
local flutter_bin = fvm_utils.flutter_bin_from_fvm(fvm_root)
112109
if fvm_root and flutter_bin then
113-
_paths = {
110+
-- TODO(kaerum): We currently don't cache fvm based paths
111+
-- because we'd need a multiple entry based cache
112+
-- that is somehow better than just traversing up
113+
-- the directory tree looking for the nearest .fvm
114+
local paths = {
114115
flutter_bin = flutter_bin,
115116
flutter_sdk = _flutter_sdk_root(flutter_bin),
116117
fvm_dir = fvm_root,
117118
}
118-
_paths.dart_sdk = _dart_sdk_root(_paths)
119-
_paths.dart_bin = _flutter_sdk_dart_bin(_paths.flutter_sdk)
120-
return callback(_paths)
119+
paths.dart_sdk = _dart_sdk_root(paths)
120+
paths.dart_bin = _flutter_sdk_dart_bin(paths.flutter_sdk)
121+
return callback(paths)
121122
end
122123
end
123-
124+
if _paths then return callback(_paths) end
124125
if config.flutter_path then
125126
local flutter_path = fn.resolve(config.flutter_path)
126127
_paths = { flutter_bin = flutter_path, flutter_sdk = _flutter_sdk_root(flutter_path) }

lua/flutter-tools/lsp/init.lua

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,6 @@ function M.dart_reanalyze() lsp.buf_request(0, "dart/reanalyze") end
222222
local function get_server_config(user_config, callback)
223223
local config = utils.merge({ name = lsp_utils.SERVER_NAME }, user_config, { "color" })
224224
local executable = require("flutter-tools.executable")
225-
executable.reset_paths()
226225
--- TODO: if a user specifies a command we do not need to call executable.get
227226
executable.get(function(paths)
228227
if paths == nil then return end

0 commit comments

Comments
 (0)