11; ;; lsp-dart.el --- Dart support lsp-mode -*- lexical-binding : t ; -*-
22
33; ; Version: 1.12.5
4- ; ; Package-Requires: ((emacs "25.2") (lsp-treemacs "0.1") (lsp-mode "6.4") (dap-mode "0.4") (ht "2.0") ( f "0.20.0") (dash "2.14.1") (pkg-info "0.4") (dart-mode "1.0.5"))
4+ ; ; Package-Requires: ((emacs "25.2") (lsp-treemacs "0.1") (lsp-mode "6.4") (dap-mode "0.4") (f "0.20.0") (dash "2.14.1") (pkg-info "0.4") (dart-mode "1.0.5"))
55; ; Keywords: languages, extensions
66; ; URL: https://emacs-lsp.github.io/lsp-dart
77
2424
2525; ;; Code:
2626
27- (require 'ht )
2827(require 'f )
2928(require 'dash )
3029(require 'lsp-mode )
@@ -81,10 +80,15 @@ imported into the current file."
8180
8281(defun lsp-dart--server-command ()
8382 " Generate LSP startup command."
84- (or lsp-dart-server-command
85- `(,(lsp-dart-dart-command)
86- ,(expand-file-name (f-join (lsp-dart-get-sdk-dir) " bin/snapshots/analysis_server.dart.snapshot" ))
87- " --lsp" )))
83+ (let ((client-version (when (require 'pkg-info nil t )
84+ (format " --client-version %s "
85+ (pkg-info-version-info 'lsp-dart )))))
86+ (or lsp-dart-server-command
87+ `(,(lsp-dart-dart-command)
88+ ,(expand-file-name (f-join (lsp-dart-get-sdk-dir) " bin/snapshots/analysis_server.dart.snapshot" ))
89+ " --lsp"
90+ " --client-id emacs.lsp-dart"
91+ , client-version ))))
8892
8993(lsp-defun lsp-dart--handle-analyzer-status (workspace (&AnalyzerStatusNotification :is-analyzing ))
9094 " Handle analyzer status notification for WORKSPACE.
@@ -108,10 +112,10 @@ PARAMS is the data sent from server."
108112 (outline . , lsp-dart-outline )
109113 (flutterOutline . , lsp-dart-flutter-outline ))
110114 :library-folders-fn (lambda (_workspace ) (lsp-dart--library-folders))
111- :notification-handlers (ht (" dart/textDocument/publishClosingLabels" #'lsp-dart-closing-labels-handle )
112- (" dart/textDocument/publishOutline" #'lsp-dart-outline-handle-outline )
113- (" dart/textDocument/publishFlutterOutline" #'lsp-dart-outline-handle-flutter-outline )
114- (" $/analyzerStatus" #'lsp-dart--handle-analyzer-status ))
115+ :notification-handlers (lsp- ht (" dart/textDocument/publishClosingLabels" #'lsp-dart-closing-labels-handle )
116+ (" dart/textDocument/publishOutline" #'lsp-dart-outline-handle-outline )
117+ (" dart/textDocument/publishFlutterOutline" #'lsp-dart-outline-handle-flutter-outline )
118+ (" $/analyzerStatus" #'lsp-dart--handle-analyzer-status ))
115119 :server-id 'dart_analysis_server ))
116120
117121
0 commit comments