|
47 | 47 | :type '(repeat string)
|
48 | 48 | :group 'lsp-dart)
|
49 | 49 |
|
| 50 | +(defcustom lsp-dart-extra-library-directories '() |
| 51 | + "List of directories which will be considered to be libraries." |
| 52 | + :risky t |
| 53 | + :type '(repeat string) |
| 54 | + :group 'lsp-dart) |
| 55 | + |
50 | 56 | (defcustom lsp-dart-only-analyze-projects-with-open-files t
|
51 | 57 | "Analyze only open files.
|
52 | 58 | When set to non-nil, analysis will only be performed for projects that have
|
@@ -151,6 +157,15 @@ The key is composed of the KEY-PREFIX with PARAMS uri path."
|
151 | 157 | (let ((key (concat key-prefix "--" (buffer-file-name buffer))))
|
152 | 158 | (lsp-workspace-get-metadata key (lsp-find-workspace 'lsp-find-workspace))))
|
153 | 159 |
|
| 160 | +(defun lsp-dart-library-folders () |
| 161 | + "Return the library folders path to analyze." |
| 162 | + (let* ((sdk-lib (expand-file-name "lib" (lsp-dart-project-get-sdk-dir))) |
| 163 | + (dirs (lsp--directory-files-recursively sdk-lib ".dart"))) |
| 164 | + (--> dirs |
| 165 | + (-map #'file-name-directory it) |
| 166 | + (remove-duplicates it :test 'string=) |
| 167 | + (append it lsp-dart-extra-library-directories)))) |
| 168 | + |
154 | 169 | (defun lsp-dart--outline-kind->icon (kind)
|
155 | 170 | "Maps an outline KIND to a treemacs icon symbol.
|
156 | 171 | Kinds from https://github.com/dart-lang/sdk/blob/master/pkg/analysis_server/tool/spec/generated/java/types/ElementKind.java"
|
@@ -352,6 +367,7 @@ PARAMS closing labels notification data sent from WORKSPACE."
|
352 | 367 | (closingLabels . ,lsp-dart-closing-labels)
|
353 | 368 | (outline . ,lsp-dart-outline)
|
354 | 369 | (flutterOutline . ,lsp-dart-flutter-outline))
|
| 370 | + :library-folders-fn (lambda (_workspace) (lsp-dart-library-folders)) |
355 | 371 | :notification-handlers (ht ("dart/textDocument/publishClosingLabels" 'lsp-dart--handle-closing-labels)
|
356 | 372 | ("dart/textDocument/publishOutline" 'lsp-dart--handle-outline)
|
357 | 373 | ("dart/textDocument/publishFlutterOutline" 'lsp-dart--handle-flutter-outline))
|
|
0 commit comments