Diff to HTML by rtfpessoa

Files changed (2) hide show
  1. runtime/doc/channel.txt +49 -15
  2. runtime/doc/version9.txt +2 -1
runtime/doc/channel.txt CHANGED
@@ -1,4 +1,4 @@
1
- *channel.txt* For Vim version 9.2. Last change: 2026 Feb 18
2
 
3
 
4
  VIM REFERENCE MANUAL by Bram Moolenaar
@@ -26,6 +26,7 @@ The Netbeans interface also uses a channel. |netbeans|
26
  13. Controlling a job |job-control|
27
  14. Using a prompt buffer |prompt-buffer|
28
  15. Language Server Protocol |language-server-protocol|
 
29
 
30
  *E1277*
31
  {only when compiled with the |+channel| feature for channel stuff}
@@ -56,6 +57,7 @@ NL every message ends in a NL (newline) character
56
  JSON JSON encoding |json_encode()|
57
  JS JavaScript style JSON-like encoding |js_encode()|
58
  LSP Language Server Protocol encoding |language-server-protocol|
 
59
 
60
  Common combination are:
61
  - Using a job connected through pipes in NL mode. E.g., to run a style
@@ -143,6 +145,7 @@ unreachable on the network.
143
  "nl" - Use messages that end in a NL character
144
  "raw" - Use raw messages
145
  "lsp" - Use language server protocol encoding
 
146
  *channel-callback* *E921*
147
  "callback" A function that is called when a message is received that is
148
  not handled otherwise (e.g. a JSON message with ID zero). It
@@ -153,8 +156,9 @@ unreachable on the network.
153
  endfunc
154
  let channel = ch_open("localhost:8765", {"callback": "Handle"})
155
  <
156
- When "mode" is "json" or "js" or "lsp" the "msg" argument is
157
- the body of the received message, converted to Vim types.
 
158
  When "mode" is "nl" the "msg" argument is one message,
159
  excluding the NL.
160
  When "mode" is "raw" the "msg" argument is the whole message
@@ -537,7 +541,8 @@ ch_evalexpr({handle}, {expr} [, {options}]) *ch_evalexpr()*
537
  according to the type of channel. The function cannot be used
538
  with a raw channel. See |channel-use|.
539
  {handle} can be a Channel or a Job that has a Channel.
540
- When using the "lsp" channel mode, {expr} must be a |Dict|.
 
541
  *E917*
542
  {options} must be a Dictionary. It must not have a "callback"
543
  entry. It can have a "timeout" entry to specify the timeout
@@ -545,8 +550,8 @@ ch_evalexpr({handle}, {expr} [, {options}]) *ch_evalexpr()*
545
 
546
  ch_evalexpr() waits for a response and returns the decoded
547
  expression. When there is an error or timeout it returns an
548
- empty |String| or, when using the "lsp" channel mode, returns an
549
- empty |Dict|.
550
 
551
  Note that while waiting for the response, Vim handles other
552
  messages. You need to make sure this doesn't cause trouble.
@@ -627,7 +632,7 @@ ch_info({handle}) *ch_info()*
627
  "err_io" "out", "null", "pipe", "file" or "buffer"
628
  "err_timeout" timeout in msec
629
  "in_status" "open" or "closed"
630
- "in_mode" "NL", "RAW", "JSON", "JS" or "LSP"
631
  "in_io" "null", "pipe", "file" or "buffer"
632
  "in_timeout" timeout in msec
633
 
@@ -733,14 +738,15 @@ ch_sendexpr({handle}, {expr} [, {options}]) *ch_sendexpr()*
733
  with a raw channel.
734
  See |channel-use|. *E912*
735
  {handle} can be a Channel or a Job that has a Channel.
736
- When using the "lsp" channel mode, {expr} must be a |Dict|.
 
737
 
738
- If the channel mode is "lsp", then returns a Dict. Otherwise
739
- returns an empty String. If the "callback" item is present in
740
- {options}, then the returned Dict contains the ID of the
741
- request message. The ID can be used to send a cancellation
742
- request to the LSP server (if needed). Returns an empty Dict
743
- on error.
744
 
745
  If a response message is not expected for {expr}, then don't
746
  specify the "callback" item in {options}.
@@ -1607,5 +1613,33 @@ The "params" field is optional: >
1607
  "params": <list|dict>
1608
  }
1609
 
1610
- <
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1611
  vim:tw=78:ts=8:noet:ft=help:norl:
 
1
+ *channel.txt* For Vim version 9.2. Last change: 2026 Feb 25
2
 
3
 
4
  VIM REFERENCE MANUAL by Bram Moolenaar
 
26
  13. Controlling a job |job-control|
27
  14. Using a prompt buffer |prompt-buffer|
28
  15. Language Server Protocol |language-server-protocol|
29
+ 16. Debug Adapter Protocol |debug-adapter-protocol|
30
 
31
  *E1277*
32
  {only when compiled with the |+channel| feature for channel stuff}
 
57
  JSON JSON encoding |json_encode()|
58
  JS JavaScript style JSON-like encoding |js_encode()|
59
  LSP Language Server Protocol encoding |language-server-protocol|
60
+ DAP Debug Adapter Protocol encoding |debug-adapter-protocol|
61
 
62
  Common combination are:
63
  - Using a job connected through pipes in NL mode. E.g., to run a style
 
