File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -170,12 +170,14 @@ end
170170function M .get_project_root_dir ()
171171 local conf = require (" flutter-tools.config" )
172172 local current_buffer_path = path .current_buffer_path ()
173- local root_path = lsp_utils .is_valid_path (current_buffer_path )
174- and path .find_root (conf .root_patterns , current_buffer_path )
175- or nil
176-
177- if root_path ~= nil then return root_path end
178-
173+ -- Check if path is flutter dependency. For dependencies we do not
174+ -- search for a root directory as they are not projects.
175+ if not path .is_flutter_dependency_path (current_buffer_path ) then
176+ local root_path = lsp_utils .is_valid_path (current_buffer_path )
177+ and path .find_root (conf .root_patterns , current_buffer_path )
178+ or nil
179+ if root_path ~= nil then return root_path end
180+ end
179181 local client = lsp_utils .get_dartls_client ()
180182 return client and client .config .root_dir or nil
181183end
You can’t perform that action at this time.
0 commit comments