lsp-protocol.el (44021B)
1 ;;; lsp-protocol.el --- Language Sever Protocol Bindings -*- lexical-binding: t; -*- 2 3 ;; Copyright (C) 2020 Ivan Yonchovski 4 5 ;; Author: Ivan Yonchovski <yyoncho@gmail.com> 6 ;; Keywords: convenience 7 8 ;; This program is free software; you can redistribute it and/or modify 9 ;; it under the terms of the GNU General Public License as published by 10 ;; the Free Software Foundation, either version 3 of the License, or 11 ;; (at your option) any later version. 12 13 ;; This program is distributed in the hope that it will be useful, 14 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 15 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 ;; GNU General Public License for more details. 17 18 ;; You should have received a copy of the GNU General Public License 19 ;; along with this program. If not, see <https://www.gnu.org/licenses/>. 20 21 ;;; Commentary: 22 23 ;; Autogenerated bindings from lsp4j using 24 ;; https://github.com/victools/jsonschema-generator+scripts to generate 25 ;; scripts/generated.protocol.schema.json and then 26 ;; scripts/lsp-generate-bindings.el 27 28 ;;; Code: 29 30 (require 'cl-lib) 31 (require 'dash) 32 (require 'ht) 33 (require 's) 34 (require 'json) 35 36 (eval-and-compile 37 (defun lsp-keyword->symbol (keyword) 38 "Convert a KEYWORD to symbol." 39 (intern (substring (symbol-name keyword) 1))) 40 41 (defun lsp-keyword->string (keyword) 42 "Convert a KEYWORD to string." 43 (substring (symbol-name keyword) 1)) 44 45 (defvar lsp-use-plists (getenv "LSP_USE_PLISTS"))) 46 47 (defmacro lsp-interface (&rest interfaces) 48 "Generate LSP bindings from INTERFACES triplet. 49 50 Example usage with `dash`. 51 52 \(-let [(&ApplyWorkspaceEditResponse 53 :failure-reason?) (ht (\"failureReason\" \"...\"))] 54 failure-reason?) 55 56 \(fn (INTERFACE-NAME-1 REQUIRED-FIELDS-1 OPTIONAL-FIELDS-1) (INTERFACE-NAME-2 REQUIRED-FIELDS-2 OPTIONAL-FIELDS-2) ...)" 57 (with-case-table ascii-case-table 58 (->> interfaces 59 (-map (-lambda ((interface required optional)) 60 (let ((params (nconc 61 (-map (lambda (param-name) 62 (cons 63 (intern (concat ":" (s-dashed-words (symbol-name param-name)) "?")) 64 param-name)) 65 optional) 66 (-map (lambda (param-name) 67 (cons (intern (concat ":" (s-dashed-words (symbol-name param-name)))) 68 param-name)) 69 required)))) 70 (cl-list* 71 `(defun ,(intern (format "dash-expand:&%s" interface)) (key source) 72 (unless (or (member key ',(-map #'cl-first params)) 73 (s-starts-with? ":_" (symbol-name key))) 74 (error "Unknown key: %s. Available keys: %s" key ',(-map #'cl-first params))) 75 ,(if lsp-use-plists 76 ``(plist-get ,source 77 ,(if (s-starts-with? ":_" (symbol-name key)) 78 key 79 (cl-rest (assoc key ',params)))) 80 ``(gethash ,(if (s-starts-with? ":_" (symbol-name key)) 81 (substring (symbol-name key) 1) 82 (substring (symbol-name 83 (cl-rest (assoc key ',params))) 84 1)) 85 ,source))) 86 `(defun ,(intern (format "dash-expand:&%s?" interface)) (key source) 87 (unless (member key ',(-map #'cl-first params)) 88 (error "Unknown key: %s. Available keys: %s" key ',(-map #'cl-first params))) 89 ,(if lsp-use-plists 90 ``(plist-get ,source 91 ,(if (s-starts-with? ":_" (symbol-name key)) 92 key 93 (cl-rest (assoc key ',params)))) 94 ``(when (ht? ,source) 95 (gethash ,(substring (symbol-name 96 (cl-rest (assoc key ',params))) 97 1) 98 ,source)))) 99 100 `(defun ,(intern (format "lsp-%s?" (s-dashed-words (symbol-name interface)))) (object) 101 (cond 102 ((ht? object) 103 (-all? (let ((keys (ht-keys object))) 104 (lambda (prop) 105 (member prop keys))) 106 ',(-map (lambda (field-name) 107 (substring (symbol-name field-name) 1)) 108 required))) 109 ((listp object) (-all? (lambda (prop) 110 (plist-member object prop)) 111 ',required)))) 112 `(cl-defun ,(intern (format "lsp-make-%s" (s-dashed-words (symbol-name interface)))) 113 (&rest plist &key ,@(-map (-lambda ((key)) 114 (intern (substring (symbol-name key) 1))) params) 115 &allow-other-keys) 116 (ignore ,@(-map (-lambda ((key)) 117 (intern (substring (symbol-name key) 1))) params)) 118 ,(format "Constructs %s from `plist.' 119 Allowed params: %s" interface (reverse (-map #'cl-first params))) 120 ,(if lsp-use-plists 121 `(-mapcat (-lambda ((key value)) 122 (list (or (cl-rest (assoc key ',params)) key) value)) 123 (-partition 2 plist)) 124 `(let (($$result (ht))) 125 (mapc (-lambda ((key value)) 126 (puthash (lsp-keyword->string (or (cl-rest (assoc key ',params)) 127 key)) 128 value 129 $$result)) 130 (-partition 2 plist)) 131 $$result))) 132 `(pcase-defmacro ,interface (&rest property-bindings) 133 ,(if lsp-use-plists 134 ``(and 135 (pred listp) 136 ;; Check if all the types required by the 137 ;; interface exist in the expr-val. 138 ,@(-map 139 (lambda (key) 140 `(pred 141 (lambda (plist) 142 (plist-member plist ,key)))) 143 ',required) 144 ;; Recursively generate the bindings. 145 ,@(let ((current-list property-bindings) 146 (output-bindings nil)) 147 ;; Invariant: while current-list is 148 ;; non-nil, the car of current-list is 149 ;; always of the form :key, while the 150 ;; cadr of current-list is either a) 151 ;; nil, b) of the form :key-next or c) 152 ;; a pcase pattern that can 153 ;; recursively match an expression. 154 (while current-list 155 (-let* (((curr-binding-as-keyword next-entry . _) current-list) 156 (curr-binding-as-camelcased-symbol 157 (or (alist-get curr-binding-as-keyword ',params) 158 (error "Unknown key: %s. Available keys: %s" 159 (symbol-name curr-binding-as-keyword) 160 ',(-map #'cl-first params)))) 161 (bound-name (lsp-keyword->symbol curr-binding-as-keyword)) 162 (next-entry-is-key-or-nil 163 (and (symbolp next-entry) 164 (or (null next-entry) 165 (s-starts-with? ":" (symbol-name next-entry)))))) 166 (cond 167 ;; If the next-entry is either a 168 ;; plist-key or nil, then bind to 169 ;; bound-name the value corresponding 170 ;; to the camelcased symbol. Pop 171 ;; current-list once. 172 (next-entry-is-key-or-nil 173 (push `(app (lambda (plist) 174 (plist-get plist ,curr-binding-as-camelcased-symbol)) 175 ,bound-name) 176 output-bindings) 177 (setf current-list (cdr current-list))) 178 ;; Otherwise, next-entry is a pcase 179 ;; pattern we recursively match to the 180 ;; expression. This can in general 181 ;; create additional bindings that we 182 ;; persist in the top level of 183 ;; bindings. We pop current-list 184 ;; twice. 185 (t 186 (push `(app (lambda (plist) 187 (plist-get plist ,curr-binding-as-camelcased-symbol)) 188 ,next-entry) 189 output-bindings) 190 (setf current-list (cddr current-list)))))) 191 output-bindings)) 192 ``(and 193 (pred ht?) 194 ,@(-map 195 (lambda (key) 196 `(pred 197 (lambda (hash-table) 198 (ht-contains? hash-table ,(lsp-keyword->string key))))) 199 ',required) 200 ,@(let ((current-list property-bindings) 201 (output-bindings nil)) 202 (while current-list 203 (-let* (((curr-binding-as-keyword next-entry . _) current-list) 204 (curr-binding-as-camelcased-string 205 (lsp-keyword->string (or (alist-get curr-binding-as-keyword ',params) 206 (error "Unknown key: %s. Available keys: %s" 207 (symbol-name curr-binding-as-keyword) 208 ',(-map #'cl-first params))))) 209 (bound-name (lsp-keyword->symbol curr-binding-as-keyword)) 210 (next-entry-is-key-or-nil 211 (and (symbolp next-entry) 212 (or (null next-entry) 213 (s-starts-with? ":" (symbol-name next-entry)))))) 214 (cond 215 (next-entry-is-key-or-nil 216 (push `(app (lambda (hash-table) 217 (ht-get hash-table ,curr-binding-as-camelcased-string)) 218 ,bound-name) 219 output-bindings) 220 (setf current-list (cdr current-list))) 221 (t 222 (push `(app (lambda (hash-table) 223 (ht-get hash-table ,curr-binding-as-camelcased-string)) 224 ,next-entry) 225 output-bindings) 226 (setf current-list (cddr current-list)))))) 227 output-bindings)))) 228 (-mapcat (-lambda ((label . name)) 229 (list 230 `(defun ,(intern (format "lsp:%s-%s" 231 (s-dashed-words (symbol-name interface)) 232 (substring (symbol-name label) 1))) 233 (object) 234 ,(if lsp-use-plists 235 `(plist-get object ,name) 236 `(when (ht? object) (gethash ,(lsp-keyword->string name) object)))) 237 `(defun ,(intern (format "lsp:set-%s-%s" 238 (s-dashed-words (symbol-name interface)) 239 (substring (symbol-name label) 1))) 240 (object value) 241 ,@(if lsp-use-plists 242 `((plist-put object ,name value)) 243 `((puthash ,(lsp-keyword->string name) value object) 244 object))))) 245 params))))) 246 (apply #'append) 247 (cl-list* 'progn)))) 248 249 (if lsp-use-plists 250 (progn 251 (defun lsp-get (from key) 252 (plist-get from key)) 253 (defun lsp-put (where key value) 254 (plist-put where key value)) 255 (defun lsp-map (fn value) 256 (-map (-lambda ((k v)) 257 (funcall fn (lsp-keyword->string k) v)) 258 (-partition 2 value ))) 259 (defalias 'lsp-merge 'append) 260 (defalias 'lsp-empty? 'null) 261 (defalias 'lsp-copy 'copy-sequence) 262 (defun lsp-member? (from key) 263 (when (listp from) 264 (plist-member from key))) 265 (defalias 'lsp-structure-p 'json-plist-p) 266 (defun lsp-delete (from key) 267 (cl-remf from key) 268 from)) 269 (defun lsp-get (from key) 270 (when from 271 (gethash (lsp-keyword->string key) from))) 272 (defun lsp-put (where key value) 273 (prog1 where 274 (puthash (lsp-keyword->string key) value where))) 275 (defun lsp-map (fn value) 276 (when value 277 (maphash fn value))) 278 (defalias 'lsp-merge 'ht-merge) 279 (defalias 'lsp-empty? 'ht-empty?) 280 (defalias 'lsp-copy 'ht-copy) 281 (defun lsp-member? (from key) 282 (when (hash-table-p from) 283 (not (eq (gethash (lsp-keyword->string key) from :__lsp_default) 284 :__lsp_default)))) 285 (defalias 'lsp-structure-p 'hash-table-p) 286 (defun lsp-delete (from key) 287 (ht-remove from (lsp-keyword->string key)) 288 from)) 289 290 (defmacro lsp-defun (name match-form &rest body) 291 "Define a function named NAME. 292 The function destructures its input as MATCH-FORM then executes BODY. 293 294 Note that you have to enclose the MATCH-FORM in a pair of parens, 295 such that: 296 297 (-defun (x) body) 298 (-defun (x y ...) body) 299 300 has the usual semantics of `defun'. Furthermore, these get 301 translated into a normal `defun', so there is no performance 302 penalty. 303 304 See `-let' for a description of the destructuring mechanism." 305 (declare (doc-string 3) (indent defun) 306 (debug (&define name sexp 307 [&optional stringp] 308 [&optional ("declare" &rest sexp)] 309 [&optional ("interactive" interactive)] 310 def-body))) 311 (cond 312 ((nlistp match-form) 313 (signal 'wrong-type-argument (list #'listp match-form))) 314 ;; no destructuring, so just return regular defun to make things faster 315 ((-all? #'symbolp match-form) 316 `(defun ,name ,match-form ,@body)) 317 (t 318 (-let* ((inputs (--map-indexed (list it (make-symbol (format "input%d" it-index))) match-form)) 319 ((body docs) (cond 320 ;; only docs 321 ((and (stringp (car body)) 322 (not (cdr body))) 323 (list body (car body))) 324 ;; docs + body 325 ((stringp (car body)) 326 (list (cdr body) (car body))) 327 ;; no docs 328 (t (list body)))) 329 ((body interactive-form) (cond 330 ;; interactive form 331 ((and (listp (car body)) 332 (eq (caar body) 'interactive)) 333 (list (cdr body) (car body))) 334 ;; no interactive form 335 (t (list body))))) 336 ;; TODO: because inputs to the defun are evaluated only once, 337 ;; -let* need not to create the extra bindings to ensure that. 338 ;; We should find a way to optimize that. Not critical however. 339 `(defun ,name ,(-map #'cadr inputs) 340 ,@(when docs (list docs)) 341 ,@(when interactive-form (list interactive-form)) 342 (-let* ,inputs ,@body)))))) 343 344 345 346 347 ;; manually defined interfaces 348 (defconst lsp/markup-kind-plain-text "plaintext") 349 (defconst lsp/markup-kind-markdown "markdown") 350 351 (lsp-interface (JSONResponse (:params :id :method :result) nil) 352 (JSONResponseError (:error) nil) 353 (JSONMessage nil (:params :id :method :result :error)) 354 (JSONResult nil (:params :id :method)) 355 (JSONNotification (:params :method) nil) 356 (JSONRequest (:params :method) nil) 357 (JSONError (:message :code) (:data)) 358 (ProgressParams (:token :value) nil) 359 (Edit (:kind) nil) 360 (WorkDoneProgress (:kind) nil) 361 (WorkDoneProgressBegin (:kind :title) (:cancellable :message :percentage)) 362 (WorkDoneProgressReport (:kind) (:cancellable :message :percentage)) 363 (WorkDoneProgressEnd (:kind) (:message)) 364 (WorkDoneProgressOptions nil (:workDoneProgress)) 365 (SemanticTokensOptions (:legend) (:rangeProvider :documentProvider)) 366 (SemanticTokensLegend (:tokenTypes :tokenModifiers)) 367 (SemanticTokensResult (:resultId) (:data)) 368 (SemanticTokensPartialResult nil (:data)) 369 (SemanticTokensEdit (:start :deleteCount) (:data)) 370 (SemanticTokensDelta (:resultId) (:edits)) 371 (SemanticTokensDeltaPartialResult nil (:edits))) 372 373 (lsp-interface (v1:ProgressParams (:id :title) (:message :percentage :done))) 374 375 (defun dash-expand:&RangeToPoint (key source) 376 "Convert the position KEY from SOURCE into a point." 377 `(lsp--position-to-point 378 (lsp-get ,source ,key))) 379 380 (lsp-interface (eslint:StatusParams (:state) nil) 381 (eslint:OpenESLintDocParams (:url) nil) 382 (eslint:ConfirmExecutionParams (:scope :file :libraryPath) nil)) 383 384 (lsp-interface (haxe:ProcessStartNotification (:title) nil)) 385 386 (lsp-interface (pwsh:ScriptRegion (:StartLineNumber :EndLineNumber :StartColumnNumber :EndColumnNumber :Text) nil)) 387 388 (lsp-interface (omnisharp:ErrorMessage (:Text :FileName :Line :Column)) 389 (omnisharp:ProjectInformationRequest (:FileName)) 390 (omnisharp:MsBuildProject (:IsUnitProject :IsExe :Platform :Configuration :IntermediateOutputPath :OutputPath :TargetFrameworks :SourceFiles :TargetFramework :TargetPath :AssemblyName :Path :ProjectGuid)) 391 (omnisharp:ProjectInformation (:ScriptProject :MsBuildProject)) 392 (omnisharp:CodeStructureRequest (:FileName)) 393 (omnisharp:CodeStructureResponse (:Elements)) 394 (omnisharp:CodeElement (:Kind :Name :DisplayName :Children :Ranges :Properties)) 395 (omnisharp:CodeElementProperties () (:static :accessibility :testMethodName :testFramework)) 396 (omnisharp:Range (:Start :End)) 397 (omnisharp:RangeList () (:attributes :full :name)) 398 (omnisharp:Point (:Line :Column)) 399 (omnisharp:RunTestsInClassRequest (:MethodNames :RunSettings :TestFrameworkname :TargetFrameworkVersion :NoBuild :Line :Column :Buffer :FileName)) 400 (omnisharp:RunTestResponse (:Results :Pass :Failure :ContextHadNoTests)) 401 (omnisharp:TestMessageEvent (:MessageLevel :Message)) 402 (omnisharp:DotNetTestResult (:MethodName :Outcome :ErrorMessage :ErrorStackTrace :StandardOutput :StandardError)) 403 (omnisharp:MetadataRequest (:AssemblyName :TypeName :ProjectName :VersionNumber :Language)) 404 (omnisharp:MetadataResponse (:SourceName :Source))) 405 406 (lsp-interface (csharp-ls:CSharpMetadata (:textDocument)) 407 (csharp-ls:CSharpMetadataResponse (:source :projectName :assemblyName :symbolName))) 408 409 (lsp-interface (rls:Cmd (:args :binary :env :cwd) nil)) 410 411 (lsp-interface (rust-analyzer:AnalyzerStatusParams (:textDocument)) 412 (rust-analyzer:SyntaxTreeParams (:textDocument) (:range)) 413 (rust-analyzer:ViewHir (:textDocument :position)) 414 (rust-analyzer:ViewItemTree (:textDocument)) 415 (rust-analyzer:ExpandMacroParams (:textDocument :position) nil) 416 (rust-analyzer:ExpandedMacro (:name :expansion) nil) 417 (rust-analyzer:MatchingBraceParams (:textDocument :positions) nil) 418 (rust-analyzer:OpenCargoTomlParams (:textDocument) nil) 419 (rust-analyzer:OpenExternalDocsParams (:textDocument :position) nil) 420 (rust-analyzer:ResovedCodeActionParams (:id :codeActionParams) nil) 421 (rust-analyzer:JoinLinesParams (:textDocument :ranges) nil) 422 (rust-analyzer:MoveItemParams (:textDocument :range :direction) nil) 423 (rust-analyzer:RunnablesParams (:textDocument) (:position)) 424 (rust-analyzer:Runnable (:label :kind :args) (:location)) 425 (rust-analyzer:RunnableArgs (:cargoArgs :executableArgs) (:workspaceRoot :expectTest)) 426 (rust-analyzer:RelatedTestsParams (:textDocument :position) nil) 427 (rust-analyzer:RelatedTests (:runnable) nil) 428 (rust-analyzer:SsrParams (:query :parseOnly) nil) 429 (rust-analyzer:CommandLink (:title :command) (:arguments :tooltip)) 430 (rust-analyzer:CommandLinkGroup (:commands) (:title))) 431 432 (lsp-interface (clojure-lsp:TestTreeParams (:uri :tree) nil) 433 (clojure-lsp:TestTreeNode (:name :range :nameRange :kind) (:children)) 434 (clojure-lsp:ProjectTreeNode (:name :type) (:nodes :final :id :uri :detail :range))) 435 436 (lsp-interface (terraform-ls:ModuleCalls (:v :module_calls) nil)) 437 (lsp-interface (terraform-ls:Module (:name :docs_link :version :source_type :dependent_modules) nil)) 438 (lsp-interface (terraform-ls:Providers (:v :provider_requirements :installed_providers) nil)) 439 (lsp-interface (terraform-ls:module.terraform (:v :required_version :discovered_version))) 440 441 442 ;; begin autogenerated code 443 444 (defvar lsp/completion-item-kind-lookup 445 [nil Text Method Function Constructor Field Variable Class Interface Module Property Unit Value Enum Keyword Snippet Color File Reference Folder EnumMember Constant Struct Event Operator TypeParameter]) 446 (defconst lsp/completion-item-kind-text 1) 447 (defconst lsp/completion-item-kind-method 2) 448 (defconst lsp/completion-item-kind-function 3) 449 (defconst lsp/completion-item-kind-constructor 4) 450 (defconst lsp/completion-item-kind-field 5) 451 (defconst lsp/completion-item-kind-variable 6) 452 (defconst lsp/completion-item-kind-class 7) 453 (defconst lsp/completion-item-kind-interface 8) 454 (defconst lsp/completion-item-kind-module 9) 455 (defconst lsp/completion-item-kind-property 10) 456 (defconst lsp/completion-item-kind-unit 11) 457 (defconst lsp/completion-item-kind-value 12) 458 (defconst lsp/completion-item-kind-enum 13) 459 (defconst lsp/completion-item-kind-keyword 14) 460 (defconst lsp/completion-item-kind-snippet 15) 461 (defconst lsp/completion-item-kind-color 16) 462 (defconst lsp/completion-item-kind-file 17) 463 (defconst lsp/completion-item-kind-reference 18) 464 (defconst lsp/completion-item-kind-folder 19) 465 (defconst lsp/completion-item-kind-enum-member 20) 466 (defconst lsp/completion-item-kind-constant 21) 467 (defconst lsp/completion-item-kind-struct 22) 468 (defconst lsp/completion-item-kind-event 23) 469 (defconst lsp/completion-item-kind-operator 24) 470 (defconst lsp/completion-item-kind-type-parameter 25) 471 (defvar lsp/completion-trigger-kind-lookup 472 [nil Invoked TriggerCharacter TriggerForIncompleteCompletions]) 473 (defconst lsp/completion-trigger-kind-invoked 1) 474 (defconst lsp/completion-trigger-kind-trigger-character 2) 475 (defconst lsp/completion-trigger-kind-trigger-for-incomplete-completions 3) 476 (defvar lsp/diagnostic-severity-lookup 477 [nil Error Warning Information Hint Max]) 478 (defconst lsp/diagnostic-severity-error 1) 479 (defconst lsp/diagnostic-severity-warning 2) 480 (defconst lsp/diagnostic-severity-information 3) 481 (defconst lsp/diagnostic-severity-hint 4) 482 (defconst lsp/diagnostic-severity-max 5) 483 (defvar lsp/diagnostic-tag-lookup 484 [nil Unnecessary Deprecated]) 485 (defconst lsp/diagnostic-tag-unnecessary 1) 486 (defconst lsp/diagnostic-tag-deprecated 2) 487 (defvar lsp/completion-item-tag-lookup 488 [nil Deprecated]) 489 (defconst lsp/completion-item-tag-deprecated 1) 490 (defvar lsp/document-highlight-kind-lookup 491 [nil Text Read Write]) 492 (defconst lsp/document-highlight-kind-text 1) 493 (defconst lsp/document-highlight-kind-read 2) 494 (defconst lsp/document-highlight-kind-write 3) 495 (defvar lsp/file-change-type-lookup 496 [nil Created Changed Deleted]) 497 (defconst lsp/file-change-type-created 1) 498 (defconst lsp/file-change-type-changed 2) 499 (defconst lsp/file-change-type-deleted 3) 500 (defvar lsp/insert-text-format-lookup 501 [nil PlainText Snippet]) 502 (defconst lsp/insert-text-format-plain-text 1) 503 (defconst lsp/insert-text-format-snippet 2) 504 (defvar lsp/insert-text-mode-lookup 505 [nil AsIs AdjustIndentation]) 506 (defconst lsp/insert-text-mode-as-it 1) 507 (defconst lsp/insert-text-mode-adjust-indentation 2) 508 (defvar lsp/message-type-lookup 509 [nil Error Warning Info Log]) 510 (defconst lsp/message-type-error 1) 511 (defconst lsp/message-type-warning 2) 512 (defconst lsp/message-type-info 3) 513 (defconst lsp/message-type-log 4) 514 (defvar lsp/signature-help-trigger-kind-lookup 515 [nil Invoked TriggerCharacter ContentChange]) 516 (defconst lsp/signature-help-trigger-kind-invoked 1) 517 (defconst lsp/signature-help-trigger-kind-trigger-character 2) 518 (defconst lsp/signature-help-trigger-kind-content-change 3) 519 (defvar lsp/symbol-kind-lookup 520 [nil File Module Namespace Package Class Method Property Field Constructor Enum Interface Function Variable Constant String Number Boolean Array Object Key Null EnumMember Struct Event Operator TypeParameter]) 521 (defconst lsp/symbol-kind-file 1) 522 (defconst lsp/symbol-kind-module 2) 523 (defconst lsp/symbol-kind-namespace 3) 524 (defconst lsp/symbol-kind-package 4) 525 (defconst lsp/symbol-kind-class 5) 526 (defconst lsp/symbol-kind-method 6) 527 (defconst lsp/symbol-kind-property 7) 528 (defconst lsp/symbol-kind-field 8) 529 (defconst lsp/symbol-kind-constructor 9) 530 (defconst lsp/symbol-kind-enum 10) 531 (defconst lsp/symbol-kind-interface 11) 532 (defconst lsp/symbol-kind-function 12) 533 (defconst lsp/symbol-kind-variable 13) 534 (defconst lsp/symbol-kind-constant 14) 535 (defconst lsp/symbol-kind-string 15) 536 (defconst lsp/symbol-kind-number 16) 537 (defconst lsp/symbol-kind-boolean 17) 538 (defconst lsp/symbol-kind-array 18) 539 (defconst lsp/symbol-kind-object 19) 540 (defconst lsp/symbol-kind-key 20) 541 (defconst lsp/symbol-kind-null 21) 542 (defconst lsp/symbol-kind-enum-member 22) 543 (defconst lsp/symbol-kind-struct 23) 544 (defconst lsp/symbol-kind-event 24) 545 (defconst lsp/symbol-kind-operator 25) 546 (defconst lsp/symbol-kind-type-parameter 26) 547 (defvar lsp/text-document-save-reason-lookup 548 [nil Manual AfterDelay FocusOut]) 549 (defconst lsp/text-document-save-reason-manual 1) 550 (defconst lsp/text-document-save-reason-after-delay 2) 551 (defconst lsp/text-document-save-reason-focus-out 3) 552 (defvar lsp/text-document-sync-kind-lookup 553 [None Full Incremental]) 554 (defconst lsp/text-document-sync-kind-none 0) 555 (defconst lsp/text-document-sync-kind-full 1) 556 (defconst lsp/text-document-sync-kind-incremental 2) 557 (defvar lsp/type-hierarchy-direction-lookup 558 [nil Children Parents Both]) 559 (defconst lsp/type-hierarchy-direction-children 1) 560 (defconst lsp/type-hierarchy-direction-parents 2) 561 (defconst lsp/type-hierarchy-direction-both 3) 562 (defvar lsp/call-hierarchy-direction-lookup 563 [nil CallsFrom CallsTo]) 564 (defconst lsp/call-hierarchy-direction-calls-from 1) 565 (defconst lsp/call-hierarchy-direction-calls-to 2) 566 (defvar lsp/response-error-code-lookup 567 [nil ParseError InvalidRequest MethodNotFound InvalidParams InternalError serverErrorStart serverErrorEnd]) 568 (defconst lsp/response-error-code-parse-error 1) 569 (defconst lsp/response-error-code-invalid-request 2) 570 (defconst lsp/response-error-code-method-not-found 3) 571 (defconst lsp/response-error-code-invalid-params 4) 572 (defconst lsp/response-error-code-internal-error 5) 573 (defconst lsp/response-error-code-server-error-start 6) 574 (defconst lsp/response-error-code-server-error-end 7) 575 576 (lsp-interface 577 (CallHierarchyCapabilities nil (:dynamicRegistration)) 578 (CallHierarchyItem (:kind :name :range :selectionRange :uri) (:detail :tags)) 579 (ClientCapabilities nil (:experimental :textDocument :workspace)) 580 (ClientInfo (:name) (:version)) 581 (CodeActionCapabilities nil (:codeActionLiteralSupport :dynamicRegistration :isPreferredSupport :dataSupport :resolveSupport)) 582 (CodeActionContext (:diagnostics) (:only)) 583 (CodeActionKindCapabilities (:valueSet) nil) 584 (CodeActionLiteralSupportCapabilities nil (:codeActionKind)) 585 (CodeActionOptions nil (:codeActionKinds :resolveProvider)) 586 (CodeLensCapabilities nil (:dynamicRegistration)) 587 (CodeLensOptions (:resolveProvider) nil) 588 (Color (:red :green :blue :alpha) nil) 589 (ColorProviderCapabilities nil (:dynamicRegistration)) 590 (ColorProviderOptions nil (:documentSelector :id)) 591 (ColoringInformation (:range :styles) nil) 592 (Command (:title :command) (:arguments)) 593 (CompletionCapabilities nil (:completionItem :completionItemKind :contextSupport :dynamicRegistration)) 594 (CompletionContext (:triggerKind) (:triggerCharacter)) 595 (CompletionItem (:label) (:additionalTextEdits :command :commitCharacters :data :deprecated :detail :documentation :filterText :insertText :insertTextFormat :insertTextMode :kind :preselect :sortText :tags :textEdit :score :labelDetails)) 596 (CompletionItemCapabilities nil (:commitCharactersSupport :deprecatedSupport :documentationFormat :preselectSupport :snippetSupport :tagSupport :insertReplaceSupport :resolveSupport)) 597 (CompletionItemKindCapabilities nil (:valueSet)) 598 (CompletionItemTagSupportCapabilities (:valueSet) nil) 599 (CompletionOptions nil (:resolveProvider :triggerCharacters :allCommitCharacters)) 600 (ConfigurationItem nil (:scopeUri :section)) 601 (CreateFileOptions nil (:ignoreIfExists :overwrite)) 602 (DeclarationCapabilities nil (:dynamicRegistration :linkSupport)) 603 (DefinitionCapabilities nil (:dynamicRegistration :linkSupport)) 604 (DeleteFileOptions nil (:ignoreIfNotExists :recursive)) 605 (Diagnostic (:range :message) (:code :relatedInformation :severity :source :tags)) 606 (DiagnosticRelatedInformation (:location :message) nil) 607 (DiagnosticsTagSupport (:valueSet) nil) 608 (DidChangeConfigurationCapabilities nil (:dynamicRegistration)) 609 (DidChangeWatchedFilesCapabilities nil (:dynamicRegistration)) 610 (DocumentFilter nil (:language :pattern :scheme)) 611 (DocumentHighlightCapabilities nil (:dynamicRegistration)) 612 (DocumentLinkCapabilities nil (:dynamicRegistration :tooltipSupport)) 613 (DocumentLinkOptions nil (:resolveProvider)) 614 (DocumentOnTypeFormattingOptions (:firstTriggerCharacter) (:moreTriggerCharacter)) 615 (DocumentSymbol (:kind :name :range :selectionRange) (:children :deprecated :detail)) 616 (DocumentSymbolCapabilities nil (:dynamicRegistration :hierarchicalDocumentSymbolSupport :symbolKind)) 617 (ExecuteCommandCapabilities nil (:dynamicRegistration)) 618 (ExecuteCommandOptions (:commands) nil) 619 (FileEvent (:type :uri) nil) 620 (FileSystemWatcher (:globPattern) (:kind)) 621 (FileOperationFilter (:pattern) (:scheme)) 622 (FileOperationPattern (:glob) (:matches :options)) 623 (FileOperationPatternOptions nil (:ignoreCase)) 624 (FileOperationRegistrationOptions (:filters) nil) 625 (FoldingRangeCapabilities nil (:dynamicRegistration :lineFoldingOnly :rangeLimit)) 626 (FoldingRangeProviderOptions nil (:documentSelector :id)) 627 (FormattingCapabilities nil (:dynamicRegistration)) 628 (FormattingOptions (:tabSize :insertSpaces) (:trimTrailingWhitespace :insertFinalNewline :trimFinalNewlines)) 629 (HoverCapabilities nil (:contentFormat :dynamicRegistration)) 630 (ImplementationCapabilities nil (:dynamicRegistration :linkSupport)) 631 (LabelDetails (:detail :description) nil) 632 (LinkedEditingRanges (:ranges) (:wordPattern)) 633 (Location (:range :uri) nil) 634 (MarkedString (:language :value) nil) 635 (MarkupContent (:kind :value) nil) 636 (MessageActionItem (:title) nil) 637 (OnTypeFormattingCapabilities nil (:dynamicRegistration)) 638 (ParameterInformation (:label) (:documentation)) 639 (ParameterInformationCapabilities nil (:labelOffsetSupport)) 640 (Position (:character :line) nil) 641 (PublishDiagnosticsCapabilities nil (:relatedInformation :tagSupport :versionSupport)) 642 (Range (:start :end) nil) 643 (RangeFormattingCapabilities nil (:dynamicRegistration)) 644 (ReferenceContext (:includeDeclaration) nil) 645 (ReferencesCapabilities nil (:dynamicRegistration)) 646 (Registration (:method :id) (:registerOptions)) 647 (RenameCapabilities nil (:dynamicRegistration :prepareSupport)) 648 (RenameFileOptions nil (:ignoreIfExists :overwrite)) 649 (RenameOptions nil (:documentSelector :id :prepareProvider)) 650 (ResourceChange nil (:current :newUri)) 651 (ResourceOperation (:kind) nil) 652 (SaveOptions nil (:includeText)) 653 (SelectionRange (:range) (:parent)) 654 (SelectionRangeCapabilities nil (:dynamicRegistration)) 655 (SemanticHighlightingCapabilities nil (:semanticHighlighting)) 656 (SemanticHighlightingInformation (:line) (:tokens)) 657 (SemanticHighlightingServerCapabilities nil (:scopes)) 658 (ServerCapabilities nil (:callHierarchyProvider :codeActionProvider :codeLensProvider :colorProvider :completionProvider :declarationProvider :definitionProvider :documentFormattingProvider :documentHighlightProvider :documentLinkProvider :documentOnTypeFormattingProvider :documentRangeFormattingProvider :documentSymbolProvider :executeCommandProvider :experimental :foldingRangeProvider :hoverProvider :implementationProvider :referencesProvider :renameProvider :selectionRangeProvider :semanticHighlighting :signatureHelpProvider :textDocumentSync :typeDefinitionProvider :typeHierarchyProvider :workspace :workspaceSymbolProvider :semanticTokensProvider)) 659 (ServerInfo (:name) (:version)) 660 (SignatureHelp (:signatures) (:activeParameter :activeSignature)) 661 (SignatureHelpCapabilities nil (:contextSupport :dynamicRegistration :signatureInformation)) 662 (SignatureHelpContext (:triggerKind :isRetrigger) (:activeSignatureHelp :triggerCharacter)) 663 (SignatureHelpOptions nil (:retriggerCharacters :triggerCharacters)) 664 (SignatureInformation (:label) (:documentation :parameters)) 665 (SignatureInformationCapabilities nil (:documentationFormat :parameterInformation)) 666 (StaticRegistrationOptions nil (:documentSelector :id)) 667 (SymbolCapabilities nil (:dynamicRegistration :symbolKind)) 668 (SymbolKindCapabilities nil (:valueSet)) 669 (SynchronizationCapabilities nil (:didSave :dynamicRegistration :willSave :willSaveWaitUntil)) 670 (TextDocumentClientCapabilities nil (:callHierarchy :codeAction :codeLens :colorProvider :completion :declaration :definition :documentHighlight :documentLink :documentSymbol :foldingRange :formatting :hover :implementation :onTypeFormatting :publishDiagnostics :rangeFormatting :references :rename :selectionRange :semanticHighlightingCapabilities :signatureHelp :synchronization :typeDefinition :typeHierarchyCapabilities)) 671 (TextDocumentContentChangeEvent (:text) (:range :rangeLength)) 672 (TextDocumentEdit (:textDocument :edits) nil) 673 (TextDocumentIdentifier (:uri) nil) 674 (TextDocumentItem (:languageId :text :uri :version) nil) 675 (TextDocumentSyncOptions nil (:change :openClose :save :willSave :willSaveWaitUntil)) 676 (TextEdit (:newText :range) nil) 677 (InsertReplaceEdit (:newText :insert :replace) nil) 678 (SnippetTextEdit (:newText :range) (:insertTextFormat)) 679 (TypeDefinitionCapabilities nil (:dynamicRegistration :linkSupport)) 680 (TypeHierarchyCapabilities nil (:dynamicRegistration)) 681 (TypeHierarchyItem (:kind :name :range :selectionRange :uri) (:children :data :deprecated :detail :parents)) 682 (Unregistration (:method :id) nil) 683 (VersionedTextDocumentIdentifier (:uri) (:version)) 684 (WorkspaceClientCapabilities nil (:applyEdit :configuration :didChangeConfiguration :didChangeWatchedFiles :executeCommand :symbol :workspaceEdit :workspaceFolders)) 685 (WorkspaceEdit nil (:changes :documentChanges :resourceChanges)) 686 (WorkspaceEditCapabilities nil (:documentChanges :failureHandling :resourceChanges :resourceOperations)) 687 (WorkspaceFolder (:uri :name) nil) 688 (WorkspaceFoldersChangeEvent (:removed :added) nil) 689 (WorkspaceFoldersOptions nil (:changeNotifications :supported)) 690 (WorkspaceServerCapabilities nil (:workspaceFolders :fileOperations)) 691 (WorkspaceFileOperations nil (:didCreate :willCreate :didRename :willRename :didDelete :willDelete)) 692 (ApplyWorkspaceEditParams (:edit) (:label)) 693 (ApplyWorkspaceEditResponse (:applied) nil) 694 (CallHierarchyIncomingCall (:from :fromRanges) nil) 695 (CallHierarchyIncomingCallsParams (:item) nil) 696 (CallHierarchyOutgoingCall (:to :fromRanges) nil) 697 (CallHierarchyOutgoingCallsParams (:item) nil) 698 (CallHierarchyPrepareParams (:textDocument :position) (:uri)) 699 (CodeAction (:title) (:command :diagnostics :edit :isPreferred :kind :data)) 700 (CodeActionKind nil nil) 701 (CodeActionParams (:textDocument :context :range) nil) 702 (CodeLens (:range) (:command :data)) 703 (CodeLensParams (:textDocument) nil) 704 (CodeLensRegistrationOptions nil (:documentSelector :resolveProvider)) 705 (ColorInformation (:color :range) nil) 706 (ColorPresentation (:label) (:additionalTextEdits :textEdit)) 707 (ColorPresentationParams (:color :textDocument :range) nil) 708 (ColoringParams (:uri :infos) nil) 709 (ColoringStyle nil nil) 710 (CompletionList (:items :isIncomplete) nil) 711 (CompletionParams (:textDocument :position) (:context :uri)) 712 (CompletionRegistrationOptions nil (:documentSelector :resolveProvider :triggerCharacters)) 713 (ConfigurationParams (:items) nil) 714 (CreateFile (:kind :uri) (:options)) 715 (DeclarationParams (:textDocument :position) (:uri)) 716 (DefinitionParams (:textDocument :position) (:uri)) 717 (DeleteFile (:kind :uri) (:options)) 718 (DidChangeConfigurationParams (:settings) nil) 719 (DidChangeTextDocumentParams (:contentChanges :textDocument) (:uri)) 720 (DidChangeWatchedFilesParams (:changes) nil) 721 (DidChangeWatchedFilesRegistrationOptions (:watchers) nil) 722 (DidChangeWorkspaceFoldersParams (:event) nil) 723 (DidCloseTextDocumentParams (:textDocument) nil) 724 (DidOpenTextDocumentParams (:textDocument) (:text)) 725 (DidSaveTextDocumentParams (:textDocument) (:text)) 726 (DocumentColorParams (:textDocument) nil) 727 (DocumentFormattingParams (:textDocument :options) nil) 728 (DocumentHighlight (:range) (:kind)) 729 (DocumentHighlightParams (:textDocument :position) (:uri)) 730 (DocumentLink (:range) (:data :target :tooltip)) 731 (DocumentLinkParams (:textDocument) nil) 732 (DocumentLinkRegistrationOptions nil (:documentSelector :resolveProvider)) 733 (DocumentOnTypeFormattingParams (:ch :textDocument :options :position) nil) 734 (DocumentOnTypeFormattingRegistrationOptions (:firstTriggerCharacter) (:documentSelector :moreTriggerCharacter)) 735 (DocumentRangeFormattingParams (:textDocument :options :range) nil) 736 (DocumentSymbolParams (:textDocument) nil) 737 (DynamicRegistrationCapabilities nil (:dynamicRegistration)) 738 (ExecuteCommandParams (:command) (:arguments)) 739 (ExecuteCommandRegistrationOptions (:commands) nil) 740 (FailureHandlingKind nil nil) 741 (FileRename (:oldUri :newUri) nil) 742 (FoldingRange (:endLine :startLine) (:endCharacter :kind :startCharacter)) 743 (FoldingRangeKind nil nil) 744 (FoldingRangeRequestParams (:textDocument) nil) 745 (Hover (:contents) (:range)) 746 (HoverParams (:textDocument :position) (:uri)) 747 (ImplementationParams (:textDocument :position) (:uri)) 748 (InitializeError (:retry) nil) 749 (InitializeErrorCode nil nil) 750 (InitializeParams nil (:capabilities :clientInfo :clientName :initializationOptions :processId :rootPath :rootUri :trace :workspaceFolders)) 751 (InitializeResult (:capabilities) (:serverInfo)) 752 (InitializedParams nil nil) 753 (LocationLink (:targetSelectionRange :targetUri :targetRange) (:originSelectionRange)) 754 (MarkupKind nil nil) 755 (MessageParams (:type :message) nil) 756 (PrepareRenameParams (:textDocument :position) (:uri)) 757 (PrepareRenameResult (:range :placeholder) nil) 758 (PublishDiagnosticsParams (:diagnostics :uri) (:version)) 759 (QuickPickItem (:label :picked :userData) nil) 760 (ReferenceParams (:textDocument :context :position) (:uri)) 761 (RegistrationParams (:registrations) nil) 762 (RenameFile (:kind :newUri :oldUri) (:options)) 763 (RenameFilesParams (:files) nil) 764 (RenameParams (:newName :textDocument :position) (:uri)) 765 (ResolveTypeHierarchyItemParams (:item :resolve :direction) nil) 766 (ResourceOperationKind nil nil) 767 (SelectionRangeParams (:textDocument :positions) nil) 768 (SemanticHighlightingParams (:textDocument :lines) nil) 769 (ShowDocumentParams (:uri) (:external :takeFocus :selection)) 770 (ShowDocumentResult (:success) nil) 771 (ShowInputBoxParams (:prompt) (:value)) 772 (ShowMessageRequestParams (:type :message) (:actions)) 773 (ShowQuickPickParams (:placeHolder :canPickMany :items) nil) 774 (SignatureHelpParams (:textDocument :position) (:context :uri)) 775 (SignatureHelpRegistrationOptions nil (:documentSelector :triggerCharacters)) 776 (SymbolInformation (:kind :name :location) (:containerName :deprecated)) 777 (TextDocumentChangeRegistrationOptions (:syncKind) (:documentSelector)) 778 (TextDocumentPositionParams (:textDocument :position) (:uri)) 779 (TextDocumentRegistrationOptions nil (:documentSelector)) 780 (TextDocumentSaveRegistrationOptions nil (:documentSelector :includeText)) 781 (TypeDefinitionParams (:textDocument :position) (:uri)) 782 (TypeHierarchyParams (:resolve :textDocument :position) (:direction :uri)) 783 (UnregistrationParams (:unregisterations) nil) 784 (WatchKind nil nil) 785 (WillSaveTextDocumentParams (:reason :textDocument) nil) 786 (WorkspaceSymbolParams (:query) nil) 787 ;; 3.17 788 (InlayHint (:label :position) (:kind :paddingLeft :paddingRight)) 789 (InlayHintLabelPart (:value) (:tooltip :location :command)) 790 (InlayHintsParams (:textDocument) (:range))) 791 792 ;; 3.17 793 (defconst lsp/inlay-hint-kind-type-hint 1) 794 (defconst lsp/inlay-hint-kind-parameter-hint 2) 795 796 797 (provide 'lsp-protocol) 798 799 ;;; lsp-protocol.el ends here