Skip to content

Commit 5cb1997

Browse files
committed
fix(flutter-project-p): only parse if exists
1 parent c45f2d9 commit 5cb1997

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

lsp-dart-utils.el

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,11 @@ Used by features that needs to know project entrypoint like DAP support."
9090
(eq lsp-dart--project-type-cache 'flutter)
9191
(let ((flutter-project? (or (-when-let (pubspec-path (-some->> (lsp-dart-get-project-root)
9292
(expand-file-name "pubspec.yaml")))
93-
(with-temp-buffer
94-
(insert-file-contents (-some->> (lsp-dart-get-project-root) (expand-file-name "pubspec.yaml")))
95-
(goto-char (point-min))
96-
(re-search-forward "sdk\s*:\s*flutter" nil t)))
93+
(when (file-exists-p pubspec-path)
94+
(with-temp-buffer
95+
(insert-file-contents (-some->> (lsp-dart-get-project-root) (expand-file-name "pubspec.yaml")))
96+
(goto-char (point-min))
97+
(re-search-forward "sdk\s*:\s*flutter" nil t))))
9798
(lsp-dart--flutter-repo-p))))
9899
(lsp-dart--set-project-type-cache flutter-project?)
99100
flutter-project?)))

0 commit comments

Comments
 (0)