Skip to content

Commit 8118d0f

Browse files
authored
Merge pull request #2364 from h-east/update-channel
Update channel.{txt,jax}
2 parents 516a0d1 + afac666 commit 8118d0f

File tree

2 files changed

+48
-44
lines changed

2 files changed

+48
-44
lines changed

doc/channel.jax

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*channel.txt* For Vim バージョン 9.1. Last change: 2024 Jul 17
1+
*channel.txt* For Vim バージョン 9.1. Last change: 2025 Oct 13
22

33

44
VIMリファレンスマニュアル by Bram Moolenaar
@@ -1473,13 +1473,13 @@ HTTP ヘッダを処理し、JSON-RPC ペイロードをデコードして Vim |
14731473
す。Vim が組み込み型を JSON へエンコードあるいはデコードする方法の詳細について
14741474
は、|json_encode()||json_decode()| を参照してください。
14751475

1476-
'lsp' モードを使用してチャネルを開くには、|ch_open()| の引数 {options}
1477-
'mode' 項目を 'lsp' にします。例: >
1476+
"lsp" モードを使用してチャネルを開くには、|ch_open()| の引数 {options}
1477+
"mode" 項目を "lsp" にします。例: >
14781478
14791479
let ch = ch_open(..., #{mode: 'lsp'})
14801480
1481-
'lsp' モードを使用したチャネルをジョブで開くには、|job_start()| の引数
1482-
{options}'in_mode''out_mode' 項目を 'lsp' にします。例: >
1481+
"lsp" モードを使用したチャネルをジョブで開くには、|job_start()| の引数
1482+
{options}"in_mode""out_mode" 項目を "lsp" にします。例: >
14831483
14841484
let cmd = ['clangd', '--background-index', '--clang-tidy']
14851485
let opts = {}
@@ -1498,7 +1498,7 @@ Note ジョブが LSP メッセージを標準出力に、非LSPメッセージ
14981498

14991499
サーバーにむけて JSON-RPC リクエストの同期送信をするには、|ch_evalexpr()| 関数
15001500
を使います。この関数は応答を待ちサーバーからのレスポンスメッセージをデコードし
1501-
て返します。|channel-timeout| を使うかあるいは引数 {options}'timeout'
1501+
て返します。|channel-timeout| を使うかあるいは引数 {options}"timeout"
15021502
フィールドに値を設定することで応答の待ち時間の制御ができます。レスポンスがタイ
15031503
ムアウトした場合、空の |Dict| が返ります。例: >
15041504
@@ -1512,8 +1512,8 @@ Note ジョブが LSP メッセージを標準出力に、非LSPメッセージ
15121512
... <handle failure>
15131513
endif
15141514
1515-
Note リクエストメッセージには 'id' フィールドを指定してはいけません。指定した
1516-
場合、Vimは内部的に生成する識別子の値を上書きします。Vimは現在、'id' フィール
1515+
Note リクエストメッセージには "id" フィールドを指定してはいけません。指定した
1516+
場合、Vimは内部的に生成する識別子の値を上書きします。Vimは現在、"id" フィール
15171517
ドの種別として数値のみをサポートしています。RPC のリクエストの成功と失敗の両方
15181518
でコールバック関数が呼び出されます。
15191519

@@ -1555,7 +1555,7 @@ JSON-RPC 通知メッセージをサーバーに送信するには、|ch_sendexp
15551555
call ch_sendexpr(ch, #{method: 'initialized'})
15561556
15571557
サーバーからの JSON-RPC リクエストメッセージへの返答には |ch_sendexpr()| 関数
1558-
を使用します。レスポンスメッセージの中の 'id' フィールドの値はサーバーへのリク
1558+
を使用します。レスポンスメッセージの中の "id" フィールドの値はサーバーへのリク
15591559
エストメッセージの応答メッセージからコピーします。例: >
15601560
15611561
let resp = {}

en/channel.txt

Lines changed: 39 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*channel.txt* For Vim version 9.1. Last change: 2024 Jul 17
1+
*channel.txt* For Vim version 9.1. Last change: 2025 Oct 13
22

33

44
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -89,7 +89,8 @@ The number will increase every time you send a message.
8989
The server can send a command to Vim. Type this on T1 (literally, including
9090
the quotes):
9191
["ex","echo 'hi there'"] ~
92-
And you should see the message in Vim. You can move the cursor a word forward:
92+
And you should see the message in Vim. You can move the cursor a word
93+
forward:
9394
["normal","w"] ~
9495

9596
To handle asynchronous communication a callback needs to be used: >
@@ -234,7 +235,7 @@ what you want! Stopping the job with job_stop() might be better.
234235
All readahead is discarded, callbacks will no longer be invoked.
235236

236237
Note that a channel is closed in three stages:
237-
- The I/O ends, log message: "Closing channel". There can still be queued
238+
- The I/O ends, log message: "Closing channel". There can still be queued
238239
messages to read or callbacks to invoke.
239240
- The readahead is cleared, log message: "Clearing channel". Some variables
240241
may still reference the channel.
@@ -478,7 +479,7 @@ To read from the error output use the "part" option:
478479
{"part": "err"} ~
479480
To read a message with a specific ID, on a JS or JSON channel:
480481
{"id": 99} ~
481-
When no ID is specified or the ID is -1, the first message is returned. This
482+
When no ID is specified or the ID is -1, the first message is returned. This
482483
overrules any callback waiting for this message.
483484

484485
For a RAW channel this returns whatever is available, since Vim does not know
@@ -571,7 +572,8 @@ ch_evalraw({handle}, {string} [, {options}]) *ch_evalraw()*
571572
Return type: dict<any> or |String|
572573

573574
ch_getbufnr({handle}, {what}) *ch_getbufnr()*
574-
Get the buffer number that {handle} is using for String {what}.
575+
Get the buffer number that {handle} is using for String
576+
{what}.
575577
{handle} can be a Channel or a Job that has a Channel.
576578
{what} can be "err" for stderr, "out" for stdout or empty for
577579
socket output.
@@ -728,7 +730,7 @@ ch_sendexpr({handle}, {expr} [, {options}]) *ch_sendexpr()*
728730
{handle} can be a Channel or a Job that has a Channel.
729731
When using the "lsp" channel mode, {expr} must be a |Dict|.
730732

731-
If the channel mode is "lsp", then returns a Dict. Otherwise
733+
If the channel mode is "lsp", then returns a Dict. Otherwise
732734
returns an empty String. If the "callback" item is present in
733735
{options}, then the returned Dict contains the ID of the
734736
request message. The ID can be used to send a cancellation
@@ -813,12 +815,12 @@ been received and not parsed correctly.
813815
If the command produces a line of output that you want to deal with, specify
814816
a handler for stdout: >
815817
let job = job_start(command, {"out_cb": "MyHandler"})
816-
The function will be called with the channel and a message. You would define
818+
The function will be called with the channel and a message. You would define
817819
it like this: >
818820
func MyHandler(channel, msg)
819821
820822
Without the handler you need to read the output with |ch_read()| or
821-
|ch_readraw()|. You can do this in the close callback, see |read-in-close-cb|.
823+
|ch_readraw()|. You can do this in the close callback, see |read-in-close-cb|.
822824

823825
Note that if the job exits before you read the output, the output may be lost.
824826
This depends on the system (on Unix this happens because closing the write end
@@ -856,7 +858,7 @@ To run a job that reads from a buffer: >
856858
\ {'in_io': 'buffer', 'in_name': 'mybuffer'})
857859
<
858860
*E915* *E918*
859-
The buffer is found by name, similar to |bufnr()|. The buffer must exist and
861+
The buffer is found by name, similar to |bufnr()|. The buffer must exist and
860862
be loaded when job_start() is called.
861863

862864
By default this reads the whole buffer. This can be changed with the "in_top"
@@ -933,7 +935,8 @@ job_info([{job}]) *job_info()*
933935
Returns a Dictionary with information about {job}:
934936
"status" what |job_status()| returns
935937
"channel" what |job_getchannel()| returns
936-
"cmd" List of command arguments used to start the job
938+
"cmd" List of command arguments used to start the
939+
job
937940
"process" process ID
938941
"tty_in" terminal input name, empty when none
939942
"tty_out" terminal output name, empty when none
@@ -985,11 +988,11 @@ job_start({command} [, {options}]) *job_start()*
985988
passed to execvp(). Arguments in double quotes can contain
986989
white space.
987990

988-
{command} can be a List, where the first item is the executable
989-
and further items are the arguments. All items are converted
990-
to String. This works best on Unix.
991+
{command} can be a List, where the first item is the
992+
executable and further items are the arguments. All items are
993+
converted to String. This works best on Unix.
991994

992-
On MS-Windows, job_start() makes a GUI application hidden. If
995+
On MS-Windows, job_start() makes a GUI application hidden. If
993996
you want to show it, use |:!start| instead.
994997

995998
The command is executed directly, not through a shell, the
@@ -1311,7 +1314,7 @@ To get the status of a job: >
13111314
To make a job stop running: >
13121315
job_stop(job)
13131316
1314-
This is the normal way to end a job. On Unix it sends a SIGTERM to the job.
1317+
This is the normal way to end a job. On Unix it sends a SIGTERM to the job.
13151318
It is possible to use other ways to stop the job, or even send arbitrary
13161319
signals. E.g. to force a job to stop, "kill it": >
13171320
job_stop(job, "kill")
@@ -1327,10 +1330,10 @@ If you want to type input for the job in a Vim window you have a few options:
13271330
- Use a terminal window. This works well if what you type goes directly to
13281331
the job and the job output is directly displayed in the window.
13291332
See |terminal-window|.
1330-
- Use a window with a prompt buffer. This works well when entering a line for
1333+
- Use a window with a prompt buffer. This works well when entering a line for
13311334
the job in Vim while displaying (possibly filtered) output from the job.
13321335

1333-
A prompt buffer is created by setting 'buftype' to "prompt". You would
1336+
A prompt buffer is created by setting 'buftype' to "prompt". You would
13341337
normally only do that in a newly created buffer.
13351338

13361339
The user can edit and enter one line of text at the very last line of the
@@ -1339,25 +1342,25 @@ buffer. When pressing Enter in the prompt line the callback set with
13391342
Another callback would receive the output from the job and display it in the
13401343
buffer, below the prompt (and above the next prompt).
13411344

1342-
Only the text in the last line, after the prompt, is editable. The rest of the
1343-
buffer is not modifiable with Normal mode commands. It can be modified by
1345+
Only the text in the last line, after the prompt, is editable. The rest of
1346+
the buffer is not modifiable with Normal mode commands. It can be modified by
13441347
calling functions, such as |append()|. Using other commands may mess up the
13451348
buffer.
13461349

13471350
After setting 'buftype' to "prompt" Vim does not automatically start Insert
13481351
mode, use `:startinsert` if you want to enter Insert mode, so that the user
13491352
can start typing a line.
13501353

1351-
The text of the prompt can be set with the |prompt_setprompt()| function. If
1352-
no prompt is set with |prompt_setprompt()|, "% " is used. You can get the
1354+
The text of the prompt can be set with the |prompt_setprompt()| function. If
1355+
no prompt is set with |prompt_setprompt()|, "% " is used. You can get the
13531356
effective prompt text for a buffer, with |prompt_getprompt()|.
13541357

13551358
The user can go to Normal mode and navigate through the buffer. This can be
13561359
useful to see older output or copy text.
13571360

13581361
The CTRL-W key can be used to start a window command, such as CTRL-W w to
13591362
switch to the next window. This also works in Insert mode (use Shift-CTRL-W
1360-
to delete a word). When leaving the window Insert mode will be stopped. When
1363+
to delete a word). When leaving the window Insert mode will be stopped. When
13611364
coming back to the prompt window Insert mode will be restored.
13621365

13631366
Any command that starts Insert mode, such as "a", "i", "A" and "I", will move
@@ -1470,13 +1473,13 @@ and encode the Vim expression into JSON. Refer to |json_encode()| and
14701473
|json_decode()| for more information about how Vim encodes and decodes the
14711474
builtin types into JSON.
14721475

1473-
To open a channel using the 'lsp' mode, set the 'mode' item in the |ch_open()|
1474-
{options} argument to 'lsp'. Example: >
1476+
To open a channel using the "lsp" mode, set the "mode" item in the |ch_open()|
1477+
{options} argument to "lsp". Example: >
14751478
14761479
let ch = ch_open(..., #{mode: 'lsp'})
14771480
1478-
To open a channel using the 'lsp' mode with a job, set the 'in_mode' and
1479-
'out_mode' items in the |job_start()| {options} argument to 'lsp'. Example: >
1481+
To open a channel using the "lsp" mode with a job, set the "in_mode" and
1482+
"out_mode" items in the |job_start()| {options} argument to "lsp". Example: >
14801483
14811484
let cmd = ['clangd', '--background-index', '--clang-tidy']
14821485
let opts = {}
@@ -1494,9 +1497,9 @@ formats appropriately or you should use a separate callback function for
14941497
"out_cb" and "err_cb" to handle them as shown above.
14951498

14961499
To synchronously send a JSON-RPC request to the server, use the
1497-
|ch_evalexpr()| function. This function will wait and return the decoded
1498-
response message from the server. You can use either the |channel-timeout| or
1499-
the 'timeout' field in the {options} argument to control the response wait
1500+
|ch_evalexpr()| function. This function will wait and return the decoded
1501+
response message from the server. You can use either the |channel-timeout| or
1502+
the "timeout" field in the {options} argument to control the response wait
15001503
time. If the request times out, then an empty |Dict| is returned. Example: >
15011504
15021505
let req = {}
@@ -1509,9 +1512,10 @@ time. If the request times out, then an empty |Dict| is returned. Example: >
15091512
... <handle failure>
15101513
endif
15111514
1512-
Note that in the request message the 'id' field should not be specified. If it
1513-
is specified, then Vim will overwrite the value with an internally generated
1514-
identifier. Vim currently supports only a number type for the 'id' field.
1515+
Note that in the request message the "id" field should not be specified. If
1516+
it is specified, then Vim will overwrite the value with an internally
1517+
generated identifier. Vim currently supports only a number type for the "id"
1518+
field.
15151519
The callback function will be invoked for both a successful and a failed RPC
15161520
request.
15171521

@@ -1549,14 +1553,14 @@ for the request. Example: >
15491553
call ch_sendexpr(ch, notif)
15501554
15511555
To send a JSON-RPC notification message to the server, use the |ch_sendexpr()|
1552-
function. As the server will not send a response message to the notification,
1556+
function. As the server will not send a response message to the notification,
15531557
don't specify the "callback" item. Example: >
15541558
15551559
call ch_sendexpr(ch, #{method: 'initialized'})
15561560
15571561
To respond to a JSON-RPC request message from the server, use the
1558-
|ch_sendexpr()| function. In the response message, copy the 'id' field value
1559-
from the server request message. Example: >
1562+
|ch_sendexpr()| function. In the response message, copy the "id" field value
1563+
from the server request message. Example: >
15601564
15611565
let resp = {}
15621566
let resp.id = req.id

0 commit comments

Comments
 (0)