@@ -816,109 +816,117 @@ start_client({config}) *vim.lsp.start_client()*
816
816
table.
817
817
818
818
Parameters: ~
819
- {root_dir} (required, string) Directory where the
820
- LSP server will base its rootUri on
821
- initialization.
822
- {cmd} (required, string or list treated like
823
- | jobstart() | ) Base command that
824
- initiates the LSP client.
825
- {cmd_cwd} (string, default=| getcwd() | ) Directory
826
- to launch the `cmd` process. Not
827
- related to `root_dir` .
828
- {cmd_env} (table) Environment flags to pass to
829
- the LSP on spawn. Can be specified
830
- using keys like a map or as a list with `k = v ` pairs or both. Non-string values are
831
- coerced to string. Example: >
819
+ {root_dir} (required, string) Directory where
820
+ the LSP server will base its rootUri
821
+ on initialization.
822
+ {cmd} (required, string or list treated
823
+ like | jobstart() | ) Base command that
824
+ initiates the LSP client.
825
+ {cmd_cwd} (string, default=| getcwd() | )
826
+ Directory to launch the `cmd`
827
+ process. Not related to `root_dir` .
828
+ {cmd_env} (table) Environment flags to pass to
829
+ the LSP on spawn. Can be specified
830
+ using keys like a map or as a list
831
+ with `k = v ` pairs or both. Non-string values are
832
+ coerced to string. Example: >
832
833
833
834
{ "PRODUCTION=true"; "TEST=123"; PORT = 8080; HOST = "0.0.0.0"; }
834
835
<
835
- {capabilities} Map overriding the default capabilities
836
- defined by
837
- | vim.lsp.protocol.make_client_capabilities() | ,
838
- passed to the language server on
839
- initialization. Hint: use
840
- make_client_capabilities() and modify
841
- its result.
842
- • Note: To send an empty dictionary use
843
- `{[vim .type_idx]= vim .types.dictionary }`
844
- , else it will be encoded as an
845
- array.
846
- {handlers} Map of language server method names to
847
- | lsp-handler |
848
- {settings} Map with language server specific
849
- settings. These are returned to the
850
- language server if requested via
851
- `workspace/configuration` . Keys are
852
- case-sensitive.
853
- {init_options} Values to pass in the initialization
854
- request as `initializationOptions` .
855
- See `initialize` in the LSP spec.
856
- {name} (string, default=client-id) Name in log
857
- messages.
858
- {get_language_id} function(bufnr, filetype) -> language
859
- ID as string. Defaults to the filetype.
860
- {offset_encoding} (default="utf-16") One of "utf-8",
861
- "utf-16", or "utf-32" which is the
862
- encoding that the LSP server expects.
863
- Client does not verify this is correct.
864
- {on_error} Callback with parameters (code, ...),
865
- invoked when the client operation
866
- throws an error. `code` is a number
867
- describing the error. Other arguments
868
- may be passed depending on the error
869
- kind. See | vim.lsp.client_errors | for
870
- possible errors. Use
871
- `vim .lsp .client_errors[code]` to get
872
- human-friendly name.
873
- {before_init} Callback with parameters
874
- (initialize_params, config) invoked
875
- before the LSP "initialize" phase,
876
- where `params` contains the parameters
877
- being sent to the server and `config`
878
- is the config that was passed to
879
- | vim.lsp.start_client() | . You can use
880
- this to modify parameters before they
881
- are sent.
882
- {on_init} Callback (client, initialize_result)
883
- invoked after LSP "initialize", where
884
- `result` is a table of `capabilities`
885
- and anything else the server may send.
886
- For example, clangd sends
887
- `initialize_result.offsetEncoding` if
888
- `capabilities.offsetEncoding` was sent
889
- to it. You can only modify the
890
- `client.offset_encoding` here before
891
- any notifications are sent. Most
892
- language servers expect to be sent
893
- client specified settings after
894
- initialization. Neovim does not make
895
- this assumption. A
896
- `workspace/didChangeConfiguration`
897
- notification should be sent to the
898
- server during on_init.
899
- {on_exit} Callback (code, signal, client_id)
900
- invoked on client exit.
901
- • code: exit code of the process
902
- • signal: number describing the signal
903
- used to terminate (if any)
904
- • client_id: client handle
905
- {on_attach} Callback (client, bufnr) invoked when
906
- client attaches to a buffer.
907
- {trace} "off" | "messages" | "verbose" | nil
908
- passed directly to the language server
909
- in the initialize request.
910
- Invalid/empty values will default to
911
- "off"
912
- {flags} A table with flags for the client. The
913
- current (experimental) flags are:
914
- • allow_incremental_sync (bool, default
915
- true): Allow using incremental sync
916
- for buffer edits
917
- • debounce_text_changes (number,
918
- default nil): Debounce didChange
919
- notifications to the server by the
920
- given number in milliseconds. No
921
- debounce occurs if nil
836
+ {capabilities} Map overriding the default
837
+ capabilities defined by
838
+ | vim.lsp.protocol.make_client_capabilities() | ,
839
+ passed to the language server on
840
+ initialization. Hint: use
841
+ make_client_capabilities() and modify
842
+ its result.
843
+ • Note: To send an empty dictionary
844
+ use
845
+ `{[vim .type_idx]= vim .types.dictionary }`
846
+ , else it will be encoded as an
847
+ array.
848
+ {handlers} Map of language server method names
849
+ to | lsp-handler |
850
+ {settings} Map with language server specific
851
+ settings. These are returned to the
852
+ language server if requested via
853
+ `workspace/configuration` . Keys are
854
+ case-sensitive.
855
+ {init_options} Values to pass in the initialization
856
+ request as `initializationOptions` .
857
+ See `initialize` in the LSP spec.
858
+ {name} (string, default=client-id) Name in
859
+ log messages.
860
+ {workspace_folders} (table) List of workspace folders
861
+ passed to the language server.
862
+ Defaults to root_dir if not set. See
863
+ `workspaceFolders` in the LSP spec
864
+ {get_language_id} function(bufnr, filetype) -> language
865
+ ID as string. Defaults to the
866
+ filetype.
867
+ {offset_encoding} (default="utf-16") One of "utf-8",
868
+ "utf-16", or "utf-32" which is the
869
+ encoding that the LSP server expects.
870
+ Client does not verify this is
871
+ correct.
872
+ {on_error} Callback with parameters (code, ...),
873
+ invoked when the client operation
874
+ throws an error. `code` is a number
875
+ describing the error. Other arguments
876
+ may be passed depending on the error
877
+ kind. See | vim.lsp.client_errors | for
878
+ possible errors. Use
879
+ `vim .lsp .client_errors[code]` to get
880
+ human-friendly name.
881
+ {before_init} Callback with parameters
882
+ (initialize_params, config) invoked
883
+ before the LSP "initialize" phase,
884
+ where `params` contains the
885
+ parameters being sent to the server
886
+ and `config` is the config that was
887
+ passed to | vim.lsp.start_client() | .
888
+ You can use this to modify parameters
889
+ before they are sent.
890
+ {on_init} Callback (client, initialize_result)
891
+ invoked after LSP "initialize", where
892
+ `result` is a table of `capabilities`
893
+ and anything else the server may
894
+ send. For example, clangd sends
895
+ `initialize_result.offsetEncoding` if
896
+ `capabilities.offsetEncoding` was
897
+ sent to it. You can only modify the
898
+ `client.offset_encoding` here before
899
+ any notifications are sent. Most
900
+ language servers expect to be sent
901
+ client specified settings after
902
+ initialization. Neovim does not make
903
+ this assumption. A
904
+ `workspace/didChangeConfiguration`
905
+ notification should be sent to the
906
+ server during on_init.
907
+ {on_exit} Callback (code, signal, client_id)
908
+ invoked on client exit.
909
+ • code: exit code of the process
910
+ • signal: number describing the
911
+ signal used to terminate (if any)
912
+ • client_id: client handle
913
+ {on_attach} Callback (client, bufnr) invoked when
914
+ client attaches to a buffer.
915
+ {trace} "off" | "messages" | "verbose" | nil
916
+ passed directly to the language
917
+ server in the initialize request.
918
+ Invalid/empty values will default to
919
+ "off"
920
+ {flags} A table with flags for the client.
921
+ The current (experimental) flags are:
922
+ • allow_incremental_sync (bool,
923
+ default true): Allow using
924
+ incremental sync for buffer edits
925
+ • debounce_text_changes (number,
926
+ default nil): Debounce didChange
927
+ notifications to the server by the
928
+ given number in milliseconds. No
929
+ debounce occurs if nil
922
930
923
931
Return: ~
924
932
Client id. | vim.lsp.get_client_by_id() | Note: client may
@@ -1188,6 +1196,34 @@ workspace_symbol({query}) *vim.lsp.buf.workspace_symbol()*
1188
1196
==============================================================================
1189
1197
Lua module: vim.lsp.diagnostic *lsp-diagnostic*
1190
1198
1199
+ *vim.lsp.diagnostic.apply_to_diagnostic_items()*
1200
+ apply_to_diagnostic_items({item_handler}, {command} , {opts} )
1201
+ Gets diagnostics, converts them to quickfix/location list
1202
+ items, and applies the item_handler callback to the items.
1203
+
1204
+ Parameters: ~
1205
+ {item_handler} function Callback to apply to the
1206
+ diagnostic items
1207
+ {command} string|nil Command to execute after
1208
+ applying the item_handler
1209
+ {opts} table|nil Configuration table. Keys:
1210
+ • {client_id}: (number)
1211
+ • If nil, will consider all clients
1212
+ attached to buffer.
1213
+
1214
+ • {severity} : (DiagnosticSeverity)
1215
+ • Exclusive severity to consider.
1216
+ Overrides {severity_limit}
1217
+
1218
+ • {severity_limit}: (DiagnosticSeverity)
1219
+ • Limit severity of diagnostics found.
1220
+ E.g. "Warning" means { "Error",
1221
+ "Warning" } will be valid.
1222
+
1223
+ • {workspace} : (boolean, default false)
1224
+ • Set the list with workspace
1225
+ diagnostics
1226
+
1191
1227
*vim.lsp.diagnostic.clear()*
1192
1228
clear({bufnr} , {client_id}, {diagnostic_ns}, {sign_ns})
1193
1229
Clears the currently displayed diagnostics
@@ -1470,13 +1506,13 @@ save({diagnostics}, {bufnr}, {client_id}) *vim.lsp.diagnostic.save()*
1470
1506
save_extmarks({bufnr} , {client_id})
1471
1507
TODO: Documentation
1472
1508
1473
- set_qflist ({opts} ) *vim.lsp.diagnostic.set_qflist ()*
1474
- Sets the quickfix list
1509
+ set_loclist ({opts} ) *vim.lsp.diagnostic.set_loclist ()*
1510
+ Sets the location list
1475
1511
1476
1512
Parameters: ~
1477
1513
{opts} table|nil Configuration table. Keys:
1478
1514
• {open} : (boolean, default true)
1479
- • Open quickfix list after set
1515
+ • Open loclist after set
1480
1516
1481
1517
• {client_id}: (number)
1482
1518
• If nil, will consider all clients attached to
@@ -1491,16 +1527,16 @@ set_qflist({opts}) *vim.lsp.diagnostic.set_qflist()*
1491
1527
"Warning" means { "Error", "Warning" } will be
1492
1528
valid.
1493
1529
1494
- • {workspace} : (boolean, default true )
1530
+ • {workspace} : (boolean, default false )
1495
1531
• Set the list with workspace diagnostics
1496
1532
1497
- set_loclist ({opts} ) *vim.lsp.diagnostic.set_loclist ()*
1498
- Sets the location list
1533
+ set_qflist ({opts} ) *vim.lsp.diagnostic.set_qflist ()*
1534
+ Sets the quickfix list
1499
1535
1500
1536
Parameters: ~
1501
1537
{opts} table|nil Configuration table. Keys:
1502
1538
• {open} : (boolean, default true)
1503
- • Open loclist after set
1539
+ • Open quickfix list after set
1504
1540
1505
1541
• {client_id}: (number)
1506
1542
• If nil, will consider all clients attached to
@@ -1515,7 +1551,7 @@ set_loclist({opts}) *vim.lsp.diagnostic.set_loclist()*
1515
1551
"Warning" means { "Error", "Warning" } will be
1516
1552
valid.
1517
1553
1518
- • {workspace} : (boolean, default false )
1554
+ • {workspace} : (boolean, default true )
1519
1555
• Set the list with workspace diagnostics
1520
1556
1521
1557
*vim.lsp.diagnostic.set_signs()*
0 commit comments