protocol.lua 40 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078
  1. --- @diagnostic disable: duplicate-doc-alias
  2. ---@param tbl table<string, string|number>
  3. local function get_value_set(tbl)
  4. local value_set = {}
  5. for _, v in pairs(tbl) do
  6. table.insert(value_set, v)
  7. end
  8. table.sort(value_set)
  9. return value_set
  10. end
  11. local sysname = vim.uv.os_uname().sysname
  12. --- @class vim.lsp.protocol.constants
  13. --- @nodoc
  14. local constants = {
  15. --- @enum lsp.DiagnosticSeverity
  16. DiagnosticSeverity = {
  17. -- Reports an error.
  18. Error = 1,
  19. -- Reports a warning.
  20. Warning = 2,
  21. -- Reports an information.
  22. Information = 3,
  23. -- Reports a hint.
  24. Hint = 4,
  25. },
  26. --- @enum lsp.DiagnosticTag
  27. DiagnosticTag = {
  28. -- Unused or unnecessary code
  29. Unnecessary = 1,
  30. -- Deprecated or obsolete code
  31. Deprecated = 2,
  32. },
  33. ---@enum lsp.MessageType
  34. MessageType = {
  35. -- An error message.
  36. Error = 1,
  37. -- A warning message.
  38. Warning = 2,
  39. -- An information message.
  40. Info = 3,
  41. -- A log message.
  42. Log = 4,
  43. -- A debug message.
  44. Debug = 5,
  45. },
  46. -- The file event type.
  47. ---@enum lsp.FileChangeType
  48. FileChangeType = {
  49. -- The file got created.
  50. Created = 1,
  51. -- The file got changed.
  52. Changed = 2,
  53. -- The file got deleted.
  54. Deleted = 3,
  55. },
  56. -- The kind of a completion entry.
  57. CompletionItemKind = {
  58. Text = 1,
  59. Method = 2,
  60. Function = 3,
  61. Constructor = 4,
  62. Field = 5,
  63. Variable = 6,
  64. Class = 7,
  65. Interface = 8,
  66. Module = 9,
  67. Property = 10,
  68. Unit = 11,
  69. Value = 12,
  70. Enum = 13,
  71. Keyword = 14,
  72. Snippet = 15,
  73. Color = 16,
  74. File = 17,
  75. Reference = 18,
  76. Folder = 19,
  77. EnumMember = 20,
  78. Constant = 21,
  79. Struct = 22,
  80. Event = 23,
  81. Operator = 24,
  82. TypeParameter = 25,
  83. },
  84. -- How a completion was triggered
  85. CompletionTriggerKind = {
  86. -- Completion was triggered by typing an identifier (24x7 code
  87. -- complete), manual invocation (e.g Ctrl+Space) or via API.
  88. Invoked = 1,
  89. -- Completion was triggered by a trigger character specified by
  90. -- the `triggerCharacters` properties of the `CompletionRegistrationOptions`.
  91. TriggerCharacter = 2,
  92. -- Completion was re-triggered as the current completion list is incomplete.
  93. TriggerForIncompleteCompletions = 3,
  94. },
  95. -- Completion item tags are extra annotations that tweak the rendering of a
  96. -- completion item
  97. CompletionTag = {
  98. -- Render a completion as obsolete, usually using a strike-out.
  99. Deprecated = 1,
  100. },
  101. -- A document highlight kind.
  102. DocumentHighlightKind = {
  103. -- A textual occurrence.
  104. Text = 1,
  105. -- Read-access of a symbol, like reading a variable.
  106. Read = 2,
  107. -- Write-access of a symbol, like writing to a variable.
  108. Write = 3,
  109. },
  110. -- A symbol kind.
  111. SymbolKind = {
  112. File = 1,
  113. Module = 2,
  114. Namespace = 3,
  115. Package = 4,
  116. Class = 5,
  117. Method = 6,
  118. Property = 7,
  119. Field = 8,
  120. Constructor = 9,
  121. Enum = 10,
  122. Interface = 11,
  123. Function = 12,
  124. Variable = 13,
  125. Constant = 14,
  126. String = 15,
  127. Number = 16,
  128. Boolean = 17,
  129. Array = 18,
  130. Object = 19,
  131. Key = 20,
  132. Null = 21,
  133. EnumMember = 22,
  134. Struct = 23,
  135. Event = 24,
  136. Operator = 25,
  137. TypeParameter = 26,
  138. },
  139. -- Represents reasons why a text document is saved.
  140. ---@enum lsp.TextDocumentSaveReason
  141. TextDocumentSaveReason = {
  142. -- Manually triggered, e.g. by the user pressing save, by starting debugging,
  143. -- or by an API call.
  144. Manual = 1,
  145. -- Automatic after a delay.
  146. AfterDelay = 2,
  147. -- When the editor lost focus.
  148. FocusOut = 3,
  149. },
  150. ErrorCodes = {
  151. -- Defined by JSON RPC
  152. ParseError = -32700,
  153. InvalidRequest = -32600,
  154. MethodNotFound = -32601,
  155. InvalidParams = -32602,
  156. InternalError = -32603,
  157. serverErrorStart = -32099,
  158. serverErrorEnd = -32000,
  159. ServerNotInitialized = -32002,
  160. UnknownErrorCode = -32001,
  161. -- Defined by the protocol.
  162. RequestCancelled = -32800,
  163. ContentModified = -32801,
  164. ServerCancelled = -32802,
  165. },
  166. -- Describes the content type that a client supports in various
  167. -- result literals like `Hover`, `ParameterInfo` or `CompletionItem`.
  168. --
  169. -- Please note that `MarkupKinds` must not start with a `$`. This kinds
  170. -- are reserved for internal usage.
  171. MarkupKind = {
  172. -- Plain text is supported as a content format
  173. PlainText = 'plaintext',
  174. -- Markdown is supported as a content format
  175. Markdown = 'markdown',
  176. },
  177. ResourceOperationKind = {
  178. -- Supports creating new files and folders.
  179. Create = 'create',
  180. -- Supports renaming existing files and folders.
  181. Rename = 'rename',
  182. -- Supports deleting existing files and folders.
  183. Delete = 'delete',
  184. },
  185. FailureHandlingKind = {
  186. -- Applying the workspace change is simply aborted if one of the changes provided
  187. -- fails. All operations executed before the failing operation stay executed.
  188. Abort = 'abort',
  189. -- All operations are executed transactionally. That means they either all
  190. -- succeed or no changes at all are applied to the workspace.
  191. Transactional = 'transactional',
  192. -- If the workspace edit contains only textual file changes they are executed transactionally.
  193. -- If resource changes (create, rename or delete file) are part of the change the failure
  194. -- handling strategy is abort.
  195. TextOnlyTransactional = 'textOnlyTransactional',
  196. -- The client tries to undo the operations already executed. But there is no
  197. -- guarantee that this succeeds.
  198. Undo = 'undo',
  199. },
  200. -- Known error codes for an `InitializeError`;
  201. InitializeError = {
  202. -- If the protocol version provided by the client can't be handled by the server.
  203. -- @deprecated This initialize error got replaced by client capabilities. There is
  204. -- no version handshake in version 3.0x
  205. unknownProtocolVersion = 1,
  206. },
  207. -- Defines how the host (editor) should sync document changes to the language server.
  208. TextDocumentSyncKind = {
  209. -- Documents should not be synced at all.
  210. None = 0,
  211. -- Documents are synced by always sending the full content
  212. -- of the document.
  213. Full = 1,
  214. -- Documents are synced by sending the full content on open.
  215. -- After that only incremental updates to the document are
  216. -- send.
  217. Incremental = 2,
  218. },
  219. WatchKind = {
  220. -- Interested in create events.
  221. Create = 1,
  222. -- Interested in change events
  223. Change = 2,
  224. -- Interested in delete events
  225. Delete = 4,
  226. },
  227. -- Defines whether the insert text in a completion item should be interpreted as
  228. -- plain text or a snippet.
  229. --- @enum lsp.InsertTextFormat
  230. InsertTextFormat = {
  231. -- The primary text to be inserted is treated as a plain string.
  232. PlainText = 1,
  233. -- The primary text to be inserted is treated as a snippet.
  234. --
  235. -- A snippet can define tab stops and placeholders with `$1`, `$2`
  236. -- and `${3:foo};`. `$0` defines the final tab stop, it defaults to
  237. -- the end of the snippet. Placeholders with equal identifiers are linked,
  238. -- that is typing in one will update others too.
  239. Snippet = 2,
  240. },
  241. -- A set of predefined code action kinds
  242. CodeActionKind = {
  243. -- Empty kind.
  244. Empty = '',
  245. -- Base kind for quickfix actions
  246. QuickFix = 'quickfix',
  247. -- Base kind for refactoring actions
  248. Refactor = 'refactor',
  249. -- Base kind for refactoring extraction actions
  250. --
  251. -- Example extract actions:
  252. --
  253. -- - Extract method
  254. -- - Extract function
  255. -- - Extract variable
  256. -- - Extract interface from class
  257. -- - ...
  258. RefactorExtract = 'refactor.extract',
  259. -- Base kind for refactoring inline actions
  260. --
  261. -- Example inline actions:
  262. --
  263. -- - Inline function
  264. -- - Inline variable
  265. -- - Inline constant
  266. -- - ...
  267. RefactorInline = 'refactor.inline',
  268. -- Base kind for refactoring rewrite actions
  269. --
  270. -- Example rewrite actions:
  271. --
  272. -- - Convert JavaScript function to class
  273. -- - Add or remove parameter
  274. -- - Encapsulate field
  275. -- - Make method static
  276. -- - Move method to base class
  277. -- - ...
  278. RefactorRewrite = 'refactor.rewrite',
  279. -- Base kind for source actions
  280. --
  281. -- Source code actions apply to the entire file.
  282. Source = 'source',
  283. -- Base kind for an organize imports source action
  284. SourceOrganizeImports = 'source.organizeImports',
  285. },
  286. -- The reason why code actions were requested.
  287. ---@enum lsp.CodeActionTriggerKind
  288. CodeActionTriggerKind = {
  289. -- Code actions were explicitly requested by the user or by an extension.
  290. Invoked = 1,
  291. -- Code actions were requested automatically.
  292. --
  293. -- This typically happens when current selection in a file changes, but can
  294. -- also be triggered when file content changes.
  295. Automatic = 2,
  296. },
  297. }
  298. --- Protocol for the Microsoft Language Server Protocol (mslsp)
  299. --- @class vim.lsp.protocol : vim.lsp.protocol.constants
  300. --- @nodoc
  301. local protocol = {}
  302. --- @diagnostic disable:no-unknown
  303. for k1, v1 in pairs(vim.deepcopy(constants, true)) do
  304. for _, k2 in ipairs(vim.tbl_keys(v1)) do
  305. local v2 = v1[k2]
  306. v1[v2] = k2
  307. end
  308. protocol[k1] = v1
  309. end
  310. --- @diagnostic enable:no-unknown
  311. --- Gets a new ClientCapabilities object describing the LSP client
  312. --- capabilities.
  313. --- @return lsp.ClientCapabilities
  314. function protocol.make_client_capabilities()
  315. return {
  316. general = {
  317. positionEncodings = {
  318. 'utf-8',
  319. 'utf-16',
  320. 'utf-32',
  321. },
  322. },
  323. textDocument = {
  324. diagnostic = {
  325. dynamicRegistration = false,
  326. },
  327. inlayHint = {
  328. dynamicRegistration = true,
  329. resolveSupport = {
  330. properties = {
  331. 'textEdits',
  332. 'tooltip',
  333. 'location',
  334. 'command',
  335. },
  336. },
  337. },
  338. semanticTokens = {
  339. dynamicRegistration = false,
  340. tokenTypes = {
  341. 'namespace',
  342. 'type',
  343. 'class',
  344. 'enum',
  345. 'interface',
  346. 'struct',
  347. 'typeParameter',
  348. 'parameter',
  349. 'variable',
  350. 'property',
  351. 'enumMember',
  352. 'event',
  353. 'function',
  354. 'method',
  355. 'macro',
  356. 'keyword',
  357. 'modifier',
  358. 'comment',
  359. 'string',
  360. 'number',
  361. 'regexp',
  362. 'operator',
  363. 'decorator',
  364. },
  365. tokenModifiers = {
  366. 'declaration',
  367. 'definition',
  368. 'readonly',
  369. 'static',
  370. 'deprecated',
  371. 'abstract',
  372. 'async',
  373. 'modification',
  374. 'documentation',
  375. 'defaultLibrary',
  376. },
  377. formats = { 'relative' },
  378. requests = {
  379. -- TODO(jdrouhard): Add support for this
  380. range = false,
  381. full = { delta = true },
  382. },
  383. overlappingTokenSupport = true,
  384. -- TODO(jdrouhard): Add support for this
  385. multilineTokenSupport = false,
  386. serverCancelSupport = false,
  387. augmentsSyntaxTokens = true,
  388. },
  389. synchronization = {
  390. dynamicRegistration = false,
  391. willSave = true,
  392. willSaveWaitUntil = true,
  393. -- Send textDocument/didSave after saving (BufWritePost)
  394. didSave = true,
  395. },
  396. codeAction = {
  397. dynamicRegistration = true,
  398. codeActionLiteralSupport = {
  399. codeActionKind = {
  400. valueSet = get_value_set(constants.CodeActionKind),
  401. },
  402. },
  403. isPreferredSupport = true,
  404. dataSupport = true,
  405. resolveSupport = {
  406. properties = { 'edit' },
  407. },
  408. },
  409. codeLens = {
  410. dynamicRegistration = false,
  411. resolveSupport = {
  412. properties = { 'command' },
  413. },
  414. },
  415. foldingRange = {
  416. dynamicRegistration = false,
  417. lineFoldingOnly = true,
  418. foldingRange = {
  419. collapsedText = true,
  420. },
  421. },
  422. formatting = {
  423. dynamicRegistration = true,
  424. },
  425. rangeFormatting = {
  426. dynamicRegistration = true,
  427. rangesSupport = true,
  428. },
  429. completion = {
  430. dynamicRegistration = false,
  431. completionItem = {
  432. snippetSupport = true,
  433. commitCharactersSupport = false,
  434. preselectSupport = false,
  435. deprecatedSupport = true,
  436. documentationFormat = { constants.MarkupKind.Markdown, constants.MarkupKind.PlainText },
  437. resolveSupport = {
  438. properties = {
  439. 'additionalTextEdits',
  440. },
  441. },
  442. tagSupport = {
  443. valueSet = get_value_set(constants.CompletionTag),
  444. },
  445. },
  446. completionItemKind = {
  447. valueSet = get_value_set(constants.CompletionItemKind),
  448. },
  449. completionList = {
  450. itemDefaults = {
  451. 'editRange',
  452. 'insertTextFormat',
  453. 'insertTextMode',
  454. 'data',
  455. },
  456. },
  457. -- TODO(tjdevries): Implement this
  458. contextSupport = false,
  459. },
  460. declaration = {
  461. linkSupport = true,
  462. },
  463. definition = {
  464. linkSupport = true,
  465. dynamicRegistration = true,
  466. },
  467. implementation = {
  468. linkSupport = true,
  469. },
  470. typeDefinition = {
  471. linkSupport = true,
  472. },
  473. hover = {
  474. dynamicRegistration = true,
  475. contentFormat = { constants.MarkupKind.Markdown, constants.MarkupKind.PlainText },
  476. },
  477. signatureHelp = {
  478. dynamicRegistration = false,
  479. signatureInformation = {
  480. activeParameterSupport = true,
  481. documentationFormat = { constants.MarkupKind.Markdown, constants.MarkupKind.PlainText },
  482. parameterInformation = {
  483. labelOffsetSupport = true,
  484. },
  485. },
  486. },
  487. references = {
  488. dynamicRegistration = false,
  489. },
  490. documentHighlight = {
  491. dynamicRegistration = false,
  492. },
  493. documentSymbol = {
  494. dynamicRegistration = false,
  495. symbolKind = {
  496. valueSet = get_value_set(constants.SymbolKind),
  497. },
  498. hierarchicalDocumentSymbolSupport = true,
  499. },
  500. rename = {
  501. dynamicRegistration = true,
  502. prepareSupport = true,
  503. },
  504. publishDiagnostics = {
  505. relatedInformation = true,
  506. tagSupport = {
  507. valueSet = get_value_set(constants.DiagnosticTag),
  508. },
  509. dataSupport = true,
  510. },
  511. callHierarchy = {
  512. dynamicRegistration = false,
  513. },
  514. },
  515. workspace = {
  516. symbol = {
  517. dynamicRegistration = false,
  518. symbolKind = {
  519. valueSet = get_value_set(constants.SymbolKind),
  520. },
  521. },
  522. configuration = true,
  523. didChangeConfiguration = {
  524. dynamicRegistration = false,
  525. },
  526. workspaceFolders = true,
  527. applyEdit = true,
  528. workspaceEdit = {
  529. resourceOperations = { 'rename', 'create', 'delete' },
  530. },
  531. semanticTokens = {
  532. refreshSupport = true,
  533. },
  534. didChangeWatchedFiles = {
  535. -- TODO(lewis6991): do not advertise didChangeWatchedFiles on Linux
  536. -- or BSD since all the current backends are too limited.
  537. -- Ref: #27807, #28058, #23291, #26520
  538. dynamicRegistration = sysname == 'Darwin' or sysname == 'Windows_NT',
  539. relativePatternSupport = true,
  540. },
  541. inlayHint = {
  542. refreshSupport = true,
  543. },
  544. },
  545. experimental = nil,
  546. window = {
  547. workDoneProgress = true,
  548. showMessage = {
  549. messageActionItem = {
  550. additionalPropertiesSupport = true,
  551. },
  552. },
  553. showDocument = {
  554. support = true,
  555. },
  556. },
  557. }
  558. end
  559. --- Creates a normalized object describing LSP server capabilities.
  560. ---@param server_capabilities table Table of capabilities supported by the server
  561. ---@return lsp.ServerCapabilities|nil : Normalized table of capabilities
  562. function protocol.resolve_capabilities(server_capabilities)
  563. local TextDocumentSyncKind = protocol.TextDocumentSyncKind ---@type table<string|number, string|number>
  564. local textDocumentSync = server_capabilities.textDocumentSync
  565. if textDocumentSync == nil then
  566. -- Defaults if omitted.
  567. server_capabilities.textDocumentSync = {
  568. openClose = false,
  569. change = TextDocumentSyncKind.None,
  570. willSave = false,
  571. willSaveWaitUntil = false,
  572. save = {
  573. includeText = false,
  574. },
  575. }
  576. elseif type(textDocumentSync) == 'number' then
  577. -- Backwards compatibility
  578. if not TextDocumentSyncKind[textDocumentSync] then
  579. vim.notify('Invalid server TextDocumentSyncKind for textDocumentSync', vim.log.levels.ERROR)
  580. return nil
  581. end
  582. server_capabilities.textDocumentSync = {
  583. openClose = true,
  584. change = textDocumentSync,
  585. willSave = false,
  586. willSaveWaitUntil = false,
  587. save = {
  588. includeText = false,
  589. },
  590. }
  591. elseif type(textDocumentSync) ~= 'table' then
  592. vim.notify(
  593. string.format('Invalid type for textDocumentSync: %q', type(textDocumentSync)),
  594. vim.log.levels.ERROR
  595. )
  596. return nil
  597. end
  598. return server_capabilities
  599. end
  600. -- Generated by gen_lsp.lua, keep at end of file.
  601. --- @alias vim.lsp.protocol.Method.ClientToServer
  602. --- | 'callHierarchy/incomingCalls',
  603. --- | 'callHierarchy/outgoingCalls',
  604. --- | 'codeAction/resolve',
  605. --- | 'codeLens/resolve',
  606. --- | 'completionItem/resolve',
  607. --- | 'documentLink/resolve',
  608. --- | '$/setTrace',
  609. --- | 'exit',
  610. --- | 'initialize',
  611. --- | 'initialized',
  612. --- | 'inlayHint/resolve',
  613. --- | 'notebookDocument/didChange',
  614. --- | 'notebookDocument/didClose',
  615. --- | 'notebookDocument/didOpen',
  616. --- | 'notebookDocument/didSave',
  617. --- | 'shutdown',
  618. --- | 'textDocument/codeAction',
  619. --- | 'textDocument/codeLens',
  620. --- | 'textDocument/colorPresentation',
  621. --- | 'textDocument/completion',
  622. --- | 'textDocument/declaration',
  623. --- | 'textDocument/definition',
  624. --- | 'textDocument/diagnostic',
  625. --- | 'textDocument/didChange',
  626. --- | 'textDocument/didClose',
  627. --- | 'textDocument/didOpen',
  628. --- | 'textDocument/didSave',
  629. --- | 'textDocument/documentColor',
  630. --- | 'textDocument/documentHighlight',
  631. --- | 'textDocument/documentLink',
  632. --- | 'textDocument/documentSymbol',
  633. --- | 'textDocument/foldingRange',
  634. --- | 'textDocument/formatting',
  635. --- | 'textDocument/hover',
  636. --- | 'textDocument/implementation',
  637. --- | 'textDocument/inlayHint',
  638. --- | 'textDocument/inlineCompletion',
  639. --- | 'textDocument/inlineValue',
  640. --- | 'textDocument/linkedEditingRange',
  641. --- | 'textDocument/moniker',
  642. --- | 'textDocument/onTypeFormatting',
  643. --- | 'textDocument/prepareCallHierarchy',
  644. --- | 'textDocument/prepareRename',
  645. --- | 'textDocument/prepareTypeHierarchy',
  646. --- | 'textDocument/rangeFormatting',
  647. --- | 'textDocument/rangesFormatting',
  648. --- | 'textDocument/references',
  649. --- | 'textDocument/rename',
  650. --- | 'textDocument/selectionRange',
  651. --- | 'textDocument/semanticTokens/full',
  652. --- | 'textDocument/semanticTokens/full/delta',
  653. --- | 'textDocument/semanticTokens/range',
  654. --- | 'textDocument/signatureHelp',
  655. --- | 'textDocument/typeDefinition',
  656. --- | 'textDocument/willSave',
  657. --- | 'textDocument/willSaveWaitUntil',
  658. --- | 'typeHierarchy/subtypes',
  659. --- | 'typeHierarchy/supertypes',
  660. --- | 'window/workDoneProgress/cancel',
  661. --- | 'workspaceSymbol/resolve',
  662. --- | 'workspace/diagnostic',
  663. --- | 'workspace/didChangeConfiguration',
  664. --- | 'workspace/didChangeWatchedFiles',
  665. --- | 'workspace/didChangeWorkspaceFolders',
  666. --- | 'workspace/didCreateFiles',
  667. --- | 'workspace/didDeleteFiles',
  668. --- | 'workspace/didRenameFiles',
  669. --- | 'workspace/executeCommand',
  670. --- | 'workspace/symbol',
  671. --- | 'workspace/willCreateFiles',
  672. --- | 'workspace/willDeleteFiles',
  673. --- | 'workspace/willRenameFiles',
  674. --- @alias vim.lsp.protocol.Method.ServerToClient
  675. --- | 'client/registerCapability',
  676. --- | 'client/unregisterCapability',
  677. --- | '$/logTrace',
  678. --- | 'telemetry/event',
  679. --- | 'textDocument/publishDiagnostics',
  680. --- | 'window/logMessage',
  681. --- | 'window/showDocument',
  682. --- | 'window/showMessage',
  683. --- | 'window/showMessageRequest',
  684. --- | 'window/workDoneProgress/create',
  685. --- | 'workspace/applyEdit',
  686. --- | 'workspace/codeLens/refresh',
  687. --- | 'workspace/configuration',
  688. --- | 'workspace/diagnostic/refresh',
  689. --- | 'workspace/foldingRange/refresh',
  690. --- | 'workspace/inlayHint/refresh',
  691. --- | 'workspace/inlineValue/refresh',
  692. --- | 'workspace/semanticTokens/refresh',
  693. --- | 'workspace/workspaceFolders',
  694. --- @alias vim.lsp.protocol.Method
  695. --- | vim.lsp.protocol.Method.ClientToServer
  696. --- | vim.lsp.protocol.Method.ServerToClient
  697. -- Generated by gen_lsp.lua, keep at end of file.
  698. ---
  699. --- @enum vim.lsp.protocol.Methods
  700. --- @see https://microsoft.github.io/language-server-protocol/specification/#metaModel
  701. --- LSP method names.
  702. protocol.Methods = {
  703. --- A request to resolve the incoming calls for a given `CallHierarchyItem`.
  704. --- @since 3.16.0
  705. callHierarchy_incomingCalls = 'callHierarchy/incomingCalls',
  706. --- A request to resolve the outgoing calls for a given `CallHierarchyItem`.
  707. --- @since 3.16.0
  708. callHierarchy_outgoingCalls = 'callHierarchy/outgoingCalls',
  709. --- The `client/registerCapability` request is sent from the server to the client to register a new capability
  710. --- handler on the client side.
  711. client_registerCapability = 'client/registerCapability',
  712. --- The `client/unregisterCapability` request is sent from the server to the client to unregister a previously registered capability
  713. --- handler on the client side.
  714. client_unregisterCapability = 'client/unregisterCapability',
  715. --- Request to resolve additional information for a given code action.The request's
  716. --- parameter is of type {@link CodeAction} the response
  717. --- is of type {@link CodeAction} or a Thenable that resolves to such.
  718. codeAction_resolve = 'codeAction/resolve',
  719. --- A request to resolve a command for a given code lens.
  720. codeLens_resolve = 'codeLens/resolve',
  721. --- Request to resolve additional information for a given completion item.The request's
  722. --- parameter is of type {@link CompletionItem} the response
  723. --- is of type {@link CompletionItem} or a Thenable that resolves to such.
  724. completionItem_resolve = 'completionItem/resolve',
  725. --- Request to resolve additional information for a given document link. The request's
  726. --- parameter is of type {@link DocumentLink} the response
  727. --- is of type {@link DocumentLink} or a Thenable that resolves to such.
  728. documentLink_resolve = 'documentLink/resolve',
  729. dollar_cancelRequest = '$/cancelRequest',
  730. dollar_logTrace = '$/logTrace',
  731. dollar_progress = '$/progress',
  732. dollar_setTrace = '$/setTrace',
  733. --- The exit event is sent from the client to the server to
  734. --- ask the server to exit its process.
  735. exit = 'exit',
  736. --- The initialize request is sent from the client to the server.
  737. --- It is sent once as the request after starting up the server.
  738. --- The requests parameter is of type {@link InitializeParams}
  739. --- the response if of type {@link InitializeResult} of a Thenable that
  740. --- resolves to such.
  741. initialize = 'initialize',
  742. --- The initialized notification is sent from the client to the
  743. --- server after the client is fully initialized and the server
  744. --- is allowed to send requests from the server to the client.
  745. initialized = 'initialized',
  746. --- A request to resolve additional properties for an inlay hint.
  747. --- The request's parameter is of type {@link InlayHint}, the response is
  748. --- of type {@link InlayHint} or a Thenable that resolves to such.
  749. --- @since 3.17.0
  750. inlayHint_resolve = 'inlayHint/resolve',
  751. notebookDocument_didChange = 'notebookDocument/didChange',
  752. --- A notification sent when a notebook closes.
  753. --- @since 3.17.0
  754. notebookDocument_didClose = 'notebookDocument/didClose',
  755. --- A notification sent when a notebook opens.
  756. --- @since 3.17.0
  757. notebookDocument_didOpen = 'notebookDocument/didOpen',
  758. --- A notification sent when a notebook document is saved.
  759. --- @since 3.17.0
  760. notebookDocument_didSave = 'notebookDocument/didSave',
  761. --- A shutdown request is sent from the client to the server.
  762. --- It is sent once when the client decides to shutdown the
  763. --- server. The only notification that is sent after a shutdown request
  764. --- is the exit event.
  765. shutdown = 'shutdown',
  766. --- The telemetry event notification is sent from the server to the client to ask
  767. --- the client to log telemetry data.
  768. telemetry_event = 'telemetry/event',
  769. --- A request to provide commands for the given text document and range.
  770. textDocument_codeAction = 'textDocument/codeAction',
  771. --- A request to provide code lens for the given text document.
  772. textDocument_codeLens = 'textDocument/codeLens',
  773. --- A request to list all presentation for a color. The request's
  774. --- parameter is of type {@link ColorPresentationParams} the
  775. --- response is of type {@link ColorInformation ColorInformation[]} or a Thenable
  776. --- that resolves to such.
  777. textDocument_colorPresentation = 'textDocument/colorPresentation',
  778. --- Request to request completion at a given text document position. The request's
  779. --- parameter is of type {@link TextDocumentPosition} the response
  780. --- is of type {@link CompletionItem CompletionItem[]} or {@link CompletionList}
  781. --- or a Thenable that resolves to such.
  782. --- The request can delay the computation of the {@link CompletionItem.detail `detail`}
  783. --- and {@link CompletionItem.documentation `documentation`} properties to the `completionItem/resolve`
  784. --- request. However, properties that are needed for the initial sorting and filtering, like `sortText`,
  785. --- `filterText`, `insertText`, and `textEdit`, must not be changed during resolve.
  786. textDocument_completion = 'textDocument/completion',
  787. --- A request to resolve the type definition locations of a symbol at a given text
  788. --- document position. The request's parameter is of type {@link TextDocumentPositionParams}
  789. --- the response is of type {@link Declaration} or a typed array of {@link DeclarationLink}
  790. --- or a Thenable that resolves to such.
  791. textDocument_declaration = 'textDocument/declaration',
  792. --- A request to resolve the definition location of a symbol at a given text
  793. --- document position. The request's parameter is of type {@link TextDocumentPosition}
  794. --- the response is of either type {@link Definition} or a typed array of
  795. --- {@link DefinitionLink} or a Thenable that resolves to such.
  796. textDocument_definition = 'textDocument/definition',
  797. --- The document diagnostic request definition.
  798. --- @since 3.17.0
  799. textDocument_diagnostic = 'textDocument/diagnostic',
  800. --- The document change notification is sent from the client to the server to signal
  801. --- changes to a text document.
  802. textDocument_didChange = 'textDocument/didChange',
  803. --- The document close notification is sent from the client to the server when
  804. --- the document got closed in the client. The document's truth now exists where
  805. --- the document's uri points to (e.g. if the document's uri is a file uri the
  806. --- truth now exists on disk). As with the open notification the close notification
  807. --- is about managing the document's content. Receiving a close notification
  808. --- doesn't mean that the document was open in an editor before. A close
  809. --- notification requires a previous open notification to be sent.
  810. textDocument_didClose = 'textDocument/didClose',
  811. --- The document open notification is sent from the client to the server to signal
  812. --- newly opened text documents. The document's truth is now managed by the client
  813. --- and the server must not try to read the document's truth using the document's
  814. --- uri. Open in this sense means it is managed by the client. It doesn't necessarily
  815. --- mean that its content is presented in an editor. An open notification must not
  816. --- be sent more than once without a corresponding close notification send before.
  817. --- This means open and close notification must be balanced and the max open count
  818. --- is one.
  819. textDocument_didOpen = 'textDocument/didOpen',
  820. --- The document save notification is sent from the client to the server when
  821. --- the document got saved in the client.
  822. textDocument_didSave = 'textDocument/didSave',
  823. --- A request to list all color symbols found in a given text document. The request's
  824. --- parameter is of type {@link DocumentColorParams} the
  825. --- response is of type {@link ColorInformation ColorInformation[]} or a Thenable
  826. --- that resolves to such.
  827. textDocument_documentColor = 'textDocument/documentColor',
  828. --- Request to resolve a {@link DocumentHighlight} for a given
  829. --- text document position. The request's parameter is of type {@link TextDocumentPosition}
  830. --- the request response is an array of type {@link DocumentHighlight}
  831. --- or a Thenable that resolves to such.
  832. textDocument_documentHighlight = 'textDocument/documentHighlight',
  833. --- A request to provide document links
  834. textDocument_documentLink = 'textDocument/documentLink',
  835. --- A request to list all symbols found in a given text document. The request's
  836. --- parameter is of type {@link TextDocumentIdentifier} the
  837. --- response is of type {@link SymbolInformation SymbolInformation[]} or a Thenable
  838. --- that resolves to such.
  839. textDocument_documentSymbol = 'textDocument/documentSymbol',
  840. --- A request to provide folding ranges in a document. The request's
  841. --- parameter is of type {@link FoldingRangeParams}, the
  842. --- response is of type {@link FoldingRangeList} or a Thenable
  843. --- that resolves to such.
  844. textDocument_foldingRange = 'textDocument/foldingRange',
  845. --- A request to format a whole document.
  846. textDocument_formatting = 'textDocument/formatting',
  847. --- Request to request hover information at a given text document position. The request's
  848. --- parameter is of type {@link TextDocumentPosition} the response is of
  849. --- type {@link Hover} or a Thenable that resolves to such.
  850. textDocument_hover = 'textDocument/hover',
  851. --- A request to resolve the implementation locations of a symbol at a given text
  852. --- document position. The request's parameter is of type {@link TextDocumentPositionParams}
  853. --- the response is of type {@link Definition} or a Thenable that resolves to such.
  854. textDocument_implementation = 'textDocument/implementation',
  855. --- A request to provide inlay hints in a document. The request's parameter is of
  856. --- type {@link InlayHintsParams}, the response is of type
  857. --- {@link InlayHint InlayHint[]} or a Thenable that resolves to such.
  858. --- @since 3.17.0
  859. textDocument_inlayHint = 'textDocument/inlayHint',
  860. --- A request to provide inline completions in a document. The request's parameter is of
  861. --- type {@link InlineCompletionParams}, the response is of type
  862. --- {@link InlineCompletion InlineCompletion[]} or a Thenable that resolves to such.
  863. --- @since 3.18.0
  864. --- @proposed
  865. textDocument_inlineCompletion = 'textDocument/inlineCompletion',
  866. --- A request to provide inline values in a document. The request's parameter is of
  867. --- type {@link InlineValueParams}, the response is of type
  868. --- {@link InlineValue InlineValue[]} or a Thenable that resolves to such.
  869. --- @since 3.17.0
  870. textDocument_inlineValue = 'textDocument/inlineValue',
  871. --- A request to provide ranges that can be edited together.
  872. --- @since 3.16.0
  873. textDocument_linkedEditingRange = 'textDocument/linkedEditingRange',
  874. --- A request to get the moniker of a symbol at a given text document position.
  875. --- The request parameter is of type {@link TextDocumentPositionParams}.
  876. --- The response is of type {@link Moniker Moniker[]} or `null`.
  877. textDocument_moniker = 'textDocument/moniker',
  878. --- A request to format a document on type.
  879. textDocument_onTypeFormatting = 'textDocument/onTypeFormatting',
  880. --- A request to result a `CallHierarchyItem` in a document at a given position.
  881. --- Can be used as an input to an incoming or outgoing call hierarchy.
  882. --- @since 3.16.0
  883. textDocument_prepareCallHierarchy = 'textDocument/prepareCallHierarchy',
  884. --- A request to test and perform the setup necessary for a rename.
  885. --- @since 3.16 - support for default behavior
  886. textDocument_prepareRename = 'textDocument/prepareRename',
  887. --- A request to result a `TypeHierarchyItem` in a document at a given position.
  888. --- Can be used as an input to a subtypes or supertypes type hierarchy.
  889. --- @since 3.17.0
  890. textDocument_prepareTypeHierarchy = 'textDocument/prepareTypeHierarchy',
  891. --- Diagnostics notification are sent from the server to the client to signal
  892. --- results of validation runs.
  893. textDocument_publishDiagnostics = 'textDocument/publishDiagnostics',
  894. --- A request to format a range in a document.
  895. textDocument_rangeFormatting = 'textDocument/rangeFormatting',
  896. --- A request to format ranges in a document.
  897. --- @since 3.18.0
  898. --- @proposed
  899. textDocument_rangesFormatting = 'textDocument/rangesFormatting',
  900. --- A request to resolve project-wide references for the symbol denoted
  901. --- by the given text document position. The request's parameter is of
  902. --- type {@link ReferenceParams} the response is of type
  903. --- {@link Location Location[]} or a Thenable that resolves to such.
  904. textDocument_references = 'textDocument/references',
  905. --- A request to rename a symbol.
  906. textDocument_rename = 'textDocument/rename',
  907. --- A request to provide selection ranges in a document. The request's
  908. --- parameter is of type {@link SelectionRangeParams}, the
  909. --- response is of type {@link SelectionRange SelectionRange[]} or a Thenable
  910. --- that resolves to such.
  911. textDocument_selectionRange = 'textDocument/selectionRange',
  912. --- @since 3.16.0
  913. textDocument_semanticTokens_full = 'textDocument/semanticTokens/full',
  914. --- @since 3.16.0
  915. textDocument_semanticTokens_full_delta = 'textDocument/semanticTokens/full/delta',
  916. --- @since 3.16.0
  917. textDocument_semanticTokens_range = 'textDocument/semanticTokens/range',
  918. textDocument_signatureHelp = 'textDocument/signatureHelp',
  919. --- A request to resolve the type definition locations of a symbol at a given text
  920. --- document position. The request's parameter is of type {@link TextDocumentPositionParams}
  921. --- the response is of type {@link Definition} or a Thenable that resolves to such.
  922. textDocument_typeDefinition = 'textDocument/typeDefinition',
  923. --- A document will save notification is sent from the client to the server before
  924. --- the document is actually saved.
  925. textDocument_willSave = 'textDocument/willSave',
  926. --- A document will save request is sent from the client to the server before
  927. --- the document is actually saved. The request can return an array of TextEdits
  928. --- which will be applied to the text document before it is saved. Please note that
  929. --- clients might drop results if computing the text edits took too long or if a
  930. --- server constantly fails on this request. This is done to keep the save fast and
  931. --- reliable.
  932. textDocument_willSaveWaitUntil = 'textDocument/willSaveWaitUntil',
  933. --- A request to resolve the subtypes for a given `TypeHierarchyItem`.
  934. --- @since 3.17.0
  935. typeHierarchy_subtypes = 'typeHierarchy/subtypes',
  936. --- A request to resolve the supertypes for a given `TypeHierarchyItem`.
  937. --- @since 3.17.0
  938. typeHierarchy_supertypes = 'typeHierarchy/supertypes',
  939. --- The log message notification is sent from the server to the client to ask
  940. --- the client to log a particular message.
  941. window_logMessage = 'window/logMessage',
  942. --- A request to show a document. This request might open an
  943. --- external program depending on the value of the URI to open.
  944. --- For example a request to open `https://code.visualstudio.com/`
  945. --- will very likely open the URI in a WEB browser.
  946. --- @since 3.16.0
  947. window_showDocument = 'window/showDocument',
  948. --- The show message notification is sent from a server to a client to ask
  949. --- the client to display a particular message in the user interface.
  950. window_showMessage = 'window/showMessage',
  951. --- The show message request is sent from the server to the client to show a message
  952. --- and a set of options actions to the user.
  953. window_showMessageRequest = 'window/showMessageRequest',
  954. --- The `window/workDoneProgress/cancel` notification is sent from the client to the server to cancel a progress
  955. --- initiated on the server side.
  956. window_workDoneProgress_cancel = 'window/workDoneProgress/cancel',
  957. --- The `window/workDoneProgress/create` request is sent from the server to the client to initiate progress
  958. --- reporting from the server.
  959. window_workDoneProgress_create = 'window/workDoneProgress/create',
  960. --- A request to resolve the range inside the workspace
  961. --- symbol's location.
  962. --- @since 3.17.0
  963. workspaceSymbol_resolve = 'workspaceSymbol/resolve',
  964. --- A request sent from the server to the client to modified certain resources.
  965. workspace_applyEdit = 'workspace/applyEdit',
  966. --- A request to refresh all code actions
  967. --- @since 3.16.0
  968. workspace_codeLens_refresh = 'workspace/codeLens/refresh',
  969. --- The 'workspace/configuration' request is sent from the server to the client to fetch a certain
  970. --- configuration setting.
  971. --- This pull model replaces the old push model were the client signaled configuration change via an
  972. --- event. If the server still needs to react to configuration changes (since the server caches the
  973. --- result of `workspace/configuration` requests) the server should register for an empty configuration
  974. --- change event and empty the cache if such an event is received.
  975. workspace_configuration = 'workspace/configuration',
  976. --- The workspace diagnostic request definition.
  977. --- @since 3.17.0
  978. workspace_diagnostic = 'workspace/diagnostic',
  979. --- The diagnostic refresh request definition.
  980. --- @since 3.17.0
  981. workspace_diagnostic_refresh = 'workspace/diagnostic/refresh',
  982. --- The configuration change notification is sent from the client to the server
  983. --- when the client's configuration has changed. The notification contains
  984. --- the changed configuration as defined by the language client.
  985. workspace_didChangeConfiguration = 'workspace/didChangeConfiguration',
  986. --- The watched files notification is sent from the client to the server when
  987. --- the client detects changes to file watched by the language client.
  988. workspace_didChangeWatchedFiles = 'workspace/didChangeWatchedFiles',
  989. --- The `workspace/didChangeWorkspaceFolders` notification is sent from the client to the server when the workspace
  990. --- folder configuration changes.
  991. workspace_didChangeWorkspaceFolders = 'workspace/didChangeWorkspaceFolders',
  992. --- The did create files notification is sent from the client to the server when
  993. --- files were created from within the client.
  994. --- @since 3.16.0
  995. workspace_didCreateFiles = 'workspace/didCreateFiles',
  996. --- The will delete files request is sent from the client to the server before files are actually
  997. --- deleted as long as the deletion is triggered from within the client.
  998. --- @since 3.16.0
  999. workspace_didDeleteFiles = 'workspace/didDeleteFiles',
  1000. --- The did rename files notification is sent from the client to the server when
  1001. --- files were renamed from within the client.
  1002. --- @since 3.16.0
  1003. workspace_didRenameFiles = 'workspace/didRenameFiles',
  1004. --- A request send from the client to the server to execute a command. The request might return
  1005. --- a workspace edit which the client will apply to the workspace.
  1006. workspace_executeCommand = 'workspace/executeCommand',
  1007. --- @since 3.18.0
  1008. --- @proposed
  1009. workspace_foldingRange_refresh = 'workspace/foldingRange/refresh',
  1010. --- @since 3.17.0
  1011. workspace_inlayHint_refresh = 'workspace/inlayHint/refresh',
  1012. --- @since 3.17.0
  1013. workspace_inlineValue_refresh = 'workspace/inlineValue/refresh',
  1014. --- @since 3.16.0
  1015. workspace_semanticTokens_refresh = 'workspace/semanticTokens/refresh',
  1016. --- A request to list project-wide symbols matching the query string given
  1017. --- by the {@link WorkspaceSymbolParams}. The response is
  1018. --- of type {@link SymbolInformation SymbolInformation[]} or a Thenable that
  1019. --- resolves to such.
  1020. --- @since 3.17.0 - support for WorkspaceSymbol in the returned data. Clients
  1021. --- need to advertise support for WorkspaceSymbols via the client capability
  1022. --- `workspace.symbol.resolveSupport`.
  1023. workspace_symbol = 'workspace/symbol',
  1024. --- The will create files request is sent from the client to the server before files are actually
  1025. --- created as long as the creation is triggered from within the client.
  1026. --- The request can return a `WorkspaceEdit` which will be applied to workspace before the
  1027. --- files are created. Hence the `WorkspaceEdit` can not manipulate the content of the file
  1028. --- to be created.
  1029. --- @since 3.16.0
  1030. workspace_willCreateFiles = 'workspace/willCreateFiles',
  1031. --- The did delete files notification is sent from the client to the server when
  1032. --- files were deleted from within the client.
  1033. --- @since 3.16.0
  1034. workspace_willDeleteFiles = 'workspace/willDeleteFiles',
  1035. --- The will rename files request is sent from the client to the server before files are actually
  1036. --- renamed as long as the rename is triggered from within the client.
  1037. --- @since 3.16.0
  1038. workspace_willRenameFiles = 'workspace/willRenameFiles',
  1039. --- The `workspace/workspaceFolders` is sent from the server to the client to fetch the open workspace folders.
  1040. workspace_workspaceFolders = 'workspace/workspaceFolders',
  1041. }
  1042. return protocol