145
  "nl" - Use messages that end in a NL character
146
  "raw" - Use raw messages
147
  "lsp" - Use language server protocol encoding
148
+ "dap" - Use debug adapter protocol encoding
149
  *channel-callback* *E921*
150
  "callback" A function that is called when a message is received that is
151
  not handled otherwise (e.g. a JSON message with ID zero). It
 
156
  endfunc
157
  let channel = ch_open("localhost:8765", {"callback": "Handle"})
158
  <
159
+ When "mode" is any of "json", "js", "lsp" or "dap" the "msg"
160
+ argument is the body of the received message, converted to Vim
161
+ types.
162
  When "mode" is "nl" the "msg" argument is one message,
163
  excluding the NL.
164
  When "mode" is "raw" the "msg" argument is the whole message
 
541
  according to the type of channel. The function cannot be used
542
  with a raw channel. See |channel-use|.
543
  {handle} can be a Channel or a Job that has a Channel.
544
+ When using the "lsp" or "dap" channel mode, {expr} must be a
545
+ |Dict|.
546
  *E917*
547
  {options} must be a Dictionary. It must not have a "callback"
548
  entry. It can have a "timeout" entry to specify the timeout
 
550
 
551
  ch_evalexpr() waits for a response and returns the decoded
552
  expression. When there is an error or timeout it returns an
553
+ empty |String| or, when using the "lsp" or "dap" channel mode,
554
+ returns an empty |Dict|.
555
 
556
  Note that while waiting for the response, Vim handles other
557
  messages. You need to make sure this doesn't cause trouble.
 
632
  "err_io" "out", "null", "pipe", "file" or "buffer"
633
  "err_timeout" timeout in msec
634
  "in_status" "open" or "closed"
635
+ "in_mode" "NL", "RAW", "JSON", "JS" or "LSP" or "DAP"
636
  "in_io" "null", "pipe", "file" or "buffer"
637
  "in_timeout" timeout in msec
638
 
 
738
  with a raw channel.
739
  See |channel-use|. *E912*
740
  {handle} can be a Channel or a Job that has a Channel.
741
+ When using the "lsp" or "dap" channel mode, {expr} must be a
742
+ |Dict|.
743
 
744
+ If the channel mode is "lsp" or "dap", then returns a Dict.
745
+ Otherwise returns an empty String. If the "callback" item is
746
+ present in {options}, then the returned Dict contains the ID
747
+ of the request message. The ID can be used to send a
748
+ cancellation request to the LSP server or debug adapter (if
749
+ needed). Returns an empty Dict on error.
750
 
751
  If a response message is not expected for {expr}, then don't
752
  specify the "callback" item in {options}.
 
1613
  "params": <list|dict>
1614
  }
1615
 
1616
+ ==============================================================================
1617
+ 16. Debug Adapter Protocol *debug-adapter-protocol*
1618
+
1619
+ The debug adapter protocol is very similar to the language server protocol,
1620
+ with the main difference being that it does not use the JSON-RPC format. The
1621
+ specification can be found here:
1622
+
1623
+ https://microsoft.github.io/debug-adapter-protocol/specification
1624
+
1625
+ The protocol uses the same header format as the LSP protocol.
1626
+
1627
+ To encode and send a DAP request/notification message in a Vim |Dict| into a
1628
+ JSON message and to receive and decode a DAP JSON response/notification
1629
+ message into a Vim |Dict|, connect to the debug adapter with the
1630
+ |channel-mode| set to "dap".
1631
+
1632
+ For messages received on a channel with |channel-mode| set to "dap", Vim will
1633
+ process the HTTP header and decode the JSON payload into a Vim |Dict| type.
1634
+ When sending messages on a channel using the |ch_evalexpr()| or
1635
+ |ch_sendexpr()| functions, Vim will add the HTTP header and encode the Vim
1636
+ expression into JSON.
1637
+
1638
+ Vim will automatically add the "seq" field to the JSON DAP message, and manage
1639
+ the "request_seq" field as well for responses. However it will not add the
1640
+ "type" field, it should be manually specified in the |Dict|.
1641
+
1642
+ Otherwise the behaviour is the same as how Vim handles the "lsp" channel mode
1643
+ |language-server-protocol|.
1644
+
1645
  vim:tw=78:ts=8:noet:ft=help:norl:
runtime/doc/version9.txt CHANGED
@@ -1,4 +1,4 @@
1
- *version9.txt* For Vim version 9.2. Last change: 2026 Feb 24
2
 
3
 
4
  VIM REFERENCE MANUAL by Bram Moolenaar
@@ -52592,6 +52592,7 @@ Other ~
52592
  -----
52593
  - The new |xdg.vim| script for full XDG compatibility is included.
52594
  - |ConPTY| support is considered stable as of Windows 11.
 
52595
 
52596
  *changed-9.3*
52597
  Changed~
 
1
+ *version9.txt* For Vim version 9.2. Last change: 2026 Feb 25
2
 
3
 
4
  VIM REFERENCE MANUAL by Bram Moolenaar
 
52592
  -----
52593
  - The new |xdg.vim| script for full XDG compatibility is included.
52594
  - |ConPTY| support is considered stable as of Windows 11.
52595
+ - Support for "dap" channel mode for the |debug-adapter-protocol|.
52596
 
52597
  *changed-9.3*
52598
  Changed~