Skip to content

Commit 053b3e6

Browse files
committed
Add lsp client information for dart SDK analysis_server
1 parent bd3d4b9 commit 053b3e6

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed

lsp-dart-code-lens.el

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
;;; Code:
2323

2424
(require 'dash)
25-
(require 'ht)
2625

2726
(require 'lsp-dart-protocol)
2827
(require 'lsp-dart-dap)

lsp-dart.el

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
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

@@ -24,7 +24,6 @@
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

Comments
 (0)