From 7ef972d6fc90a646d3272f509d5b8eb4be33a17a Mon Sep 17 00:00:00 2001 From: Lukasz Samson Date: Fri, 18 Aug 2023 10:41:05 +0200 Subject: [PATCH] remove experimental server --- .dialyzer_ignore.exs | 3 +- .../benchmarks/document_bench.exs | 44 - .../benchmarks/line_parser_bench.exs | 26 - .../call_hierarchy/client_capabilities.ex | 6 - .../generated/lsp/types/change_annotation.ex | 9 - .../lsp/types/client_capabilities.ex | 13 - .../lib/generated/lsp/types/code_action.ex | 21 - .../types/code_action/client_capabilities.ex | 30 - .../lsp/types/code_action/context.ex | 10 - .../generated/lsp/types/code_action/kind.ex | 15 - .../generated/lsp/types/code_action/params.ex | 12 - .../lsp/types/code_action/trigger/kind.ex | 6 - .../generated/lsp/types/code_description.ex | 6 - .../types/code_lens/client_capabilities.ex | 6 - .../workspace/client_capabilities.ex | 6 - .../lib/generated/lsp/types/command.ex | 6 - .../types/completion/client_capabilities.ex | 54 - .../lsp/types/completion/item/kind.ex | 31 - .../lsp/types/completion/item/tag.ex | 6 - .../lib/generated/lsp/types/create_file.ex | 11 - .../lsp/types/create_file/options.ex | 6 - .../types/declaration/client_capabilities.ex | 6 - .../types/definition/client_capabilities.ex | 6 - .../lib/generated/lsp/types/delete_file.ex | 11 - .../lsp/types/delete_file/options.ex | 6 - .../lib/generated/lsp/types/diagnostic.ex | 16 - .../types/diagnostic/client_capabilities.ex | 6 - .../types/diagnostic/related_information.ex | 7 - .../lsp/types/diagnostic/severity.ex | 6 - .../lib/generated/lsp/types/diagnostic/tag.ex | 6 - .../workspace/client_capabilities.ex | 6 - .../client_capabilities.ex | 6 - .../client_capabilities.ex | 6 - .../document/color/client_capabilities.ex | 6 - .../formatting/client_capabilities.ex | 6 - .../lsp/types/document/formatting/options.ex | 6 - .../lsp/types/document/formatting/params.ex | 10 - .../document/highlight/client_capabilities.ex | 6 - .../document/link/client_capabilities.ex | 6 - .../on_type_formatting/client_capabilities.ex | 6 - .../range_formatting/client_capabilities.ex | 6 - .../document/symbol/client_capabilities.ex | 23 - .../execute_command/client_capabilities.ex | 6 - .../lsp/types/failure_handling/kind.ex | 10 - .../file_operation/client_capabilities.ex | 13 - .../folding_range/client_capabilities.ex | 23 - .../generated/lsp/types/folding_range/kind.ex | 6 - .../generated/lsp/types/formatting/options.ex | 11 - .../lsp/types/general/client_capabilities.ex | 17 - .../lsp/types/hover/client_capabilities.ex | 9 - .../implementation/client_capabilities.ex | 6 - .../generated/lsp/types/initialize/params.ex | 26 - .../types/inlay_hint/client_capabilities.ex | 12 - .../client_capabilities.ex | 6 - .../types/inline_value/client_capabilities.ex | 6 - .../workspace/client_capabilities.ex | 6 - .../generated/lsp/types/insert_text_mode.ex | 6 - .../client_capabilities.ex | 6 - .../lib/generated/lsp/types/location.ex | 7 - .../lsp/types/markdown/client_capabilities.ex | 6 - .../lib/generated/lsp/types/markup/kind.ex | 6 - .../lsp/types/moniker/client_capabilities.ex | 6 - .../notebook/document/client_capabilities.ex | 7 - .../document/sync/client_capabilities.ex | 8 - .../lib/generated/lsp/types/position.ex | 6 - .../lsp/types/position/encoding/kind.ex | 6 - .../types/prepare_support_default_behavior.ex | 6 - .../lib/generated/lsp/types/progress/token.ex | 6 - .../client_capabilities.ex | 18 - .../lsp/types/publish_diagnostics/params.ex | 7 - .../lib/generated/lsp/types/range.ex | 7 - .../types/reference/client_capabilities.ex | 6 - .../lib/generated/lsp/types/registration.ex | 6 - .../client_capabilities.ex | 6 - .../lsp/types/rename/client_capabilities.ex | 11 - .../lib/generated/lsp/types/rename_file.ex | 12 - .../lsp/types/rename_file/options.ex | 6 - .../lsp/types/resource_operation/kind.ex | 6 - .../selection_range/client_capabilities.ex | 6 - .../semantic_tokens/client_capabilities.ex | 32 - .../workspace/client_capabilities.ex | 6 - .../show_document/client_capabilities.ex | 6 - .../client_capabilities.ex | 12 - .../signature_help/client_capabilities.ex | 24 - .../lib/generated/lsp/types/symbol/kind.ex | 32 - .../lib/generated/lsp/types/symbol/tag.ex | 6 - .../text_document/client_capabilities.ex | 37 - .../text_document/content_change_event.ex | 18 - .../generated/lsp/types/text_document/edit.ex | 9 - .../lsp/types/text_document/identifier.ex | 6 - .../generated/lsp/types/text_document/item.ex | 6 - .../optional_versioned/identifier.ex | 6 - .../text_document/sync/client_capabilities.ex | 10 - .../text_document/versioned/identifier.ex | 6 - .../lib/generated/lsp/types/text_edit.ex | 7 - .../lsp/types/text_edit/annotated.ex | 7 - .../lib/generated/lsp/types/token_format.ex | 6 - .../type_definition/client_capabilities.ex | 6 - .../type_hierarchy/client_capabilities.ex | 6 - .../lsp/types/window/client_capabilities.ex | 10 - .../types/workspace/client_capabilities.ex | 21 - .../lib/generated/lsp/types/workspace/edit.ex | 20 - .../workspace/edit/client_capabilities.ex | 18 - .../generated/lsp/types/workspace/folder.ex | 6 - .../workspace/symbol/client_capabilities.ex | 27 - apps/language_server/lib/language_server.ex | 28 +- .../experimental/code_mod/ast.ex | 28 - .../experimental/code_mod/diff.ex | 107 - .../experimental/code_mod/format.ex | 167 - .../code_mod/replace_remote_function.ex | 51 - .../code_mod/replace_with_underscore.ex | 55 - .../experimental/code_mod/text.ex | 21 - .../language_server/experimental/code_unit.ex | 180 - .../experimental/language_server.ex | 66 - .../lib/language_server/experimental/log.ex | 15 - .../experimental/process_cache.ex | 82 - .../language_server/experimental/project.ex | 260 - .../language_server/experimental/protocol.ex | 0 .../experimental/protocol/id.ex | 7 - .../experimental/protocol/notifications.ex | 70 - .../experimental/protocol/proto.ex | 48 - .../experimental/protocol/proto/alias.ex | 22 - .../protocol/proto/compile_metadata.ex | 62 - .../experimental/protocol/proto/convert.ex | 96 - .../experimental/protocol/proto/decoders.ex | 184 - .../experimental/protocol/proto/enum.ex | 54 - .../experimental/protocol/proto/field.ex | 287 - .../experimental/protocol/proto/lsp_types.ex | 41 - .../protocol/proto/macros/access.ex | 34 - .../protocol/proto/macros/inspect.ex | 36 - .../protocol/proto/macros/json.ex | 46 - .../protocol/proto/macros/match.ex | 20 - .../protocol/proto/macros/message.ex | 64 - .../protocol/proto/macros/meta.ex | 37 - .../protocol/proto/macros/parse.ex | 140 - .../protocol/proto/macros/struct.ex | 48 - .../protocol/proto/macros/typespec.ex | 7 - .../protocol/proto/notification.ex | 88 - .../experimental/protocol/proto/request.ex | 97 - .../experimental/protocol/proto/response.ex | 58 - .../experimental/protocol/proto/text.ex | 10 - .../experimental/protocol/proto/type.ex | 38 - .../protocol/proto/type_functions.ex | 58 - .../experimental/protocol/requests.ex | 65 - .../experimental/protocol/responses.ex | 30 - .../code_action/replace_remote_function.ex | 176 - .../code_action/replace_with_underscore.ex | 83 - .../experimental/provider/env.ex | 27 - .../provider/handlers/code_action.ex | 20 - .../provider/handlers/find_references.ex | 61 - .../provider/handlers/formatting.ex | 29 - .../provider/handlers/goto_definition.ex | 34 - .../experimental/provider/queue.ex | 230 - .../experimental/provider/supervisor.ex | 20 - .../language_server/experimental/server.ex | 120 - .../experimental/server/configuration.ex | 137 - .../server/configuration/support.ex | 49 - .../experimental/server/state.ex | 121 - .../experimental/source_file.ex | 273 - .../experimental/source_file/conversions.ex | 173 - .../experimental/source_file/document.ex | 104 - .../experimental/source_file/line.ex | 7 - .../experimental/source_file/line_parser.ex | 102 - .../experimental/source_file/position.ex | 7 - .../experimental/source_file/range.ex | 9 - .../experimental/source_file/store.ex | 301 - .../experimental/supervisor.ex | 21 - .../lib/language_server/packet_router.ex | 92 - .../lib/language_server/server.ex | 36 +- .../lib/language_server/server/decider.ex | 24 - .../lib/mix/tasks/lsp/data_model.ex | 125 - .../mix/tasks/lsp/data_model/enumeration.ex | 65 - .../mix/tasks/lsp/data_model/notification.ex | 3 - .../lib/mix/tasks/lsp/data_model/property.ex | 37 - .../lib/mix/tasks/lsp/data_model/request.ex | 3 - .../lib/mix/tasks/lsp/data_model/structure.ex | 131 - .../lib/mix/tasks/lsp/data_model/type.ex | 408 - .../mix/tasks/lsp/data_model/type_alias.ex | 76 - .../lib/mix/tasks/lsp/mappings.ex | 142 - .../lib/mix/tasks/lsp/mappings/generate.ex | 223 - .../lib/mix/tasks/lsp/mappings/init.ex | 48 - .../tasks/lsp/mappings/numbering_context.ex | 32 - .../lib/mix/tasks/lsp/mappings/print.ex | 183 - .../lib/mix/tasks/lsp/metamodel.3.17.json | 14383 ---------------- .../lib/mix/tasks/lsp/type_mappings.json | 1852 -- .../test/experimental/code_mod/diff_test.exs | 239 - .../experimental/code_mod/format_test.exs | 178 - .../code_mod/replace_with_underscore_test.exs | 214 - .../test/experimental/code_unit_test.exs | 210 - .../test/experimental/document_test.exs | 67 - .../test/experimental/line_parser_test.exs | 113 - .../test/experimental/process_cache_test.exs | 58 - .../test/experimental/project_test.exs | 348 - .../protocol/notifications_test.exs | 43 - .../test/experimental/protocol/proto_test.exs | 727 - .../experimental/protocol/requests_test.exs | 45 - .../provider/code_action/#warning_parser.ex# | 59 - .../replace_remote_function_test.exs | 322 - .../replace_with_underscore_test.exs | 149 - .../handlers/find_references_test.exs | 232 - .../provider/handlers/formatting_test.exs | 3 - .../handlers/goto_definition_test.exs | 208 - .../test/experimental/provider/queue_test.exs | 101 - .../server/configuration_test.exs | 286 - .../test/experimental/server/state_test.exs | 124 - .../source_file/conversions_test.exs | 94 - .../experimental/source_file/store_test.exs | 150 - .../test/experimental/source_file_test.exs | 708 - .../experimental/code_mod/code_mod_case.ex | 94 - config/config.exs | 3 - 210 files changed, 9 insertions(+), 28704 deletions(-) delete mode 100644 apps/language_server/benchmarks/document_bench.exs delete mode 100644 apps/language_server/benchmarks/line_parser_bench.exs delete mode 100644 apps/language_server/lib/generated/lsp/types/call_hierarchy/client_capabilities.ex delete mode 100644 apps/language_server/lib/generated/lsp/types/change_annotation.ex delete mode 100644 apps/language_server/lib/generated/lsp/types/client_capabilities.ex delete mode 100644 apps/language_server/lib/generated/lsp/types/code_action.ex delete mode 100644 apps/language_server/lib/generated/lsp/types/code_action/client_capabilities.ex delete mode 100644 apps/language_server/lib/generated/lsp/types/code_action/context.ex delete mode 100644 apps/language_server/lib/generated/lsp/types/code_action/kind.ex delete mode 100644 apps/language_server/lib/generated/lsp/types/code_action/params.ex delete mode 100644 apps/language_server/lib/generated/lsp/types/code_action/trigger/kind.ex delete mode 100644 apps/language_server/lib/generated/lsp/types/code_description.ex delete mode 100644 apps/language_server/lib/generated/lsp/types/code_lens/client_capabilities.ex delete mode 100644 apps/language_server/lib/generated/lsp/types/code_lens/workspace/client_capabilities.ex delete mode 100644 apps/language_server/lib/generated/lsp/types/command.ex delete mode 100644 apps/language_server/lib/generated/lsp/types/completion/client_capabilities.ex delete mode 100644 apps/language_server/lib/generated/lsp/types/completion/item/kind.ex delete mode 100644 apps/language_server/lib/generated/lsp/types/completion/item/tag.ex delete mode 100644 apps/language_server/lib/generated/lsp/types/create_file.ex delete mode 100644 apps/language_server/lib/generated/lsp/types/create_file/options.ex delete mode 100644 apps/language_server/lib/generated/lsp/types/declaration/client_capabilities.ex delete mode 100644 apps/language_server/lib/generated/lsp/types/definition/client_capabilities.ex delete mode 100644 apps/language_server/lib/generated/lsp/types/delete_file.ex delete mode 100644 apps/language_server/lib/generated/lsp/types/delete_file/options.ex delete mode 100644 apps/language_server/lib/generated/lsp/types/diagnostic.ex delete mode 100644 apps/language_server/lib/generated/lsp/types/diagnostic/client_capabilities.ex delete mode 100644 apps/language_server/lib/generated/lsp/types/diagnostic/related_information.ex delete mode 100644 apps/language_server/lib/generated/lsp/types/diagnostic/severity.ex delete mode 100644 apps/language_server/lib/generated/lsp/types/diagnostic/tag.ex delete mode 100644 apps/language_server/lib/generated/lsp/types/diagnostic/workspace/client_capabilities.ex delete mode 100644 apps/language_server/lib/generated/lsp/types/did_change_configuration/client_capabilities.ex delete mode 100644 apps/language_server/lib/generated/lsp/types/did_change_watched_files/client_capabilities.ex delete mode 100644 apps/language_server/lib/generated/lsp/types/document/color/client_capabilities.ex delete mode 100644 apps/language_server/lib/generated/lsp/types/document/formatting/client_capabilities.ex delete mode 100644 apps/language_server/lib/generated/lsp/types/document/formatting/options.ex delete mode 100644 apps/language_server/lib/generated/lsp/types/document/formatting/params.ex delete mode 100644 apps/language_server/lib/generated/lsp/types/document/highlight/client_capabilities.ex delete mode 100644 apps/language_server/lib/generated/lsp/types/document/link/client_capabilities.ex delete mode 100644 apps/language_server/lib/generated/lsp/types/document/on_type_formatting/client_capabilities.ex delete mode 100644 apps/language_server/lib/generated/lsp/types/document/range_formatting/client_capabilities.ex delete mode 100644 apps/language_server/lib/generated/lsp/types/document/symbol/client_capabilities.ex delete mode 100644 apps/language_server/lib/generated/lsp/types/execute_command/client_capabilities.ex delete mode 100644 apps/language_server/lib/generated/lsp/types/failure_handling/kind.ex delete mode 100644 apps/language_server/lib/generated/lsp/types/file_operation/client_capabilities.ex delete mode 100644 apps/language_server/lib/generated/lsp/types/folding_range/client_capabilities.ex delete mode 100644 apps/language_server/lib/generated/lsp/types/folding_range/kind.ex delete mode 100644 apps/language_server/lib/generated/lsp/types/formatting/options.ex delete mode 100644 apps/language_server/lib/generated/lsp/types/general/client_capabilities.ex delete mode 100644 apps/language_server/lib/generated/lsp/types/hover/client_capabilities.ex delete mode 100644 apps/language_server/lib/generated/lsp/types/implementation/client_capabilities.ex delete mode 100644 apps/language_server/lib/generated/lsp/types/initialize/params.ex delete mode 100644 apps/language_server/lib/generated/lsp/types/inlay_hint/client_capabilities.ex delete mode 100644 apps/language_server/lib/generated/lsp/types/inlay_hint_workspace/client_capabilities.ex delete mode 100644 apps/language_server/lib/generated/lsp/types/inline_value/client_capabilities.ex delete mode 100644 apps/language_server/lib/generated/lsp/types/inline_value/workspace/client_capabilities.ex delete mode 100644 apps/language_server/lib/generated/lsp/types/insert_text_mode.ex delete mode 100644 apps/language_server/lib/generated/lsp/types/linked_editing_range/client_capabilities.ex delete mode 100644 apps/language_server/lib/generated/lsp/types/location.ex delete mode 100644 apps/language_server/lib/generated/lsp/types/markdown/client_capabilities.ex delete mode 100644 apps/language_server/lib/generated/lsp/types/markup/kind.ex delete mode 100644 apps/language_server/lib/generated/lsp/types/moniker/client_capabilities.ex delete mode 100644 apps/language_server/lib/generated/lsp/types/notebook/document/client_capabilities.ex delete mode 100644 apps/language_server/lib/generated/lsp/types/notebook/document/sync/client_capabilities.ex delete mode 100644 apps/language_server/lib/generated/lsp/types/position.ex delete mode 100644 apps/language_server/lib/generated/lsp/types/position/encoding/kind.ex delete mode 100644 apps/language_server/lib/generated/lsp/types/prepare_support_default_behavior.ex delete mode 100644 apps/language_server/lib/generated/lsp/types/progress/token.ex delete mode 100644 apps/language_server/lib/generated/lsp/types/publish_diagnostics/client_capabilities.ex delete mode 100644 apps/language_server/lib/generated/lsp/types/publish_diagnostics/params.ex delete mode 100644 apps/language_server/lib/generated/lsp/types/range.ex delete mode 100644 apps/language_server/lib/generated/lsp/types/reference/client_capabilities.ex delete mode 100644 apps/language_server/lib/generated/lsp/types/registration.ex delete mode 100644 apps/language_server/lib/generated/lsp/types/regular_expressions/client_capabilities.ex delete mode 100644 apps/language_server/lib/generated/lsp/types/rename/client_capabilities.ex delete mode 100644 apps/language_server/lib/generated/lsp/types/rename_file.ex delete mode 100644 apps/language_server/lib/generated/lsp/types/rename_file/options.ex delete mode 100644 apps/language_server/lib/generated/lsp/types/resource_operation/kind.ex delete mode 100644 apps/language_server/lib/generated/lsp/types/selection_range/client_capabilities.ex delete mode 100644 apps/language_server/lib/generated/lsp/types/semantic_tokens/client_capabilities.ex delete mode 100644 apps/language_server/lib/generated/lsp/types/semantic_tokens/workspace/client_capabilities.ex delete mode 100644 apps/language_server/lib/generated/lsp/types/show_document/client_capabilities.ex delete mode 100644 apps/language_server/lib/generated/lsp/types/show_message_request/client_capabilities.ex delete mode 100644 apps/language_server/lib/generated/lsp/types/signature_help/client_capabilities.ex delete mode 100644 apps/language_server/lib/generated/lsp/types/symbol/kind.ex delete mode 100644 apps/language_server/lib/generated/lsp/types/symbol/tag.ex delete mode 100644 apps/language_server/lib/generated/lsp/types/text_document/client_capabilities.ex delete mode 100644 apps/language_server/lib/generated/lsp/types/text_document/content_change_event.ex delete mode 100644 apps/language_server/lib/generated/lsp/types/text_document/edit.ex delete mode 100644 apps/language_server/lib/generated/lsp/types/text_document/identifier.ex delete mode 100644 apps/language_server/lib/generated/lsp/types/text_document/item.ex delete mode 100644 apps/language_server/lib/generated/lsp/types/text_document/optional_versioned/identifier.ex delete mode 100644 apps/language_server/lib/generated/lsp/types/text_document/sync/client_capabilities.ex delete mode 100644 apps/language_server/lib/generated/lsp/types/text_document/versioned/identifier.ex delete mode 100644 apps/language_server/lib/generated/lsp/types/text_edit.ex delete mode 100644 apps/language_server/lib/generated/lsp/types/text_edit/annotated.ex delete mode 100644 apps/language_server/lib/generated/lsp/types/token_format.ex delete mode 100644 apps/language_server/lib/generated/lsp/types/type_definition/client_capabilities.ex delete mode 100644 apps/language_server/lib/generated/lsp/types/type_hierarchy/client_capabilities.ex delete mode 100644 apps/language_server/lib/generated/lsp/types/window/client_capabilities.ex delete mode 100644 apps/language_server/lib/generated/lsp/types/workspace/client_capabilities.ex delete mode 100644 apps/language_server/lib/generated/lsp/types/workspace/edit.ex delete mode 100644 apps/language_server/lib/generated/lsp/types/workspace/edit/client_capabilities.ex delete mode 100644 apps/language_server/lib/generated/lsp/types/workspace/folder.ex delete mode 100644 apps/language_server/lib/generated/lsp/types/workspace/symbol/client_capabilities.ex delete mode 100644 apps/language_server/lib/language_server/experimental/code_mod/ast.ex delete mode 100644 apps/language_server/lib/language_server/experimental/code_mod/diff.ex delete mode 100644 apps/language_server/lib/language_server/experimental/code_mod/format.ex delete mode 100644 apps/language_server/lib/language_server/experimental/code_mod/replace_remote_function.ex delete mode 100644 apps/language_server/lib/language_server/experimental/code_mod/replace_with_underscore.ex delete mode 100644 apps/language_server/lib/language_server/experimental/code_mod/text.ex delete mode 100644 apps/language_server/lib/language_server/experimental/code_unit.ex delete mode 100644 apps/language_server/lib/language_server/experimental/language_server.ex delete mode 100644 apps/language_server/lib/language_server/experimental/log.ex delete mode 100644 apps/language_server/lib/language_server/experimental/process_cache.ex delete mode 100644 apps/language_server/lib/language_server/experimental/project.ex delete mode 100644 apps/language_server/lib/language_server/experimental/protocol.ex delete mode 100644 apps/language_server/lib/language_server/experimental/protocol/id.ex delete mode 100644 apps/language_server/lib/language_server/experimental/protocol/notifications.ex delete mode 100644 apps/language_server/lib/language_server/experimental/protocol/proto.ex delete mode 100644 apps/language_server/lib/language_server/experimental/protocol/proto/alias.ex delete mode 100644 apps/language_server/lib/language_server/experimental/protocol/proto/compile_metadata.ex delete mode 100644 apps/language_server/lib/language_server/experimental/protocol/proto/convert.ex delete mode 100644 apps/language_server/lib/language_server/experimental/protocol/proto/decoders.ex delete mode 100644 apps/language_server/lib/language_server/experimental/protocol/proto/enum.ex delete mode 100644 apps/language_server/lib/language_server/experimental/protocol/proto/field.ex delete mode 100644 apps/language_server/lib/language_server/experimental/protocol/proto/lsp_types.ex delete mode 100644 apps/language_server/lib/language_server/experimental/protocol/proto/macros/access.ex delete mode 100644 apps/language_server/lib/language_server/experimental/protocol/proto/macros/inspect.ex delete mode 100644 apps/language_server/lib/language_server/experimental/protocol/proto/macros/json.ex delete mode 100644 apps/language_server/lib/language_server/experimental/protocol/proto/macros/match.ex delete mode 100644 apps/language_server/lib/language_server/experimental/protocol/proto/macros/message.ex delete mode 100644 apps/language_server/lib/language_server/experimental/protocol/proto/macros/meta.ex delete mode 100644 apps/language_server/lib/language_server/experimental/protocol/proto/macros/parse.ex delete mode 100644 apps/language_server/lib/language_server/experimental/protocol/proto/macros/struct.ex delete mode 100644 apps/language_server/lib/language_server/experimental/protocol/proto/macros/typespec.ex delete mode 100644 apps/language_server/lib/language_server/experimental/protocol/proto/notification.ex delete mode 100644 apps/language_server/lib/language_server/experimental/protocol/proto/request.ex delete mode 100644 apps/language_server/lib/language_server/experimental/protocol/proto/response.ex delete mode 100644 apps/language_server/lib/language_server/experimental/protocol/proto/text.ex delete mode 100644 apps/language_server/lib/language_server/experimental/protocol/proto/type.ex delete mode 100644 apps/language_server/lib/language_server/experimental/protocol/proto/type_functions.ex delete mode 100644 apps/language_server/lib/language_server/experimental/protocol/requests.ex delete mode 100644 apps/language_server/lib/language_server/experimental/protocol/responses.ex delete mode 100644 apps/language_server/lib/language_server/experimental/provider/code_action/replace_remote_function.ex delete mode 100644 apps/language_server/lib/language_server/experimental/provider/code_action/replace_with_underscore.ex delete mode 100644 apps/language_server/lib/language_server/experimental/provider/env.ex delete mode 100644 apps/language_server/lib/language_server/experimental/provider/handlers/code_action.ex delete mode 100644 apps/language_server/lib/language_server/experimental/provider/handlers/find_references.ex delete mode 100644 apps/language_server/lib/language_server/experimental/provider/handlers/formatting.ex delete mode 100644 apps/language_server/lib/language_server/experimental/provider/handlers/goto_definition.ex delete mode 100644 apps/language_server/lib/language_server/experimental/provider/queue.ex delete mode 100644 apps/language_server/lib/language_server/experimental/provider/supervisor.ex delete mode 100644 apps/language_server/lib/language_server/experimental/server.ex delete mode 100644 apps/language_server/lib/language_server/experimental/server/configuration.ex delete mode 100644 apps/language_server/lib/language_server/experimental/server/configuration/support.ex delete mode 100644 apps/language_server/lib/language_server/experimental/server/state.ex delete mode 100644 apps/language_server/lib/language_server/experimental/source_file.ex delete mode 100644 apps/language_server/lib/language_server/experimental/source_file/conversions.ex delete mode 100644 apps/language_server/lib/language_server/experimental/source_file/document.ex delete mode 100644 apps/language_server/lib/language_server/experimental/source_file/line.ex delete mode 100644 apps/language_server/lib/language_server/experimental/source_file/line_parser.ex delete mode 100644 apps/language_server/lib/language_server/experimental/source_file/position.ex delete mode 100644 apps/language_server/lib/language_server/experimental/source_file/range.ex delete mode 100644 apps/language_server/lib/language_server/experimental/source_file/store.ex delete mode 100644 apps/language_server/lib/language_server/experimental/supervisor.ex delete mode 100644 apps/language_server/lib/language_server/packet_router.ex delete mode 100644 apps/language_server/lib/language_server/server/decider.ex delete mode 100644 apps/language_server/lib/mix/tasks/lsp/data_model.ex delete mode 100644 apps/language_server/lib/mix/tasks/lsp/data_model/enumeration.ex delete mode 100644 apps/language_server/lib/mix/tasks/lsp/data_model/notification.ex delete mode 100644 apps/language_server/lib/mix/tasks/lsp/data_model/property.ex delete mode 100644 apps/language_server/lib/mix/tasks/lsp/data_model/request.ex delete mode 100644 apps/language_server/lib/mix/tasks/lsp/data_model/structure.ex delete mode 100644 apps/language_server/lib/mix/tasks/lsp/data_model/type.ex delete mode 100644 apps/language_server/lib/mix/tasks/lsp/data_model/type_alias.ex delete mode 100644 apps/language_server/lib/mix/tasks/lsp/mappings.ex delete mode 100644 apps/language_server/lib/mix/tasks/lsp/mappings/generate.ex delete mode 100644 apps/language_server/lib/mix/tasks/lsp/mappings/init.ex delete mode 100644 apps/language_server/lib/mix/tasks/lsp/mappings/numbering_context.ex delete mode 100644 apps/language_server/lib/mix/tasks/lsp/mappings/print.ex delete mode 100644 apps/language_server/lib/mix/tasks/lsp/metamodel.3.17.json delete mode 100644 apps/language_server/lib/mix/tasks/lsp/type_mappings.json delete mode 100644 apps/language_server/test/experimental/code_mod/diff_test.exs delete mode 100644 apps/language_server/test/experimental/code_mod/format_test.exs delete mode 100644 apps/language_server/test/experimental/code_mod/replace_with_underscore_test.exs delete mode 100644 apps/language_server/test/experimental/code_unit_test.exs delete mode 100644 apps/language_server/test/experimental/document_test.exs delete mode 100644 apps/language_server/test/experimental/line_parser_test.exs delete mode 100644 apps/language_server/test/experimental/process_cache_test.exs delete mode 100644 apps/language_server/test/experimental/project_test.exs delete mode 100644 apps/language_server/test/experimental/protocol/notifications_test.exs delete mode 100644 apps/language_server/test/experimental/protocol/proto_test.exs delete mode 100644 apps/language_server/test/experimental/protocol/requests_test.exs delete mode 100644 apps/language_server/test/experimental/provider/code_action/#warning_parser.ex# delete mode 100644 apps/language_server/test/experimental/provider/code_action/replace_remote_function_test.exs delete mode 100644 apps/language_server/test/experimental/provider/code_action/replace_with_underscore_test.exs delete mode 100644 apps/language_server/test/experimental/provider/handlers/find_references_test.exs delete mode 100644 apps/language_server/test/experimental/provider/handlers/formatting_test.exs delete mode 100644 apps/language_server/test/experimental/provider/handlers/goto_definition_test.exs delete mode 100644 apps/language_server/test/experimental/provider/queue_test.exs delete mode 100644 apps/language_server/test/experimental/server/configuration_test.exs delete mode 100644 apps/language_server/test/experimental/server/state_test.exs delete mode 100644 apps/language_server/test/experimental/source_file/conversions_test.exs delete mode 100644 apps/language_server/test/experimental/source_file/store_test.exs delete mode 100644 apps/language_server/test/experimental/source_file_test.exs delete mode 100644 apps/language_server/test/support/experimental/code_mod/code_mod_case.ex diff --git a/.dialyzer_ignore.exs b/.dialyzer_ignore.exs index 29cc44ca2..06e7bd3e7 100644 --- a/.dialyzer_ignore.exs +++ b/.dialyzer_ignore.exs @@ -1,5 +1,4 @@ [ {"lib/launch.ex", :unknown_function}, - {"lib/language_server/providers/execute_command/restart.ex", :no_return}, - {"lib/language_server/experimental/protocol/proto.ex", :no_return} + {"lib/language_server/providers/execute_command/restart.ex", :no_return} ] diff --git a/apps/language_server/benchmarks/document_bench.exs b/apps/language_server/benchmarks/document_bench.exs deleted file mode 100644 index 7638e7c24..000000000 --- a/apps/language_server/benchmarks/document_bench.exs +++ /dev/null @@ -1,44 +0,0 @@ -alias ElixirLS.LanguageServer.Experimental.SourceFile.Document -file_generator = StreamData.string(:alphanumeric, min_size: 10, max_size: 120) - -line_endings = ["\r", "\n", "\r\n"] - -generate_lines = fn line_count -> - :alphanumeric - |> StreamData.string(min_size: 10, max_size: 120) - |> Enum.take(line_count) -end - -Benchee.run( - %{ - "String.split |> Enum.at" => fn %{text: text, count: count} -> - text - |> String.split(line_endings) - |> Enum.at(count - 1) - end, - "Enum.at" => fn %{lines: lines, count: count} -> - Enum.at(lines, count - 1) - end, - "Document" => fn %{document: doc, count: count} -> - {:ok, _} = Document.fetch_line(doc, count - 1) - end, - "Document.new |> Document.fetch_line" => fn %{text: text, count: count} -> - text - |> Document.new() - |> Document.fetch_line(count) - end - }, - inputs: - Map.new([80, 500, 1500], fn count -> - lines = generate_lines.(count) - text = Enum.join(lines, Enum.random(line_endings)) - - {"#{count} lines", - %{ - lines: lines, - document: Document.new(text), - text: text, - count: count - }} - end) -) diff --git a/apps/language_server/benchmarks/line_parser_bench.exs b/apps/language_server/benchmarks/line_parser_bench.exs deleted file mode 100644 index 8a7830345..000000000 --- a/apps/language_server/benchmarks/line_parser_bench.exs +++ /dev/null @@ -1,26 +0,0 @@ -alias ElixirLS.LanguageServer.SourceFile -alias ElixirLS.LanguageServer.Experimental.SourceFile.LineParser - -line_endings = ["\r", "\n", "\r\n"] - -generate_file = fn line_count -> - :alphanumeric - |> StreamData.string(min_size: 10, max_size: 120) - |> Enum.take(line_count) - |> Enum.join(Enum.random(line_endings)) -end - -large_file = generate_file.(500) - -Benchee.run( - %{ - "SourceFile.lines" => &SourceFile.lines/1, - "SourceFile.lines_with_endings/1" => &SourceFile.lines_with_endings/1, - "LineParser.parse" => &LineParser.parse(&1, 1) - }, - inputs: %{ - "80 lines" => generate_file.(80), - "500 lines" => generate_file.(500), - "1500 lines" => generate_file.(1500) - } -) diff --git a/apps/language_server/lib/generated/lsp/types/call_hierarchy/client_capabilities.ex b/apps/language_server/lib/generated/lsp/types/call_hierarchy/client_capabilities.ex deleted file mode 100644 index 2ee0e2e61..000000000 --- a/apps/language_server/lib/generated/lsp/types/call_hierarchy/client_capabilities.ex +++ /dev/null @@ -1,6 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.CallHierarchy.ClientCapabilities do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - use Proto - deftype dynamic_registration: optional(boolean()) -end diff --git a/apps/language_server/lib/generated/lsp/types/change_annotation.ex b/apps/language_server/lib/generated/lsp/types/change_annotation.ex deleted file mode 100644 index 4935b7107..000000000 --- a/apps/language_server/lib/generated/lsp/types/change_annotation.ex +++ /dev/null @@ -1,9 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.ChangeAnnotation do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - use Proto - - deftype description: optional(string()), - label: string(), - needs_confirmation: optional(boolean()) -end diff --git a/apps/language_server/lib/generated/lsp/types/client_capabilities.ex b/apps/language_server/lib/generated/lsp/types/client_capabilities.ex deleted file mode 100644 index 741a62dc3..000000000 --- a/apps/language_server/lib/generated/lsp/types/client_capabilities.ex +++ /dev/null @@ -1,13 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.ClientCapabilities do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - alias LSP.Types - use Proto - - deftype experimental: optional(any()), - general: optional(Types.General.ClientCapabilities), - notebook_document: optional(Types.Notebook.Document.ClientCapabilities), - text_document: optional(Types.TextDocument.ClientCapabilities), - window: optional(Types.Window.ClientCapabilities), - workspace: optional(Types.Workspace.ClientCapabilities) -end diff --git a/apps/language_server/lib/generated/lsp/types/code_action.ex b/apps/language_server/lib/generated/lsp/types/code_action.ex deleted file mode 100644 index 7e5e0bd56..000000000 --- a/apps/language_server/lib/generated/lsp/types/code_action.ex +++ /dev/null @@ -1,21 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.CodeAction do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - alias LSP.Types - - defmodule Disabled do - use Proto - deftype reason: string() - end - - use Proto - - deftype command: optional(Types.Command), - data: optional(any()), - diagnostics: optional(list_of(Types.Diagnostic)), - disabled: optional(Disabled), - edit: optional(Types.Workspace.Edit), - is_preferred: optional(boolean()), - kind: optional(Types.CodeAction.Kind), - title: string() -end diff --git a/apps/language_server/lib/generated/lsp/types/code_action/client_capabilities.ex b/apps/language_server/lib/generated/lsp/types/code_action/client_capabilities.ex deleted file mode 100644 index 34e17bc50..000000000 --- a/apps/language_server/lib/generated/lsp/types/code_action/client_capabilities.ex +++ /dev/null @@ -1,30 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.CodeAction.ClientCapabilities do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - alias LSP.Types - - defmodule CodeActionKind do - use Proto - deftype value_set: list_of(Types.CodeAction.Kind) - end - - defmodule CodeActionLiteralSupport do - use Proto - deftype code_action_kind: CodeActionKind - end - - defmodule ResolveSupport do - use Proto - deftype properties: list_of(string()) - end - - use Proto - - deftype code_action_literal_support: optional(CodeActionLiteralSupport), - data_support: optional(boolean()), - disabled_support: optional(boolean()), - dynamic_registration: optional(boolean()), - honors_change_annotations: optional(boolean()), - is_preferred_support: optional(boolean()), - resolve_support: optional(ResolveSupport) -end diff --git a/apps/language_server/lib/generated/lsp/types/code_action/context.ex b/apps/language_server/lib/generated/lsp/types/code_action/context.ex deleted file mode 100644 index a5b7365bb..000000000 --- a/apps/language_server/lib/generated/lsp/types/code_action/context.ex +++ /dev/null @@ -1,10 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.CodeAction.Context do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - alias LSP.Types - use Proto - - deftype diagnostics: list_of(Types.Diagnostic), - only: optional(list_of(Types.CodeAction.Kind)), - trigger_kind: optional(Types.CodeAction.Trigger.Kind) -end diff --git a/apps/language_server/lib/generated/lsp/types/code_action/kind.ex b/apps/language_server/lib/generated/lsp/types/code_action/kind.ex deleted file mode 100644 index 6ba99220e..000000000 --- a/apps/language_server/lib/generated/lsp/types/code_action/kind.ex +++ /dev/null @@ -1,15 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.CodeAction.Kind do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - use Proto - - defenum empty: "", - quick_fix: "quickfix", - refactor: "refactor", - refactor_extract: "refactor.extract", - refactor_inline: "refactor.inline", - refactor_rewrite: "refactor.rewrite", - source: "source", - source_organize_imports: "source.organizeImports", - source_fix_all: "source.fixAll" -end diff --git a/apps/language_server/lib/generated/lsp/types/code_action/params.ex b/apps/language_server/lib/generated/lsp/types/code_action/params.ex deleted file mode 100644 index 1f08c3662..000000000 --- a/apps/language_server/lib/generated/lsp/types/code_action/params.ex +++ /dev/null @@ -1,12 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.CodeAction.Params do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - alias LSP.Types - use Proto - - deftype context: Types.CodeAction.Context, - partial_result_token: optional(Types.Progress.Token), - range: Types.Range, - text_document: Types.TextDocument.Identifier, - work_done_token: optional(Types.Progress.Token) -end diff --git a/apps/language_server/lib/generated/lsp/types/code_action/trigger/kind.ex b/apps/language_server/lib/generated/lsp/types/code_action/trigger/kind.ex deleted file mode 100644 index 98c7e323b..000000000 --- a/apps/language_server/lib/generated/lsp/types/code_action/trigger/kind.ex +++ /dev/null @@ -1,6 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.CodeAction.Trigger.Kind do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - use Proto - defenum invoked: 1, automatic: 2 -end diff --git a/apps/language_server/lib/generated/lsp/types/code_description.ex b/apps/language_server/lib/generated/lsp/types/code_description.ex deleted file mode 100644 index f045d64db..000000000 --- a/apps/language_server/lib/generated/lsp/types/code_description.ex +++ /dev/null @@ -1,6 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.CodeDescription do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - use Proto - deftype href: string() -end diff --git a/apps/language_server/lib/generated/lsp/types/code_lens/client_capabilities.ex b/apps/language_server/lib/generated/lsp/types/code_lens/client_capabilities.ex deleted file mode 100644 index 90597789f..000000000 --- a/apps/language_server/lib/generated/lsp/types/code_lens/client_capabilities.ex +++ /dev/null @@ -1,6 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.CodeLens.ClientCapabilities do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - use Proto - deftype dynamic_registration: optional(boolean()) -end diff --git a/apps/language_server/lib/generated/lsp/types/code_lens/workspace/client_capabilities.ex b/apps/language_server/lib/generated/lsp/types/code_lens/workspace/client_capabilities.ex deleted file mode 100644 index e56b300ce..000000000 --- a/apps/language_server/lib/generated/lsp/types/code_lens/workspace/client_capabilities.ex +++ /dev/null @@ -1,6 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.CodeLens.Workspace.ClientCapabilities do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - use Proto - deftype refresh_support: optional(boolean()) -end diff --git a/apps/language_server/lib/generated/lsp/types/command.ex b/apps/language_server/lib/generated/lsp/types/command.ex deleted file mode 100644 index d1a323e6e..000000000 --- a/apps/language_server/lib/generated/lsp/types/command.ex +++ /dev/null @@ -1,6 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.Command do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - use Proto - deftype arguments: optional(list_of(any())), command: string(), title: string() -end diff --git a/apps/language_server/lib/generated/lsp/types/completion/client_capabilities.ex b/apps/language_server/lib/generated/lsp/types/completion/client_capabilities.ex deleted file mode 100644 index f608e4d09..000000000 --- a/apps/language_server/lib/generated/lsp/types/completion/client_capabilities.ex +++ /dev/null @@ -1,54 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.Completion.ClientCapabilities do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - alias LSP.Types - - defmodule CompletionItem do - use Proto - - deftype commit_characters_support: optional(boolean()), - deprecated_support: optional(boolean()), - documentation_format: optional(list_of(Types.Markup.Kind)), - insert_replace_support: optional(boolean()), - insert_text_mode_support: optional(InsertTextModeSupport), - label_details_support: optional(boolean()), - preselect_support: optional(boolean()), - resolve_support: optional(ResolveSupport), - snippet_support: optional(boolean()), - tag_support: optional(TagSupport) - end - - defmodule CompletionItemKind do - use Proto - deftype value_set: optional(list_of(Types.Completion.Item.Kind)) - end - - defmodule CompletionList do - use Proto - deftype item_defaults: optional(list_of(string())) - end - - defmodule InsertTextModeSupport do - use Proto - deftype value_set: list_of(Types.InsertTextMode) - end - - defmodule ResolveSupport do - use Proto - deftype properties: list_of(string()) - end - - defmodule TagSupport do - use Proto - deftype value_set: list_of(Types.Completion.Item.Tag) - end - - use Proto - - deftype completion_item: optional(CompletionItem), - completion_item_kind: optional(CompletionItemKind), - completion_list: optional(CompletionList), - context_support: optional(boolean()), - dynamic_registration: optional(boolean()), - insert_text_mode: optional(Types.InsertTextMode) -end diff --git a/apps/language_server/lib/generated/lsp/types/completion/item/kind.ex b/apps/language_server/lib/generated/lsp/types/completion/item/kind.ex deleted file mode 100644 index d50aaacf7..000000000 --- a/apps/language_server/lib/generated/lsp/types/completion/item/kind.ex +++ /dev/null @@ -1,31 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.Completion.Item.Kind do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - use Proto - - defenum text: 1, - method: 2, - function: 3, - constructor: 4, - field: 5, - variable: 6, - class: 7, - interface: 8, - module: 9, - property: 10, - unit: 11, - value: 12, - enum: 13, - keyword: 14, - snippet: 15, - color: 16, - file: 17, - reference: 18, - folder: 19, - enum_member: 20, - constant: 21, - struct: 22, - event: 23, - operator: 24, - type_parameter: 25 -end diff --git a/apps/language_server/lib/generated/lsp/types/completion/item/tag.ex b/apps/language_server/lib/generated/lsp/types/completion/item/tag.ex deleted file mode 100644 index 0b937457c..000000000 --- a/apps/language_server/lib/generated/lsp/types/completion/item/tag.ex +++ /dev/null @@ -1,6 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.Completion.Item.Tag do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - use Proto - defenum deprecated: 1 -end diff --git a/apps/language_server/lib/generated/lsp/types/create_file.ex b/apps/language_server/lib/generated/lsp/types/create_file.ex deleted file mode 100644 index 4b5c59320..000000000 --- a/apps/language_server/lib/generated/lsp/types/create_file.ex +++ /dev/null @@ -1,11 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.CreateFile do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - alias LSP.Types - use Proto - - deftype annotation_id: optional(Types.ChangeAnnotation.Identifier), - kind: literal("create"), - options: optional(Types.CreateFile.Options), - uri: string() -end diff --git a/apps/language_server/lib/generated/lsp/types/create_file/options.ex b/apps/language_server/lib/generated/lsp/types/create_file/options.ex deleted file mode 100644 index 30c55d069..000000000 --- a/apps/language_server/lib/generated/lsp/types/create_file/options.ex +++ /dev/null @@ -1,6 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.CreateFile.Options do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - use Proto - deftype ignore_if_exists: optional(boolean()), overwrite: optional(boolean()) -end diff --git a/apps/language_server/lib/generated/lsp/types/declaration/client_capabilities.ex b/apps/language_server/lib/generated/lsp/types/declaration/client_capabilities.ex deleted file mode 100644 index 0b97fb0bb..000000000 --- a/apps/language_server/lib/generated/lsp/types/declaration/client_capabilities.ex +++ /dev/null @@ -1,6 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.Declaration.ClientCapabilities do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - use Proto - deftype dynamic_registration: optional(boolean()), link_support: optional(boolean()) -end diff --git a/apps/language_server/lib/generated/lsp/types/definition/client_capabilities.ex b/apps/language_server/lib/generated/lsp/types/definition/client_capabilities.ex deleted file mode 100644 index e34501c15..000000000 --- a/apps/language_server/lib/generated/lsp/types/definition/client_capabilities.ex +++ /dev/null @@ -1,6 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.Definition.ClientCapabilities do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - use Proto - deftype dynamic_registration: optional(boolean()), link_support: optional(boolean()) -end diff --git a/apps/language_server/lib/generated/lsp/types/delete_file.ex b/apps/language_server/lib/generated/lsp/types/delete_file.ex deleted file mode 100644 index 7cd4d71cb..000000000 --- a/apps/language_server/lib/generated/lsp/types/delete_file.ex +++ /dev/null @@ -1,11 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.DeleteFile do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - alias LSP.Types - use Proto - - deftype annotation_id: optional(Types.ChangeAnnotation.Identifier), - kind: literal("delete"), - options: optional(Types.DeleteFile.Options), - uri: string() -end diff --git a/apps/language_server/lib/generated/lsp/types/delete_file/options.ex b/apps/language_server/lib/generated/lsp/types/delete_file/options.ex deleted file mode 100644 index 89a2cf652..000000000 --- a/apps/language_server/lib/generated/lsp/types/delete_file/options.ex +++ /dev/null @@ -1,6 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.DeleteFile.Options do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - use Proto - deftype ignore_if_not_exists: optional(boolean()), recursive: optional(boolean()) -end diff --git a/apps/language_server/lib/generated/lsp/types/diagnostic.ex b/apps/language_server/lib/generated/lsp/types/diagnostic.ex deleted file mode 100644 index 0cc559b74..000000000 --- a/apps/language_server/lib/generated/lsp/types/diagnostic.ex +++ /dev/null @@ -1,16 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.Diagnostic do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - alias LSP.Types - use Proto - - deftype code: optional(one_of([integer(), string()])), - code_description: optional(Types.CodeDescription), - data: optional(any()), - message: string(), - range: Types.Range, - related_information: optional(list_of(Types.Diagnostic.RelatedInformation)), - severity: optional(Types.Diagnostic.Severity), - source: optional(string()), - tags: optional(list_of(Types.Diagnostic.Tag)) -end diff --git a/apps/language_server/lib/generated/lsp/types/diagnostic/client_capabilities.ex b/apps/language_server/lib/generated/lsp/types/diagnostic/client_capabilities.ex deleted file mode 100644 index 55f41f7cb..000000000 --- a/apps/language_server/lib/generated/lsp/types/diagnostic/client_capabilities.ex +++ /dev/null @@ -1,6 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.Diagnostic.ClientCapabilities do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - use Proto - deftype dynamic_registration: optional(boolean()), related_document_support: optional(boolean()) -end diff --git a/apps/language_server/lib/generated/lsp/types/diagnostic/related_information.ex b/apps/language_server/lib/generated/lsp/types/diagnostic/related_information.ex deleted file mode 100644 index f2b96eccf..000000000 --- a/apps/language_server/lib/generated/lsp/types/diagnostic/related_information.ex +++ /dev/null @@ -1,7 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.Diagnostic.RelatedInformation do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - alias LSP.Types - use Proto - deftype location: Types.Location, message: string() -end diff --git a/apps/language_server/lib/generated/lsp/types/diagnostic/severity.ex b/apps/language_server/lib/generated/lsp/types/diagnostic/severity.ex deleted file mode 100644 index 343ac6904..000000000 --- a/apps/language_server/lib/generated/lsp/types/diagnostic/severity.ex +++ /dev/null @@ -1,6 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.Diagnostic.Severity do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - use Proto - defenum error: 1, warning: 2, information: 3, hint: 4 -end diff --git a/apps/language_server/lib/generated/lsp/types/diagnostic/tag.ex b/apps/language_server/lib/generated/lsp/types/diagnostic/tag.ex deleted file mode 100644 index 413e71a42..000000000 --- a/apps/language_server/lib/generated/lsp/types/diagnostic/tag.ex +++ /dev/null @@ -1,6 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.Diagnostic.Tag do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - use Proto - defenum unnecessary: 1, deprecated: 2 -end diff --git a/apps/language_server/lib/generated/lsp/types/diagnostic/workspace/client_capabilities.ex b/apps/language_server/lib/generated/lsp/types/diagnostic/workspace/client_capabilities.ex deleted file mode 100644 index c1f9b614c..000000000 --- a/apps/language_server/lib/generated/lsp/types/diagnostic/workspace/client_capabilities.ex +++ /dev/null @@ -1,6 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.Diagnostic.Workspace.ClientCapabilities do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - use Proto - deftype refresh_support: optional(boolean()) -end diff --git a/apps/language_server/lib/generated/lsp/types/did_change_configuration/client_capabilities.ex b/apps/language_server/lib/generated/lsp/types/did_change_configuration/client_capabilities.ex deleted file mode 100644 index d3836222e..000000000 --- a/apps/language_server/lib/generated/lsp/types/did_change_configuration/client_capabilities.ex +++ /dev/null @@ -1,6 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.DidChangeConfiguration.ClientCapabilities do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - use Proto - deftype dynamic_registration: optional(boolean()) -end diff --git a/apps/language_server/lib/generated/lsp/types/did_change_watched_files/client_capabilities.ex b/apps/language_server/lib/generated/lsp/types/did_change_watched_files/client_capabilities.ex deleted file mode 100644 index 8b496b254..000000000 --- a/apps/language_server/lib/generated/lsp/types/did_change_watched_files/client_capabilities.ex +++ /dev/null @@ -1,6 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.DidChangeWatchedFiles.ClientCapabilities do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - use Proto - deftype dynamic_registration: optional(boolean()), relative_pattern_support: optional(boolean()) -end diff --git a/apps/language_server/lib/generated/lsp/types/document/color/client_capabilities.ex b/apps/language_server/lib/generated/lsp/types/document/color/client_capabilities.ex deleted file mode 100644 index ca50b3e3f..000000000 --- a/apps/language_server/lib/generated/lsp/types/document/color/client_capabilities.ex +++ /dev/null @@ -1,6 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.Document.Color.ClientCapabilities do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - use Proto - deftype dynamic_registration: optional(boolean()) -end diff --git a/apps/language_server/lib/generated/lsp/types/document/formatting/client_capabilities.ex b/apps/language_server/lib/generated/lsp/types/document/formatting/client_capabilities.ex deleted file mode 100644 index 6fcbdcf0b..000000000 --- a/apps/language_server/lib/generated/lsp/types/document/formatting/client_capabilities.ex +++ /dev/null @@ -1,6 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.Document.Formatting.ClientCapabilities do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - use Proto - deftype dynamic_registration: optional(boolean()) -end diff --git a/apps/language_server/lib/generated/lsp/types/document/formatting/options.ex b/apps/language_server/lib/generated/lsp/types/document/formatting/options.ex deleted file mode 100644 index 9f66f4d90..000000000 --- a/apps/language_server/lib/generated/lsp/types/document/formatting/options.ex +++ /dev/null @@ -1,6 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.Document.Formatting.Options do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - use Proto - deftype work_done_progress: optional(boolean()) -end diff --git a/apps/language_server/lib/generated/lsp/types/document/formatting/params.ex b/apps/language_server/lib/generated/lsp/types/document/formatting/params.ex deleted file mode 100644 index c94afb982..000000000 --- a/apps/language_server/lib/generated/lsp/types/document/formatting/params.ex +++ /dev/null @@ -1,10 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.Document.Formatting.Params do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - alias LSP.Types - use Proto - - deftype options: Types.Formatting.Options, - text_document: Types.TextDocument.Identifier, - work_done_token: optional(Types.Progress.Token) -end diff --git a/apps/language_server/lib/generated/lsp/types/document/highlight/client_capabilities.ex b/apps/language_server/lib/generated/lsp/types/document/highlight/client_capabilities.ex deleted file mode 100644 index 08bb36b0b..000000000 --- a/apps/language_server/lib/generated/lsp/types/document/highlight/client_capabilities.ex +++ /dev/null @@ -1,6 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.Document.Highlight.ClientCapabilities do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - use Proto - deftype dynamic_registration: optional(boolean()) -end diff --git a/apps/language_server/lib/generated/lsp/types/document/link/client_capabilities.ex b/apps/language_server/lib/generated/lsp/types/document/link/client_capabilities.ex deleted file mode 100644 index c5c535316..000000000 --- a/apps/language_server/lib/generated/lsp/types/document/link/client_capabilities.ex +++ /dev/null @@ -1,6 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.Document.Link.ClientCapabilities do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - use Proto - deftype dynamic_registration: optional(boolean()), tooltip_support: optional(boolean()) -end diff --git a/apps/language_server/lib/generated/lsp/types/document/on_type_formatting/client_capabilities.ex b/apps/language_server/lib/generated/lsp/types/document/on_type_formatting/client_capabilities.ex deleted file mode 100644 index b47c209da..000000000 --- a/apps/language_server/lib/generated/lsp/types/document/on_type_formatting/client_capabilities.ex +++ /dev/null @@ -1,6 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.Document.OnTypeFormatting.ClientCapabilities do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - use Proto - deftype dynamic_registration: optional(boolean()) -end diff --git a/apps/language_server/lib/generated/lsp/types/document/range_formatting/client_capabilities.ex b/apps/language_server/lib/generated/lsp/types/document/range_formatting/client_capabilities.ex deleted file mode 100644 index 919535640..000000000 --- a/apps/language_server/lib/generated/lsp/types/document/range_formatting/client_capabilities.ex +++ /dev/null @@ -1,6 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.Document.RangeFormatting.ClientCapabilities do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - use Proto - deftype dynamic_registration: optional(boolean()) -end diff --git a/apps/language_server/lib/generated/lsp/types/document/symbol/client_capabilities.ex b/apps/language_server/lib/generated/lsp/types/document/symbol/client_capabilities.ex deleted file mode 100644 index 44b4fe6a8..000000000 --- a/apps/language_server/lib/generated/lsp/types/document/symbol/client_capabilities.ex +++ /dev/null @@ -1,23 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.Document.Symbol.ClientCapabilities do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - alias LSP.Types - - defmodule SymbolKind do - use Proto - deftype value_set: optional(list_of(Types.Symbol.Kind)) - end - - defmodule TagSupport do - use Proto - deftype value_set: list_of(Types.Symbol.Tag) - end - - use Proto - - deftype dynamic_registration: optional(boolean()), - hierarchical_document_symbol_support: optional(boolean()), - label_support: optional(boolean()), - symbol_kind: optional(SymbolKind), - tag_support: optional(TagSupport) -end diff --git a/apps/language_server/lib/generated/lsp/types/execute_command/client_capabilities.ex b/apps/language_server/lib/generated/lsp/types/execute_command/client_capabilities.ex deleted file mode 100644 index 756eb234a..000000000 --- a/apps/language_server/lib/generated/lsp/types/execute_command/client_capabilities.ex +++ /dev/null @@ -1,6 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.ExecuteCommand.ClientCapabilities do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - use Proto - deftype dynamic_registration: optional(boolean()) -end diff --git a/apps/language_server/lib/generated/lsp/types/failure_handling/kind.ex b/apps/language_server/lib/generated/lsp/types/failure_handling/kind.ex deleted file mode 100644 index 39f8c417d..000000000 --- a/apps/language_server/lib/generated/lsp/types/failure_handling/kind.ex +++ /dev/null @@ -1,10 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.FailureHandling.Kind do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - use Proto - - defenum abort: "abort", - transactional: "transactional", - text_only_transactional: "textOnlyTransactional", - undo: "undo" -end diff --git a/apps/language_server/lib/generated/lsp/types/file_operation/client_capabilities.ex b/apps/language_server/lib/generated/lsp/types/file_operation/client_capabilities.ex deleted file mode 100644 index 7822d9642..000000000 --- a/apps/language_server/lib/generated/lsp/types/file_operation/client_capabilities.ex +++ /dev/null @@ -1,13 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.FileOperation.ClientCapabilities do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - use Proto - - deftype did_create: optional(boolean()), - did_delete: optional(boolean()), - did_rename: optional(boolean()), - dynamic_registration: optional(boolean()), - will_create: optional(boolean()), - will_delete: optional(boolean()), - will_rename: optional(boolean()) -end diff --git a/apps/language_server/lib/generated/lsp/types/folding_range/client_capabilities.ex b/apps/language_server/lib/generated/lsp/types/folding_range/client_capabilities.ex deleted file mode 100644 index a3dca94a2..000000000 --- a/apps/language_server/lib/generated/lsp/types/folding_range/client_capabilities.ex +++ /dev/null @@ -1,23 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.FoldingRange.ClientCapabilities do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - alias LSP.Types - - defmodule FoldingRange do - use Proto - deftype collapsed_text: optional(boolean()) - end - - defmodule FoldingRangeKind do - use Proto - deftype value_set: optional(list_of(Types.FoldingRange.Kind)) - end - - use Proto - - deftype dynamic_registration: optional(boolean()), - folding_range: optional(FoldingRange), - folding_range_kind: optional(FoldingRangeKind), - line_folding_only: optional(boolean()), - range_limit: optional(integer()) -end diff --git a/apps/language_server/lib/generated/lsp/types/folding_range/kind.ex b/apps/language_server/lib/generated/lsp/types/folding_range/kind.ex deleted file mode 100644 index d5e6f547d..000000000 --- a/apps/language_server/lib/generated/lsp/types/folding_range/kind.ex +++ /dev/null @@ -1,6 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.FoldingRange.Kind do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - use Proto - defenum comment: "comment", imports: "imports", region: "region" -end diff --git a/apps/language_server/lib/generated/lsp/types/formatting/options.ex b/apps/language_server/lib/generated/lsp/types/formatting/options.ex deleted file mode 100644 index 7821dcf7d..000000000 --- a/apps/language_server/lib/generated/lsp/types/formatting/options.ex +++ /dev/null @@ -1,11 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.Formatting.Options do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - use Proto - - deftype insert_final_newline: optional(boolean()), - insert_spaces: boolean(), - tab_size: integer(), - trim_final_newlines: optional(boolean()), - trim_trailing_whitespace: optional(boolean()) -end diff --git a/apps/language_server/lib/generated/lsp/types/general/client_capabilities.ex b/apps/language_server/lib/generated/lsp/types/general/client_capabilities.ex deleted file mode 100644 index 58edba1b0..000000000 --- a/apps/language_server/lib/generated/lsp/types/general/client_capabilities.ex +++ /dev/null @@ -1,17 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.General.ClientCapabilities do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - alias LSP.Types - - defmodule StaleRequestSupport do - use Proto - deftype cancel: boolean(), retry_on_content_modified: list_of(string()) - end - - use Proto - - deftype markdown: optional(Types.Markdown.ClientCapabilities), - position_encodings: optional(list_of(Types.Position.Encoding.Kind)), - regular_expressions: optional(Types.RegularExpressions.ClientCapabilities), - stale_request_support: optional(StaleRequestSupport) -end diff --git a/apps/language_server/lib/generated/lsp/types/hover/client_capabilities.ex b/apps/language_server/lib/generated/lsp/types/hover/client_capabilities.ex deleted file mode 100644 index 5a238681a..000000000 --- a/apps/language_server/lib/generated/lsp/types/hover/client_capabilities.ex +++ /dev/null @@ -1,9 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.Hover.ClientCapabilities do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - alias LSP.Types - use Proto - - deftype content_format: optional(list_of(Types.Markup.Kind)), - dynamic_registration: optional(boolean()) -end diff --git a/apps/language_server/lib/generated/lsp/types/implementation/client_capabilities.ex b/apps/language_server/lib/generated/lsp/types/implementation/client_capabilities.ex deleted file mode 100644 index fa14c7acf..000000000 --- a/apps/language_server/lib/generated/lsp/types/implementation/client_capabilities.ex +++ /dev/null @@ -1,6 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.Implementation.ClientCapabilities do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - use Proto - deftype dynamic_registration: optional(boolean()), link_support: optional(boolean()) -end diff --git a/apps/language_server/lib/generated/lsp/types/initialize/params.ex b/apps/language_server/lib/generated/lsp/types/initialize/params.ex deleted file mode 100644 index d50bf9004..000000000 --- a/apps/language_server/lib/generated/lsp/types/initialize/params.ex +++ /dev/null @@ -1,26 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.Initialize.Params do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - alias LSP.Types - - defmodule ClientInfo1 do - use Proto - deftype name: string(), version: optional(string()) - end - - use Proto - - deftype capabilities: Types.ClientCapabilities, - client_info: optional(ClientInfo1), - initialization_options: optional(any()), - locale: optional(string()), - process_id: one_of([integer(), nil]), - root_path: optional(one_of([string(), nil])), - root_uri: one_of([string(), nil]), - trace: - optional( - one_of([literal("off"), literal("messages"), literal("compact"), literal("verbose")]) - ), - work_done_token: optional(Types.Progress.Token), - workspace_folders: optional(one_of([list_of(Types.Workspace.Folder), nil])) -end diff --git a/apps/language_server/lib/generated/lsp/types/inlay_hint/client_capabilities.ex b/apps/language_server/lib/generated/lsp/types/inlay_hint/client_capabilities.ex deleted file mode 100644 index 72355d046..000000000 --- a/apps/language_server/lib/generated/lsp/types/inlay_hint/client_capabilities.ex +++ /dev/null @@ -1,12 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.InlayHint.ClientCapabilities do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - - defmodule ResolveSupport do - use Proto - deftype properties: list_of(string()) - end - - use Proto - deftype dynamic_registration: optional(boolean()), resolve_support: optional(ResolveSupport) -end diff --git a/apps/language_server/lib/generated/lsp/types/inlay_hint_workspace/client_capabilities.ex b/apps/language_server/lib/generated/lsp/types/inlay_hint_workspace/client_capabilities.ex deleted file mode 100644 index e3137b4d8..000000000 --- a/apps/language_server/lib/generated/lsp/types/inlay_hint_workspace/client_capabilities.ex +++ /dev/null @@ -1,6 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.InlayHintWorkspace.ClientCapabilities do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - use Proto - deftype refresh_support: optional(boolean()) -end diff --git a/apps/language_server/lib/generated/lsp/types/inline_value/client_capabilities.ex b/apps/language_server/lib/generated/lsp/types/inline_value/client_capabilities.ex deleted file mode 100644 index 1dfe6db89..000000000 --- a/apps/language_server/lib/generated/lsp/types/inline_value/client_capabilities.ex +++ /dev/null @@ -1,6 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.InlineValue.ClientCapabilities do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - use Proto - deftype dynamic_registration: optional(boolean()) -end diff --git a/apps/language_server/lib/generated/lsp/types/inline_value/workspace/client_capabilities.ex b/apps/language_server/lib/generated/lsp/types/inline_value/workspace/client_capabilities.ex deleted file mode 100644 index 99a37e6c5..000000000 --- a/apps/language_server/lib/generated/lsp/types/inline_value/workspace/client_capabilities.ex +++ /dev/null @@ -1,6 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.InlineValue.Workspace.ClientCapabilities do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - use Proto - deftype refresh_support: optional(boolean()) -end diff --git a/apps/language_server/lib/generated/lsp/types/insert_text_mode.ex b/apps/language_server/lib/generated/lsp/types/insert_text_mode.ex deleted file mode 100644 index 8b88bd73c..000000000 --- a/apps/language_server/lib/generated/lsp/types/insert_text_mode.ex +++ /dev/null @@ -1,6 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.InsertTextMode do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - use Proto - defenum as_is: 1, adjust_indentation: 2 -end diff --git a/apps/language_server/lib/generated/lsp/types/linked_editing_range/client_capabilities.ex b/apps/language_server/lib/generated/lsp/types/linked_editing_range/client_capabilities.ex deleted file mode 100644 index 2b616f991..000000000 --- a/apps/language_server/lib/generated/lsp/types/linked_editing_range/client_capabilities.ex +++ /dev/null @@ -1,6 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.LinkedEditingRange.ClientCapabilities do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - use Proto - deftype dynamic_registration: optional(boolean()) -end diff --git a/apps/language_server/lib/generated/lsp/types/location.ex b/apps/language_server/lib/generated/lsp/types/location.ex deleted file mode 100644 index 42494f554..000000000 --- a/apps/language_server/lib/generated/lsp/types/location.ex +++ /dev/null @@ -1,7 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.Location do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - alias LSP.Types - use Proto - deftype range: Types.Range, uri: string() -end diff --git a/apps/language_server/lib/generated/lsp/types/markdown/client_capabilities.ex b/apps/language_server/lib/generated/lsp/types/markdown/client_capabilities.ex deleted file mode 100644 index 9770f9231..000000000 --- a/apps/language_server/lib/generated/lsp/types/markdown/client_capabilities.ex +++ /dev/null @@ -1,6 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.Markdown.ClientCapabilities do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - use Proto - deftype allowed_tags: optional(list_of(string())), parser: string(), version: optional(string()) -end diff --git a/apps/language_server/lib/generated/lsp/types/markup/kind.ex b/apps/language_server/lib/generated/lsp/types/markup/kind.ex deleted file mode 100644 index de6612767..000000000 --- a/apps/language_server/lib/generated/lsp/types/markup/kind.ex +++ /dev/null @@ -1,6 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.Markup.Kind do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - use Proto - defenum plain_text: "plaintext", markdown: "markdown" -end diff --git a/apps/language_server/lib/generated/lsp/types/moniker/client_capabilities.ex b/apps/language_server/lib/generated/lsp/types/moniker/client_capabilities.ex deleted file mode 100644 index 6041a6d83..000000000 --- a/apps/language_server/lib/generated/lsp/types/moniker/client_capabilities.ex +++ /dev/null @@ -1,6 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.Moniker.ClientCapabilities do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - use Proto - deftype dynamic_registration: optional(boolean()) -end diff --git a/apps/language_server/lib/generated/lsp/types/notebook/document/client_capabilities.ex b/apps/language_server/lib/generated/lsp/types/notebook/document/client_capabilities.ex deleted file mode 100644 index f29842c42..000000000 --- a/apps/language_server/lib/generated/lsp/types/notebook/document/client_capabilities.ex +++ /dev/null @@ -1,7 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.Notebook.Document.ClientCapabilities do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - alias LSP.Types - use Proto - deftype synchronization: Types.Notebook.Document.Sync.ClientCapabilities -end diff --git a/apps/language_server/lib/generated/lsp/types/notebook/document/sync/client_capabilities.ex b/apps/language_server/lib/generated/lsp/types/notebook/document/sync/client_capabilities.ex deleted file mode 100644 index ff6084ac8..000000000 --- a/apps/language_server/lib/generated/lsp/types/notebook/document/sync/client_capabilities.ex +++ /dev/null @@ -1,8 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.Notebook.Document.Sync.ClientCapabilities do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - use Proto - - deftype dynamic_registration: optional(boolean()), - execution_summary_support: optional(boolean()) -end diff --git a/apps/language_server/lib/generated/lsp/types/position.ex b/apps/language_server/lib/generated/lsp/types/position.ex deleted file mode 100644 index 60a865ab9..000000000 --- a/apps/language_server/lib/generated/lsp/types/position.ex +++ /dev/null @@ -1,6 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.Position do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - use Proto - deftype character: integer(), line: integer() -end diff --git a/apps/language_server/lib/generated/lsp/types/position/encoding/kind.ex b/apps/language_server/lib/generated/lsp/types/position/encoding/kind.ex deleted file mode 100644 index 55f7e9cb4..000000000 --- a/apps/language_server/lib/generated/lsp/types/position/encoding/kind.ex +++ /dev/null @@ -1,6 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.Position.Encoding.Kind do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - use Proto - defenum utf8: "utf-8", utf16: "utf-16", utf32: "utf-32" -end diff --git a/apps/language_server/lib/generated/lsp/types/prepare_support_default_behavior.ex b/apps/language_server/lib/generated/lsp/types/prepare_support_default_behavior.ex deleted file mode 100644 index 01556bce1..000000000 --- a/apps/language_server/lib/generated/lsp/types/prepare_support_default_behavior.ex +++ /dev/null @@ -1,6 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.PrepareSupportDefaultBehavior do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - use Proto - defenum identifier: 1 -end diff --git a/apps/language_server/lib/generated/lsp/types/progress/token.ex b/apps/language_server/lib/generated/lsp/types/progress/token.ex deleted file mode 100644 index df9c9a81e..000000000 --- a/apps/language_server/lib/generated/lsp/types/progress/token.ex +++ /dev/null @@ -1,6 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.Progress.Token do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - use Proto - defalias one_of([integer(), string()]) -end diff --git a/apps/language_server/lib/generated/lsp/types/publish_diagnostics/client_capabilities.ex b/apps/language_server/lib/generated/lsp/types/publish_diagnostics/client_capabilities.ex deleted file mode 100644 index 13883608d..000000000 --- a/apps/language_server/lib/generated/lsp/types/publish_diagnostics/client_capabilities.ex +++ /dev/null @@ -1,18 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.PublishDiagnostics.ClientCapabilities do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - alias LSP.Types - - defmodule TagSupport do - use Proto - deftype value_set: list_of(Types.Diagnostic.Tag) - end - - use Proto - - deftype code_description_support: optional(boolean()), - data_support: optional(boolean()), - related_information: optional(boolean()), - tag_support: optional(TagSupport), - version_support: optional(boolean()) -end diff --git a/apps/language_server/lib/generated/lsp/types/publish_diagnostics/params.ex b/apps/language_server/lib/generated/lsp/types/publish_diagnostics/params.ex deleted file mode 100644 index 9841481c1..000000000 --- a/apps/language_server/lib/generated/lsp/types/publish_diagnostics/params.ex +++ /dev/null @@ -1,7 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.PublishDiagnostics.Params do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - alias LSP.Types - use Proto - deftype diagnostics: list_of(Types.Diagnostic), uri: string(), version: optional(integer()) -end diff --git a/apps/language_server/lib/generated/lsp/types/range.ex b/apps/language_server/lib/generated/lsp/types/range.ex deleted file mode 100644 index c7c9ad7ee..000000000 --- a/apps/language_server/lib/generated/lsp/types/range.ex +++ /dev/null @@ -1,7 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.Range do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - alias LSP.Types - use Proto - deftype end: Types.Position, start: Types.Position -end diff --git a/apps/language_server/lib/generated/lsp/types/reference/client_capabilities.ex b/apps/language_server/lib/generated/lsp/types/reference/client_capabilities.ex deleted file mode 100644 index 6896551db..000000000 --- a/apps/language_server/lib/generated/lsp/types/reference/client_capabilities.ex +++ /dev/null @@ -1,6 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.Reference.ClientCapabilities do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - use Proto - deftype dynamic_registration: optional(boolean()) -end diff --git a/apps/language_server/lib/generated/lsp/types/registration.ex b/apps/language_server/lib/generated/lsp/types/registration.ex deleted file mode 100644 index fe5a9a305..000000000 --- a/apps/language_server/lib/generated/lsp/types/registration.ex +++ /dev/null @@ -1,6 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.Registration do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - use Proto - deftype id: string(), method: string(), register_options: optional(any()) -end diff --git a/apps/language_server/lib/generated/lsp/types/regular_expressions/client_capabilities.ex b/apps/language_server/lib/generated/lsp/types/regular_expressions/client_capabilities.ex deleted file mode 100644 index 597a1949b..000000000 --- a/apps/language_server/lib/generated/lsp/types/regular_expressions/client_capabilities.ex +++ /dev/null @@ -1,6 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.RegularExpressions.ClientCapabilities do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - use Proto - deftype engine: string(), version: optional(string()) -end diff --git a/apps/language_server/lib/generated/lsp/types/rename/client_capabilities.ex b/apps/language_server/lib/generated/lsp/types/rename/client_capabilities.ex deleted file mode 100644 index 05406e541..000000000 --- a/apps/language_server/lib/generated/lsp/types/rename/client_capabilities.ex +++ /dev/null @@ -1,11 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.Rename.ClientCapabilities do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - alias LSP.Types - use Proto - - deftype dynamic_registration: optional(boolean()), - honors_change_annotations: optional(boolean()), - prepare_support: optional(boolean()), - prepare_support_default_behavior: optional(Types.PrepareSupportDefaultBehavior) -end diff --git a/apps/language_server/lib/generated/lsp/types/rename_file.ex b/apps/language_server/lib/generated/lsp/types/rename_file.ex deleted file mode 100644 index 4ec49f17e..000000000 --- a/apps/language_server/lib/generated/lsp/types/rename_file.ex +++ /dev/null @@ -1,12 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.RenameFile do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - alias LSP.Types - use Proto - - deftype annotation_id: optional(Types.ChangeAnnotation.Identifier), - kind: literal("rename"), - new_uri: string(), - old_uri: string(), - options: optional(Types.RenameFile.Options) -end diff --git a/apps/language_server/lib/generated/lsp/types/rename_file/options.ex b/apps/language_server/lib/generated/lsp/types/rename_file/options.ex deleted file mode 100644 index 18c949e48..000000000 --- a/apps/language_server/lib/generated/lsp/types/rename_file/options.ex +++ /dev/null @@ -1,6 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.RenameFile.Options do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - use Proto - deftype ignore_if_exists: optional(boolean()), overwrite: optional(boolean()) -end diff --git a/apps/language_server/lib/generated/lsp/types/resource_operation/kind.ex b/apps/language_server/lib/generated/lsp/types/resource_operation/kind.ex deleted file mode 100644 index 543551f24..000000000 --- a/apps/language_server/lib/generated/lsp/types/resource_operation/kind.ex +++ /dev/null @@ -1,6 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.ResourceOperation.Kind do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - use Proto - defenum create: "create", rename: "rename", delete: "delete" -end diff --git a/apps/language_server/lib/generated/lsp/types/selection_range/client_capabilities.ex b/apps/language_server/lib/generated/lsp/types/selection_range/client_capabilities.ex deleted file mode 100644 index 987689278..000000000 --- a/apps/language_server/lib/generated/lsp/types/selection_range/client_capabilities.ex +++ /dev/null @@ -1,6 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.SelectionRange.ClientCapabilities do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - use Proto - deftype dynamic_registration: optional(boolean()) -end diff --git a/apps/language_server/lib/generated/lsp/types/semantic_tokens/client_capabilities.ex b/apps/language_server/lib/generated/lsp/types/semantic_tokens/client_capabilities.ex deleted file mode 100644 index de22a2641..000000000 --- a/apps/language_server/lib/generated/lsp/types/semantic_tokens/client_capabilities.ex +++ /dev/null @@ -1,32 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.SemanticTokens.ClientCapabilities do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - alias LSP.Types - - defmodule Full do - use Proto - deftype delta: optional(boolean()) - end - - defmodule Range do - use Proto - deftype [] - end - - defmodule Requests do - use Proto - deftype full: optional(one_of([boolean(), Full])), range: optional(one_of([boolean(), Range])) - end - - use Proto - - deftype augments_syntax_tokens: optional(boolean()), - dynamic_registration: optional(boolean()), - formats: list_of(Types.TokenFormat), - multiline_token_support: optional(boolean()), - overlapping_token_support: optional(boolean()), - requests: Requests, - server_cancel_support: optional(boolean()), - token_modifiers: list_of(string()), - token_types: list_of(string()) -end diff --git a/apps/language_server/lib/generated/lsp/types/semantic_tokens/workspace/client_capabilities.ex b/apps/language_server/lib/generated/lsp/types/semantic_tokens/workspace/client_capabilities.ex deleted file mode 100644 index 66edf0505..000000000 --- a/apps/language_server/lib/generated/lsp/types/semantic_tokens/workspace/client_capabilities.ex +++ /dev/null @@ -1,6 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.SemanticTokens.Workspace.ClientCapabilities do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - use Proto - deftype refresh_support: optional(boolean()) -end diff --git a/apps/language_server/lib/generated/lsp/types/show_document/client_capabilities.ex b/apps/language_server/lib/generated/lsp/types/show_document/client_capabilities.ex deleted file mode 100644 index bfa8a8682..000000000 --- a/apps/language_server/lib/generated/lsp/types/show_document/client_capabilities.ex +++ /dev/null @@ -1,6 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.ShowDocument.ClientCapabilities do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - use Proto - deftype support: boolean() -end diff --git a/apps/language_server/lib/generated/lsp/types/show_message_request/client_capabilities.ex b/apps/language_server/lib/generated/lsp/types/show_message_request/client_capabilities.ex deleted file mode 100644 index 98e89ba05..000000000 --- a/apps/language_server/lib/generated/lsp/types/show_message_request/client_capabilities.ex +++ /dev/null @@ -1,12 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.ShowMessageRequest.ClientCapabilities do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - - defmodule MessageActionItem do - use Proto - deftype additional_properties_support: optional(boolean()) - end - - use Proto - deftype message_action_item: optional(MessageActionItem) -end diff --git a/apps/language_server/lib/generated/lsp/types/signature_help/client_capabilities.ex b/apps/language_server/lib/generated/lsp/types/signature_help/client_capabilities.ex deleted file mode 100644 index 962be5947..000000000 --- a/apps/language_server/lib/generated/lsp/types/signature_help/client_capabilities.ex +++ /dev/null @@ -1,24 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.SignatureHelp.ClientCapabilities do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - alias LSP.Types - - defmodule ParameterInformation do - use Proto - deftype label_offset_support: optional(boolean()) - end - - defmodule SignatureInformation do - use Proto - - deftype active_parameter_support: optional(boolean()), - documentation_format: optional(list_of(Types.Markup.Kind)), - parameter_information: optional(ParameterInformation) - end - - use Proto - - deftype context_support: optional(boolean()), - dynamic_registration: optional(boolean()), - signature_information: optional(SignatureInformation) -end diff --git a/apps/language_server/lib/generated/lsp/types/symbol/kind.ex b/apps/language_server/lib/generated/lsp/types/symbol/kind.ex deleted file mode 100644 index d0a5516bd..000000000 --- a/apps/language_server/lib/generated/lsp/types/symbol/kind.ex +++ /dev/null @@ -1,32 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.Symbol.Kind do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - use Proto - - defenum file: 1, - module: 2, - namespace: 3, - package: 4, - class: 5, - method: 6, - property: 7, - field: 8, - constructor: 9, - enum: 10, - interface: 11, - function: 12, - variable: 13, - constant: 14, - string: 15, - number: 16, - boolean: 17, - array: 18, - object: 19, - key: 20, - null: 21, - enum_member: 22, - struct: 23, - event: 24, - operator: 25, - type_parameter: 26 -end diff --git a/apps/language_server/lib/generated/lsp/types/symbol/tag.ex b/apps/language_server/lib/generated/lsp/types/symbol/tag.ex deleted file mode 100644 index 023172013..000000000 --- a/apps/language_server/lib/generated/lsp/types/symbol/tag.ex +++ /dev/null @@ -1,6 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.Symbol.Tag do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - use Proto - defenum deprecated: 1 -end diff --git a/apps/language_server/lib/generated/lsp/types/text_document/client_capabilities.ex b/apps/language_server/lib/generated/lsp/types/text_document/client_capabilities.ex deleted file mode 100644 index 5d08c0d97..000000000 --- a/apps/language_server/lib/generated/lsp/types/text_document/client_capabilities.ex +++ /dev/null @@ -1,37 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.TextDocument.ClientCapabilities do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - alias LSP.Types - use Proto - - deftype call_hierarchy: optional(Types.CallHierarchy.ClientCapabilities), - code_action: optional(Types.CodeAction.ClientCapabilities), - code_lens: optional(Types.CodeLens.ClientCapabilities), - color_provider: optional(Types.Document.Color.ClientCapabilities), - completion: optional(Types.Completion.ClientCapabilities), - declaration: optional(Types.Declaration.ClientCapabilities), - definition: optional(Types.Definition.ClientCapabilities), - diagnostic: optional(Types.Diagnostic.ClientCapabilities), - document_highlight: optional(Types.Document.Highlight.ClientCapabilities), - document_link: optional(Types.Document.Link.ClientCapabilities), - document_symbol: optional(Types.Document.Symbol.ClientCapabilities), - folding_range: optional(Types.FoldingRange.ClientCapabilities), - formatting: optional(Types.Document.Formatting.ClientCapabilities), - hover: optional(Types.Hover.ClientCapabilities), - implementation: optional(Types.Implementation.ClientCapabilities), - inlay_hint: optional(Types.InlayHint.ClientCapabilities), - inline_value: optional(Types.InlineValue.ClientCapabilities), - linked_editing_range: optional(Types.LinkedEditingRange.ClientCapabilities), - moniker: optional(Types.Moniker.ClientCapabilities), - on_type_formatting: optional(Types.Document.OnTypeFormatting.ClientCapabilities), - publish_diagnostics: optional(Types.PublishDiagnostics.ClientCapabilities), - range_formatting: optional(Types.Document.RangeFormatting.ClientCapabilities), - references: optional(Types.Reference.ClientCapabilities), - rename: optional(Types.Rename.ClientCapabilities), - selection_range: optional(Types.SelectionRange.ClientCapabilities), - semantic_tokens: optional(Types.SemanticTokens.ClientCapabilities), - signature_help: optional(Types.SignatureHelp.ClientCapabilities), - synchronization: optional(Types.TextDocument.Sync.ClientCapabilities), - type_definition: optional(Types.TypeDefinition.ClientCapabilities), - type_hierarchy: optional(Types.TypeHierarchy.ClientCapabilities) -end diff --git a/apps/language_server/lib/generated/lsp/types/text_document/content_change_event.ex b/apps/language_server/lib/generated/lsp/types/text_document/content_change_event.ex deleted file mode 100644 index 3beeb5c69..000000000 --- a/apps/language_server/lib/generated/lsp/types/text_document/content_change_event.ex +++ /dev/null @@ -1,18 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.TextDocument.ContentChangeEvent do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - alias LSP.Types - - defmodule TextDocumentContentChangeEvent do - use Proto - deftype range: Types.Range, range_length: optional(integer()), text: string() - end - - defmodule TextDocumentContentChangeEvent1 do - use Proto - deftype text: string() - end - - use Proto - defalias one_of([TextDocumentContentChangeEvent, TextDocumentContentChangeEvent1]) -end diff --git a/apps/language_server/lib/generated/lsp/types/text_document/edit.ex b/apps/language_server/lib/generated/lsp/types/text_document/edit.ex deleted file mode 100644 index e68bf88c5..000000000 --- a/apps/language_server/lib/generated/lsp/types/text_document/edit.ex +++ /dev/null @@ -1,9 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.TextDocument.Edit do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - alias LSP.Types - use Proto - - deftype edits: list_of(one_of([Types.TextEdit, Types.TextEdit.Annotated])), - text_document: Types.TextDocument.OptionalVersioned.Identifier -end diff --git a/apps/language_server/lib/generated/lsp/types/text_document/identifier.ex b/apps/language_server/lib/generated/lsp/types/text_document/identifier.ex deleted file mode 100644 index 75eacb576..000000000 --- a/apps/language_server/lib/generated/lsp/types/text_document/identifier.ex +++ /dev/null @@ -1,6 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.TextDocument.Identifier do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - use Proto - deftype uri: string() -end diff --git a/apps/language_server/lib/generated/lsp/types/text_document/item.ex b/apps/language_server/lib/generated/lsp/types/text_document/item.ex deleted file mode 100644 index ed576fa12..000000000 --- a/apps/language_server/lib/generated/lsp/types/text_document/item.ex +++ /dev/null @@ -1,6 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.TextDocument.Item do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - use Proto - deftype language_id: string(), text: string(), uri: string(), version: integer() -end diff --git a/apps/language_server/lib/generated/lsp/types/text_document/optional_versioned/identifier.ex b/apps/language_server/lib/generated/lsp/types/text_document/optional_versioned/identifier.ex deleted file mode 100644 index f7af4d25a..000000000 --- a/apps/language_server/lib/generated/lsp/types/text_document/optional_versioned/identifier.ex +++ /dev/null @@ -1,6 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.TextDocument.OptionalVersioned.Identifier do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - use Proto - deftype uri: string(), version: one_of([integer(), nil]) -end diff --git a/apps/language_server/lib/generated/lsp/types/text_document/sync/client_capabilities.ex b/apps/language_server/lib/generated/lsp/types/text_document/sync/client_capabilities.ex deleted file mode 100644 index 1c902a5d5..000000000 --- a/apps/language_server/lib/generated/lsp/types/text_document/sync/client_capabilities.ex +++ /dev/null @@ -1,10 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.TextDocument.Sync.ClientCapabilities do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - use Proto - - deftype did_save: optional(boolean()), - dynamic_registration: optional(boolean()), - will_save: optional(boolean()), - will_save_wait_until: optional(boolean()) -end diff --git a/apps/language_server/lib/generated/lsp/types/text_document/versioned/identifier.ex b/apps/language_server/lib/generated/lsp/types/text_document/versioned/identifier.ex deleted file mode 100644 index a979a8188..000000000 --- a/apps/language_server/lib/generated/lsp/types/text_document/versioned/identifier.ex +++ /dev/null @@ -1,6 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.TextDocument.Versioned.Identifier do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - use Proto - deftype uri: string(), version: integer() -end diff --git a/apps/language_server/lib/generated/lsp/types/text_edit.ex b/apps/language_server/lib/generated/lsp/types/text_edit.ex deleted file mode 100644 index 3d6e7a20c..000000000 --- a/apps/language_server/lib/generated/lsp/types/text_edit.ex +++ /dev/null @@ -1,7 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.TextEdit do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - alias LSP.Types - use Proto - deftype new_text: string(), range: Types.Range -end diff --git a/apps/language_server/lib/generated/lsp/types/text_edit/annotated.ex b/apps/language_server/lib/generated/lsp/types/text_edit/annotated.ex deleted file mode 100644 index c0a95273b..000000000 --- a/apps/language_server/lib/generated/lsp/types/text_edit/annotated.ex +++ /dev/null @@ -1,7 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.TextEdit.Annotated do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - alias LSP.Types - use Proto - deftype annotation_id: Types.ChangeAnnotation.Identifier, new_text: string(), range: Types.Range -end diff --git a/apps/language_server/lib/generated/lsp/types/token_format.ex b/apps/language_server/lib/generated/lsp/types/token_format.ex deleted file mode 100644 index 7ae57aaa3..000000000 --- a/apps/language_server/lib/generated/lsp/types/token_format.ex +++ /dev/null @@ -1,6 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.TokenFormat do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - use Proto - defenum relative: "relative" -end diff --git a/apps/language_server/lib/generated/lsp/types/type_definition/client_capabilities.ex b/apps/language_server/lib/generated/lsp/types/type_definition/client_capabilities.ex deleted file mode 100644 index e7403a9ff..000000000 --- a/apps/language_server/lib/generated/lsp/types/type_definition/client_capabilities.ex +++ /dev/null @@ -1,6 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.TypeDefinition.ClientCapabilities do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - use Proto - deftype dynamic_registration: optional(boolean()), link_support: optional(boolean()) -end diff --git a/apps/language_server/lib/generated/lsp/types/type_hierarchy/client_capabilities.ex b/apps/language_server/lib/generated/lsp/types/type_hierarchy/client_capabilities.ex deleted file mode 100644 index 802d3ab37..000000000 --- a/apps/language_server/lib/generated/lsp/types/type_hierarchy/client_capabilities.ex +++ /dev/null @@ -1,6 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.TypeHierarchy.ClientCapabilities do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - use Proto - deftype dynamic_registration: optional(boolean()) -end diff --git a/apps/language_server/lib/generated/lsp/types/window/client_capabilities.ex b/apps/language_server/lib/generated/lsp/types/window/client_capabilities.ex deleted file mode 100644 index c6ef73bd7..000000000 --- a/apps/language_server/lib/generated/lsp/types/window/client_capabilities.ex +++ /dev/null @@ -1,10 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.Window.ClientCapabilities do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - alias LSP.Types - use Proto - - deftype show_document: optional(Types.ShowDocument.ClientCapabilities), - show_message: optional(Types.ShowMessageRequest.ClientCapabilities), - work_done_progress: optional(boolean()) -end diff --git a/apps/language_server/lib/generated/lsp/types/workspace/client_capabilities.ex b/apps/language_server/lib/generated/lsp/types/workspace/client_capabilities.ex deleted file mode 100644 index f392622eb..000000000 --- a/apps/language_server/lib/generated/lsp/types/workspace/client_capabilities.ex +++ /dev/null @@ -1,21 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.Workspace.ClientCapabilities do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - alias LSP.Types - use Proto - - deftype apply_edit: optional(boolean()), - code_lens: optional(Types.CodeLens.Workspace.ClientCapabilities), - configuration: optional(boolean()), - diagnostics: optional(Types.Diagnostic.Workspace.ClientCapabilities), - did_change_configuration: optional(Types.DidChangeConfiguration.ClientCapabilities), - did_change_watched_files: optional(Types.DidChangeWatchedFiles.ClientCapabilities), - execute_command: optional(Types.ExecuteCommand.ClientCapabilities), - file_operations: optional(Types.FileOperation.ClientCapabilities), - inlay_hint: optional(Types.InlayHintWorkspace.ClientCapabilities), - inline_value: optional(Types.InlineValue.Workspace.ClientCapabilities), - semantic_tokens: optional(Types.SemanticTokens.Workspace.ClientCapabilities), - symbol: optional(Types.Workspace.Symbol.ClientCapabilities), - workspace_edit: optional(Types.Workspace.Edit.ClientCapabilities), - workspace_folders: optional(boolean()) -end diff --git a/apps/language_server/lib/generated/lsp/types/workspace/edit.ex b/apps/language_server/lib/generated/lsp/types/workspace/edit.ex deleted file mode 100644 index df2e263ba..000000000 --- a/apps/language_server/lib/generated/lsp/types/workspace/edit.ex +++ /dev/null @@ -1,20 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.Workspace.Edit do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - alias LSP.Types - use Proto - - deftype change_annotations: optional(map_of(Types.ChangeAnnotation)), - changes: optional(map_of(list_of(Types.TextEdit))), - document_changes: - optional( - list_of( - one_of([ - Types.TextDocument.Edit, - Types.CreateFile, - Types.RenameFile, - Types.DeleteFile - ]) - ) - ) -end diff --git a/apps/language_server/lib/generated/lsp/types/workspace/edit/client_capabilities.ex b/apps/language_server/lib/generated/lsp/types/workspace/edit/client_capabilities.ex deleted file mode 100644 index 23d1c505c..000000000 --- a/apps/language_server/lib/generated/lsp/types/workspace/edit/client_capabilities.ex +++ /dev/null @@ -1,18 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.Workspace.Edit.ClientCapabilities do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - alias LSP.Types - - defmodule ChangeAnnotationSupport do - use Proto - deftype groups_on_label: optional(boolean()) - end - - use Proto - - deftype change_annotation_support: optional(ChangeAnnotationSupport), - document_changes: optional(boolean()), - failure_handling: optional(Types.FailureHandling.Kind), - normalizes_line_endings: optional(boolean()), - resource_operations: optional(list_of(Types.ResourceOperation.Kind)) -end diff --git a/apps/language_server/lib/generated/lsp/types/workspace/folder.ex b/apps/language_server/lib/generated/lsp/types/workspace/folder.ex deleted file mode 100644 index 03f4adf2c..000000000 --- a/apps/language_server/lib/generated/lsp/types/workspace/folder.ex +++ /dev/null @@ -1,6 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.Workspace.Folder do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - use Proto - deftype name: string(), uri: string() -end diff --git a/apps/language_server/lib/generated/lsp/types/workspace/symbol/client_capabilities.ex b/apps/language_server/lib/generated/lsp/types/workspace/symbol/client_capabilities.ex deleted file mode 100644 index 6d9629817..000000000 --- a/apps/language_server/lib/generated/lsp/types/workspace/symbol/client_capabilities.ex +++ /dev/null @@ -1,27 +0,0 @@ -# This file's contents are auto-generated. Do not edit. -defmodule LSP.Types.Workspace.Symbol.ClientCapabilities do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - alias LSP.Types - - defmodule ResolveSupport do - use Proto - deftype properties: list_of(string()) - end - - defmodule SymbolKind do - use Proto - deftype value_set: optional(list_of(Types.Symbol.Kind)) - end - - defmodule TagSupport do - use Proto - deftype value_set: list_of(Types.Symbol.Tag) - end - - use Proto - - deftype dynamic_registration: optional(boolean()), - resolve_support: optional(ResolveSupport), - symbol_kind: optional(SymbolKind), - tag_support: optional(TagSupport) -end diff --git a/apps/language_server/lib/language_server.ex b/apps/language_server/lib/language_server.ex index 62e30062f..48024b85a 100644 --- a/apps/language_server/lib/language_server.ex +++ b/apps/language_server/lib/language_server.ex @@ -5,18 +5,13 @@ defmodule ElixirLS.LanguageServer do use Application alias ElixirLS.LanguageServer - alias ElixirLS.LanguageServer.Experimental @impl Application def start(_type, _args) do - Experimental.LanguageServer.persist_enabled_state() - children = [ - maybe_experimental_supervisor(), {ElixirLS.LanguageServer.Server, ElixirLS.LanguageServer.Server}, - maybe_packet_router(), - jsonrpc(), + {ElixirLS.LanguageServer.JsonRpc, name: ElixirLS.LanguageServer.JsonRpc}, {ElixirLS.LanguageServer.Providers.WorkspaceSymbols, []}, {ElixirLS.LanguageServer.Tracer, []}, {ElixirLS.LanguageServer.ExUnitTestTracer, []} @@ -42,27 +37,6 @@ defmodule ElixirLS.LanguageServer do :ok end - defp maybe_experimental_supervisor do - if Experimental.LanguageServer.enabled?() do - Experimental.Supervisor - end - end - - defp maybe_packet_router do - if Experimental.LanguageServer.enabled?() do - {ElixirLS.LanguageServer.PacketRouter, [LanguageServer.Server, Experimental.Server]} - end - end - - defp jsonrpc do - if Experimental.LanguageServer.enabled?() do - {ElixirLS.LanguageServer.JsonRpc, - name: ElixirLS.LanguageServer.JsonRpc, language_server: LanguageServer.PacketRouter} - else - {ElixirLS.LanguageServer.JsonRpc, name: ElixirLS.LanguageServer.JsonRpc} - end - end - def restart() do Application.put_env(:language_server, :restart, true) System.stop(0) diff --git a/apps/language_server/lib/language_server/experimental/code_mod/ast.ex b/apps/language_server/lib/language_server/experimental/code_mod/ast.ex deleted file mode 100644 index bbde0e4db..000000000 --- a/apps/language_server/lib/language_server/experimental/code_mod/ast.ex +++ /dev/null @@ -1,28 +0,0 @@ -defmodule ElixirLS.LanguageServer.Experimental.CodeMod.Ast do - alias ElixirLS.LanguageServer.Experimental.SourceFile - - @type source :: SourceFile.t() | String.t() - @type t :: - atom() - | binary() - | [any()] - | number() - | {any(), any()} - | {atom() | {any(), [any()], atom() | [any()]}, Keyword.t(), atom() | [any()]} - - @spec from(source) :: t - def from(%SourceFile{} = source_file) do - source_file - |> SourceFile.to_string() - |> from() - end - - def from(s) when is_binary(s) do - ElixirSense.string_to_quoted(s, 1, 6, token_metadata: true) - end - - @spec to_string(t()) :: String.t() - def to_string(ast) do - Macro.to_string(ast) - end -end diff --git a/apps/language_server/lib/language_server/experimental/code_mod/diff.ex b/apps/language_server/lib/language_server/experimental/code_mod/diff.ex deleted file mode 100644 index 48a07a418..000000000 --- a/apps/language_server/lib/language_server/experimental/code_mod/diff.ex +++ /dev/null @@ -1,107 +0,0 @@ -defmodule ElixirLS.LanguageServer.Experimental.CodeMod.Diff do - alias ElixirLS.LanguageServer.Experimental.CodeUnit - alias LSP.Types.Position - alias LSP.Types.Range - alias LSP.Types.TextEdit - - @spec diff(String.t(), String.t()) :: [TextEdit.t()] - def diff(source, dest) do - source - |> String.myers_difference(dest) - |> to_text_edits() - end - - defp to_text_edits(difference) do - {_, {current_line, prev_lines}} = - Enum.reduce(difference, {{0, 0}, {[], []}}, fn - {diff_type, diff_string}, {position, edits} -> - apply_diff(diff_type, position, diff_string, edits) - end) - - [current_line | prev_lines] - |> Enum.flat_map(fn line_edits -> - line_edits - |> Enum.reduce([], &collapse/2) - |> Enum.reverse() - end) - end - - # This collapses a delete and an an insert that are adjacent to one another - # into a single insert, changing the delete to insert the text from the - # insert rather than "" - # It's a small optimization, but it was in the original - defp collapse( - %TextEdit{ - new_text: "", - range: %Range{ - end: %Position{character: same_character, line: same_line} - } - } = delete_edit, - [ - %TextEdit{ - new_text: insert_text, - range: - %Range{ - start: %Position{character: same_character, line: same_line} - } = _insert_edit - } - | rest - ] - ) - when byte_size(insert_text) > 0 do - collapsed_edit = %TextEdit{delete_edit | new_text: insert_text} - [collapsed_edit | rest] - end - - defp collapse(%TextEdit{} = edit, edits) do - [edit | edits] - end - - defp apply_diff(:eq, position, doc_string, edits) do - advance(doc_string, position, edits) - end - - defp apply_diff(:del, {line, code_unit} = position, change, edits) do - {after_pos, {current_line, prev_lines}} = advance(change, position, edits) - {edit_end_line, edit_end_unit} = after_pos - current_line = [edit("", line, code_unit, edit_end_line, edit_end_unit) | current_line] - {after_pos, {current_line, prev_lines}} - end - - defp apply_diff(:ins, {line, code_unit} = position, change, {current_line, prev_lines}) do - current_line = [edit(change, line, code_unit, line, code_unit) | current_line] - # When inserting, the insert itself does not exist in source, so there is no need to advance - {position, {current_line, prev_lines}} - end - - defp advance(<<>>, position, edits) do - {position, edits} - end - - for ending <- ["\r\n", "\r", "\n"] do - defp advance(<>, {line, _unit}, {current_line, prev_lines}) do - edits = {[], [current_line | prev_lines]} - advance(rest, {line + 1, 0}, edits) - end - end - - defp advance(<>, {line, unit}, edits) when c < 128 do - advance(rest, {line, unit + 1}, edits) - end - - defp advance(<>, {line, unit}, edits) do - increment = CodeUnit.count(:utf16, <>) - advance(rest, {line, unit + increment}, edits) - end - - defp edit(text, start_line, start_unit, end_line, end_unit) do - TextEdit.new( - new_text: text, - range: - Range.new( - start: Position.new(line: start_line, character: start_unit), - end: Position.new(line: end_line, character: end_unit) - ) - ) - end -end diff --git a/apps/language_server/lib/language_server/experimental/code_mod/format.ex b/apps/language_server/lib/language_server/experimental/code_mod/format.ex deleted file mode 100644 index 115f8dba6..000000000 --- a/apps/language_server/lib/language_server/experimental/code_mod/format.ex +++ /dev/null @@ -1,167 +0,0 @@ -defmodule ElixirLS.LanguageServer.Experimental.CodeMod.Format do - alias ElixirLS.LanguageServer.Experimental.CodeMod.Diff - alias ElixirLS.LanguageServer.Experimental.SourceFile - alias ElixirLS.LanguageServer.Experimental.SourceFile.Conversions - alias LSP.Types.TextEdit - - require Logger - @type formatter_function :: (String.t() -> any) | nil - - @spec text_edits(SourceFile.t(), String.t() | nil) :: {:ok, [TextEdit.t()]} | {:error, any} - def text_edits(%SourceFile{} = document, project_path_or_uri) do - with {:ok, unformatted, formatted} <- do_format(document, project_path_or_uri) do - edits = Diff.diff(unformatted, formatted) - {:ok, edits} - end - end - - @spec format(SourceFile.t(), String.t() | nil) :: {:ok, String.t()} | {:error, any} - def format(%SourceFile{} = document, project_path_or_uri) do - with {:ok, _, formatted_code} <- do_format(document, project_path_or_uri) do - {:ok, formatted_code} - end - end - - defp do_format(%SourceFile{} = document, project_path_or_uri) - when is_binary(project_path_or_uri) do - project_path = Conversions.ensure_path(project_path_or_uri) - - with :ok <- check_current_directory(document, project_path), - {:ok, formatter, options} <- formatter_for(document.path, project_path), - :ok <- - check_inputs_apply(document, project_path, Keyword.get(options, :inputs)) do - document - |> SourceFile.to_string() - |> formatter.() - end - end - - defp do_format(%SourceFile{} = document, _) do - formatter = build_formatter([]) - - document - |> SourceFile.to_string() - |> formatter.() - end - - @spec formatter_for(String.t(), String.t() | nil) :: - {:ok, formatter_function, keyword()} | {:error, :no_formatter_available} - defp formatter_for(uri_or_path, project_dir) do - path = Conversions.ensure_path(uri_or_path) - - try do - true = Code.ensure_loaded?(Mix.Tasks.Format) - - {formatter_function, options} = - if project_dir && Version.match?(System.version(), ">= 1.15.0") do - Mix.Tasks.Format.formatter_for_file(path, root: project_dir) - else - Mix.Tasks.Format.formatter_for_file(path) - end - - wrapped_formatter_function = wrap_with_try_catch(formatter_function) - {:ok, wrapped_formatter_function, options} - rescue - e -> - message = Exception.message(e) - - Logger.warning( - "Unable to get formatter options for #{path}: #{inspect(e.__struct__)} #{message} #{Exception.format(:error, e, __STACKTRACE__)}" - ) - - {:error, :no_formatter_available} - end - end - - defp build_formatter(opts) do - fn code -> - formatted_iodata = Code.format_string!(code, opts) - IO.iodata_to_binary([formatted_iodata, ?\n]) - end - |> wrap_with_try_catch() - end - - defp wrap_with_try_catch(formatter_fn) do - fn code -> - try do - {:ok, code, formatter_fn.(code)} - rescue - e -> - {:error, e} - end - end - end - - defp check_current_directory(%SourceFile{} = document, project_path) do - cwd = File.cwd!() - - if subdirectory?(document.path, parent: project_path) or - subdirectory?(document.path, parent: cwd) do - :ok - else - message = - "Cannot format '#{document.path}' from current directory " <> - "(Currently in #{project_path})" - - {:error, message} - end - end - - defp check_inputs_apply(%SourceFile{} = document, project_path, inputs) - when is_list(inputs) do - formatter_dir = dominating_formatter_exs_dir(document, project_path) - # document.path is native, convert to universal separators - document_path = Path.absname(document.path) - - inputs_apply? = - Enum.any?(inputs, fn input_glob -> - glob = - if Path.type(input_glob) == :relative do - formatter_dir - |> Path.join(input_glob) - else - input_glob - end - - PathGlobVendored.match?(document_path, glob, match_dot: true) - end) - - if inputs_apply? do - :ok - else - {:error, {:input_mismatch, "#{document_path} is not matched by #{inspect(inputs)}"}} - end - end - - defp check_inputs_apply(_, _, _), do: :ok - - defp subdirectory?(child, parent: parent) do - normalized_parent = Path.absname(parent) - normalized_child = Path.absname(child) - String.starts_with?(normalized_child, normalized_parent) - end - - # Finds the directory with the .formatter.exs that's the nearest parent to the - # source file, or the project dir if none was found. - defp dominating_formatter_exs_dir(%SourceFile{} = document, project_path) do - document.path - |> Path.dirname() - |> dominating_formatter_exs_dir(project_path) - end - - defp dominating_formatter_exs_dir(project_dir, project_dir) do - project_dir - end - - defp dominating_formatter_exs_dir(current_dir, project_path) do - formatter_exs_name = Path.join(current_dir, ".formatter.exs") - - if File.exists?(formatter_exs_name) do - current_dir - else - current_dir - |> Path.dirname() - |> dominating_formatter_exs_dir(project_path) - end - end -end diff --git a/apps/language_server/lib/language_server/experimental/code_mod/replace_remote_function.ex b/apps/language_server/lib/language_server/experimental/code_mod/replace_remote_function.ex deleted file mode 100644 index 98beef607..000000000 --- a/apps/language_server/lib/language_server/experimental/code_mod/replace_remote_function.ex +++ /dev/null @@ -1,51 +0,0 @@ -defmodule ElixirLS.LanguageServer.Experimental.CodeMod.ReplaceRemoteFunction do - alias ElixirLS.LanguageServer.Experimental.CodeMod.Ast - alias ElixirLS.LanguageServer.Experimental.CodeMod.Diff - alias ElixirLS.LanguageServer.Experimental.CodeMod.Text - alias LSP.Types.TextEdit - - @spec text_edits(String.t(), Ast.t(), [[atom()]], atom(), atom()) :: - {:ok, [TextEdit.t()]} | :error - def text_edits(original_text, ast, possible_aliases, name, suggestion) do - with {:ok, transformed} <- - apply_transforms(original_text, ast, possible_aliases, name, suggestion) do - {:ok, Diff.diff(original_text, transformed)} - end - end - - defp apply_transforms(line_text, quoted_ast, possible_aliases, name, suggestion) do - leading_indent = Text.leading_indent(line_text) - - updated_ast = - Macro.postwalk(quoted_ast, fn - {:., function_meta, [{:__aliases__, module_meta, module_alias}, ^name]} -> - if module_alias in possible_aliases do - {:., function_meta, [{:__aliases__, module_meta, module_alias}, suggestion]} - else - {:., function_meta, [{:__aliases__, module_meta, module_alias}, name]} - end - - other -> - other - end) - - if updated_ast != quoted_ast do - updated_ast - |> Ast.to_string() - # We're dealing with a single error on a single line. - # If the line doesn't compile (like it has a do with no end), ElixirSense - # adds additional lines do documents with errors, so take the first line, as it's - # the properly transformed source - |> Text.fetch_line(0) - |> case do - {:ok, text} -> - {:ok, "#{leading_indent}#{text}"} - - error -> - error - end - else - :error - end - end -end diff --git a/apps/language_server/lib/language_server/experimental/code_mod/replace_with_underscore.ex b/apps/language_server/lib/language_server/experimental/code_mod/replace_with_underscore.ex deleted file mode 100644 index 19c80670b..000000000 --- a/apps/language_server/lib/language_server/experimental/code_mod/replace_with_underscore.ex +++ /dev/null @@ -1,55 +0,0 @@ -defmodule ElixirLS.LanguageServer.Experimental.CodeMod.ReplaceWithUnderscore do - alias ElixirLS.LanguageServer.Experimental.CodeMod.Ast - alias ElixirLS.LanguageServer.Experimental.CodeMod.Diff - alias ElixirLS.LanguageServer.Experimental.CodeMod.Text - alias LSP.Types.TextEdit - - @spec text_edits(String.t(), Ast.t(), String.t() | atom) :: {:ok, [TextEdit.t()]} | :error - def text_edits(original_text, ast, variable_name) do - variable_name = ensure_atom(variable_name) - - with {:ok, transformed} <- apply_transform(original_text, ast, variable_name) do - {:ok, to_text_edits(original_text, transformed)} - end - end - - defp to_text_edits(orig_text, fixed_text) do - orig_text - |> Diff.diff(fixed_text) - |> Enum.filter(&(&1.new_text == "_")) - end - - defp ensure_atom(variable_name) when is_binary(variable_name) do - String.to_atom(variable_name) - end - - defp ensure_atom(variable_name) when is_atom(variable_name) do - variable_name - end - - defp apply_transform(line_text, quoted_ast, unused_variable_name) do - underscored_variable_name = :"_#{unused_variable_name}" - leading_indent = Text.leading_indent(line_text) - - Macro.postwalk(quoted_ast, fn - {^unused_variable_name, meta, context} -> - {underscored_variable_name, meta, context} - - other -> - other - end) - |> Ast.to_string() - # We're dealing with a single error on a single line. - # If the line doesn't compile (like it has a do with no end), ElixirSense - # adds additional lines do documents with errors, so take the first line, as it's - # the properly transformed source - |> Text.fetch_line(0) - |> case do - {:ok, text} -> - {:ok, "#{leading_indent}#{text}"} - - error -> - error - end - end -end diff --git a/apps/language_server/lib/language_server/experimental/code_mod/text.ex b/apps/language_server/lib/language_server/experimental/code_mod/text.ex deleted file mode 100644 index d8d203df5..000000000 --- a/apps/language_server/lib/language_server/experimental/code_mod/text.ex +++ /dev/null @@ -1,21 +0,0 @@ -defmodule ElixirLS.LanguageServer.Experimental.CodeMod.Text do - @indent_regex ~r/^\s+/ - def leading_indent(line_text) do - case Regex.scan(@indent_regex, line_text) do - [indent] -> indent - _ -> "" - end - end - - def fetch_line(message, line_number) do - line = - message - |> String.split(["\r\n", "\r", "\n"]) - |> Enum.at(line_number) - - case line do - nil -> :error - other -> {:ok, other} - end - end -end diff --git a/apps/language_server/lib/language_server/experimental/code_unit.ex b/apps/language_server/lib/language_server/experimental/code_unit.ex deleted file mode 100644 index 96ab4a658..000000000 --- a/apps/language_server/lib/language_server/experimental/code_unit.ex +++ /dev/null @@ -1,180 +0,0 @@ -defmodule ElixirLS.LanguageServer.Experimental.CodeUnit do - @moduledoc """ - Code unit and offset conversions - - The LSP protocol speaks in positions, which defines where something happens in a document. - Positions have a start and an end, which are defined as code unit _offsets_ from the beginning - of a line. this module helps to convert between utf8, which most of the world speaks - natively, and utf16, which has been forced upon us by microsoft. - - Converting between offsets and code units is 0(n), and allocations only happen if a - multi-byte character is detected, at which point, only that character is allocated. - This exploits the fact that most source code consists of ascii characters, with at best, - sporadic multi-byte characters in it. Thus, the vast majority of documents will not require - any allocations at all. - """ - @type utf8_code_unit :: non_neg_integer() - @type utf16_code_unit :: non_neg_integer() - @type utf8_offset :: non_neg_integer() - @type utf16_offset :: non_neg_integer() - - @type error :: {:error, :misaligned} | {:error, :out_of_bounds} - - # public - - @doc """ - Converts a utf8 character offset into a utf16 character offset. This implementation - clamps the maximum size of an offset so that any initial character position can be - passed in and the offset returned will reflect the end of the line. - """ - @spec utf16_offset(String.t(), utf8_offset()) :: utf16_offset() - def utf16_offset(binary, character_position) do - do_utf16_offset(binary, character_position, 0) - end - - @doc """ - Converts a utf16 character offset into a utf8 character offset. This implementation - clamps the maximum size of an offset so that any initial character position can be - passed in and the offset returned will reflect the end of the line. - """ - @spec utf8_offset(String.t(), utf16_offset()) :: utf8_offset() - def utf8_offset(binary, character_position) do - do_utf8_offset(binary, character_position, 0) - end - - @spec to_utf8(String.t(), utf16_code_unit()) :: {:ok, utf8_code_unit()} | error - def to_utf8(binary, utf16_unit) do - do_to_utf8(binary, utf16_unit, 0) - end - - @spec to_utf16(String.t(), utf8_code_unit()) :: {:ok, utf16_code_unit()} | error - def to_utf16(binary, utf16_unit) do - do_to_utf16(binary, utf16_unit, 0) - end - - def count(:utf16, binary) do - do_count_utf16(binary, 0) - end - - # Private - - # UTF-16 - - def do_count_utf16(<<>>, count) do - count - end - - def do_count_utf16(<>, count) when c < 128 do - do_count_utf16(rest, count + 1) - end - - def do_count_utf16(<>, count) do - increment = - <> - |> byte_size() - |> div(2) - - do_count_utf16(rest, count + increment) - end - - defp do_utf16_offset(_, 0, offset) do - offset - end - - defp do_utf16_offset(<<>>, _, offset) do - # this clause pegs the offset at the end of the string - # no matter the character index - offset - end - - defp do_utf16_offset(<>, remaining, offset) when c < 128 do - do_utf16_offset(rest, remaining - 1, offset + 1) - end - - defp do_utf16_offset(<>, remaining, offset) do - s = <> - increment = utf16_size(s) - do_utf16_offset(rest, remaining - 1, offset + increment) - end - - defp do_to_utf16(_, 0, utf16_unit) do - {:ok, utf16_unit} - end - - defp do_to_utf16(_, utf8_unit, _) when utf8_unit < 0 do - {:error, :misaligned} - end - - defp do_to_utf16(<<>>, _remaining, _utf16_unit) do - {:error, :out_of_bounds} - end - - defp do_to_utf16(<>, utf8_unit, utf16_unit) when c < 128 do - do_to_utf16(rest, utf8_unit - 1, utf16_unit + 1) - end - - defp do_to_utf16(<>, utf8_unit, utf16_unit) do - utf8_string = <> - increment = utf16_size(utf8_string) - decrement = byte_size(utf8_string) - - do_to_utf16(rest, utf8_unit - decrement, utf16_unit + increment) - end - - defp utf16_size(binary) when is_binary(binary) do - binary - |> :unicode.characters_to_binary(:utf8, :utf16) - |> byte_size() - |> div(2) - end - - # UTF-8 - - defp do_utf8_offset(_, 0, offset) do - offset - end - - defp do_utf8_offset(<<>>, _, offset) do - # this clause pegs the offset at the end of the string - # no matter the character index - offset - end - - defp do_utf8_offset(<>, remaining, offset) when c < 128 do - do_utf8_offset(rest, remaining - 1, offset + 1) - end - - defp do_utf8_offset(<>, remaining, offset) do - s = <> - increment = utf8_size(s) - decrement = utf16_size(s) - do_utf8_offset(rest, remaining - decrement, offset + increment) - end - - defp do_to_utf8(_, 0, utf8_unit) do - {:ok, utf8_unit} - end - - defp do_to_utf8(_, utf_16_units, _) when utf_16_units < 0 do - {:error, :misaligned} - end - - defp do_to_utf8(<<>>, _remaining, _utf8_unit) do - {:error, :out_of_bounds} - end - - defp do_to_utf8(<>, utf16_unit, utf8_unit) when c < 128 do - do_to_utf8(rest, utf16_unit - 1, utf8_unit + 1) - end - - defp do_to_utf8(<>, utf16_unit, utf8_unit) do - utf8_code_units = byte_size(<>) - utf16_code_units = utf16_size(<>) - - do_to_utf8(rest, utf16_unit - utf16_code_units, utf8_unit + utf8_code_units) - end - - defp utf8_size(binary) when is_binary(binary) do - byte_size(binary) - end -end diff --git a/apps/language_server/lib/language_server/experimental/language_server.ex b/apps/language_server/lib/language_server/experimental/language_server.ex deleted file mode 100644 index 775576cc7..000000000 --- a/apps/language_server/lib/language_server/experimental/language_server.ex +++ /dev/null @@ -1,66 +0,0 @@ -defmodule ElixirLS.LanguageServer.Experimental.LanguageServer do - require Logger - - @type uri :: String.t() - - def handler_state(method) do - if enabled?() do - Map.get(handler_states(), method, :ignored) - else - :ignored - end - end - - @enabled Application.compile_env(:language_server, :enable_experimental_server, false) - - def persist_enabled_state do - set_enabled(@enabled) - end - - def set_enabled(value) do - if :persistent_term.get(:experimental_enabled?, nil) == nil do - spawn(fn -> - Process.sleep(5000) - - if value do - handled_messages = - Enum.map_join(handler_states(), "\n", fn {method, access} -> - "\t#{method}: #{access}" - end) - - "Experimental server is enabled. handling the following messages #{handled_messages}" - else - "Experimental server is disabled." - end - |> Logger.info() - end) - - :persistent_term.put(:experimental_enabled?, value) - end - end - - def enabled? do - :persistent_term.get(:experimental_enabled?, false) - end - - defp handler_states do - case :persistent_term.get(:handler_states, nil) do - nil -> - load_handler_states() - - states -> - states - end - end - - defp load_handler_states do - access_map = - Map.merge( - LSP.Requests.__meta__(:access), - LSP.Notifications.__meta__(:access) - ) - - :persistent_term.put(:handler_states, access_map) - access_map - end -end diff --git a/apps/language_server/lib/language_server/experimental/log.ex b/apps/language_server/lib/language_server/experimental/log.ex deleted file mode 100644 index ca7e19141..000000000 --- a/apps/language_server/lib/language_server/experimental/log.ex +++ /dev/null @@ -1,15 +0,0 @@ -defmodule ElixirLS.LanguageServer.Experimental.Log do - defmacro log_and_time(label, do: block) do - quote do - require Logger - - {time_in_us, result} = - :timer.tc(fn -> - unquote(block) - end) - - Logger.info("#{unquote(label)} took #{Float.round(time_in_us / 1000, 2)}ms") - result - end - end -end diff --git a/apps/language_server/lib/language_server/experimental/process_cache.ex b/apps/language_server/lib/language_server/experimental/process_cache.ex deleted file mode 100644 index fe7cb81e2..000000000 --- a/apps/language_server/lib/language_server/experimental/process_cache.ex +++ /dev/null @@ -1,82 +0,0 @@ -defmodule ElixirLS.LanguageServer.Experimental.ProcessCache do - @moduledoc """ - A simple cache with a timeout that lives in the process dictionary - """ - - defmodule Entry do - defstruct [:value, :expiry] - - def new(value, timeout_ms) do - expiry_ts = now_ts() + timeout_ms - %__MODULE__{value: value, expiry: expiry_ts} - end - - def valid?(%__MODULE__{} = entry) do - now_ts() < entry.expiry - end - - defp now_ts do - System.os_time(:millisecond) - end - end - - @type key :: term() - @type fetch_result :: {:ok, term()} | :error - - @doc """ - Retrieves a value from the cache - If the value is not found, the default is returned - """ - @spec get(key()) :: term() | nil - @spec get(key(), term()) :: term() | nil - def get(key, default \\ nil) do - case fetch(key) do - {:ok, val} -> val - :error -> default - end - end - - @doc """ - Retrieves a value from the cache - If the value is not found, the default is returned - """ - @spec fetch(key()) :: fetch_result() - def fetch(key) do - case Process.get(key, :unset) do - %Entry{} = entry -> - if Entry.valid?(entry) do - {:ok, entry.value} - else - Process.delete(key) - :error - end - - :unset -> - :error - end - end - - @doc """ - Retrieves and optionally sets a value in the cache. - - Trans looks up a value in the cache under key. If that value isn't - found, the compute_fn is then executed, and its return value is set - in the cache. The cached value will live in the cache for `timeout` - milliseconds - """ - def trans(key, timeout_ms \\ 5000, compute_fn) do - case fetch(key) do - :error -> - set(key, timeout_ms, compute_fn) - - {:ok, result} -> - result - end - end - - defp set(key, timeout_ms, compute_fn) do - value = compute_fn.() - Process.put(key, Entry.new(value, timeout_ms)) - value - end -end diff --git a/apps/language_server/lib/language_server/experimental/project.ex b/apps/language_server/lib/language_server/experimental/project.ex deleted file mode 100644 index 7136a2c65..000000000 --- a/apps/language_server/lib/language_server/experimental/project.ex +++ /dev/null @@ -1,260 +0,0 @@ -defmodule ElixirLS.LanguageServer.Experimental.Project do - @moduledoc """ - The representation of the current state of an elixir project. - - This struct contains all the information required to build a project and interrogate its configuration, - as well as business logic for how to change its attributes. - """ - alias ElixirLS.LanguageServer.SourceFile - alias ElixirLS.LanguageServer.Experimental.LanguageServer - - defstruct root_uri: nil, - working_uri: nil, - mix_exs_uri: nil, - mix_project?: false, - mix_env: nil, - mix_target: nil, - env_variables: nil - - @type message :: String.t() - @type restart_notification :: {:restart, Logger.level(), String.t()} - @type t :: %__MODULE__{ - root_uri: LanguageServer.uri() | nil, - working_uri: LanguageServer.uri() | nil, - mix_exs_uri: LanguageServer.uri() | nil, - mix_env: atom(), - mix_target: atom(), - env_variables: %{String.t() => String.t()} | nil - } - @type error_with_message :: {:error, message} - # Public - @spec new(LanguageServer.uri() | nil) :: t - def new(root_uri) do - maybe_set_root_uri(%__MODULE__{}, root_uri) - end - - @spec root_path(t) :: Path.t() | nil - def root_path(%__MODULE__{root_uri: nil}) do - nil - end - - def root_path(%__MODULE__{} = project) do - SourceFile.Path.from_uri(project.root_uri) - end - - @spec project_path(t) :: Path.t() | nil - def project_path(%__MODULE__{working_uri: nil} = project) do - root_path(project) - end - - def project_path(%__MODULE__{working_uri: working_uri}) do - SourceFile.Path.from_uri(working_uri) - end - - @spec mix_exs_path(t) :: Path.t() | nil - def mix_exs_path(%__MODULE__{mix_exs_uri: nil}) do - nil - end - - def mix_exs_path(%__MODULE__{mix_exs_uri: mix_exs_uri}) do - SourceFile.Path.from_uri(mix_exs_uri) - end - - @spec change_mix_env(t, String.t() | nil) :: - {:ok, t} | error_with_message() | restart_notification() - def change_mix_env(%__MODULE__{} = project, mix_env) do - set_mix_env(project, mix_env) - end - - @spec change_mix_target(t, String.t() | nil) :: - {:ok, t} | error_with_message() | restart_notification() - def change_mix_target(%__MODULE__{} = project, mix_target) do - set_mix_target(project, mix_target) - end - - @spec change_project_directory(t, String.t() | nil) :: - {:ok, t} | error_with_message() | restart_notification() - def change_project_directory(%__MODULE__{} = project, project_directory) do - set_working_uri(project, project_directory) - end - - @spec change_environment_variables(t, map() | nil) :: - {:ok, t} | error_with_message() | restart_notification() - def change_environment_variables(%__MODULE__{} = project, environment_variables) do - set_env_vars(project, environment_variables) - end - - # private - - defp maybe_set_root_uri(%__MODULE__{} = project, nil), - do: %__MODULE__{project | root_uri: nil} - - defp maybe_set_root_uri(%__MODULE__{} = project, "file://" <> _ = root_uri) do - root_path = SourceFile.Path.absolute_from_uri(root_uri) - - with :ok <- File.cd(root_path), - {:ok, cwd} <- File.cwd() do - cwd_uri = SourceFile.Path.to_uri(cwd) - %__MODULE__{project | root_uri: cwd_uri} - else - _ -> - project - end - end - - # Project Path - defp set_working_uri(%__MODULE__{root_uri: root_uri} = old_project, project_directory) - when is_binary(root_uri) and project_directory != "" do - root_path = SourceFile.Path.absolute_from_uri(root_uri) - - normalized_project_dir = - if is_binary(project_directory) and project_directory != "" do - root_path - |> Path.join(project_directory) - |> Path.expand(root_path) - |> Path.absname() - else - root_path - end - - cond do - not File.dir?(normalized_project_dir) -> - {:error, "Project directory #{normalized_project_dir} does not exist"} - - not subdirectory?(root_path, normalized_project_dir) -> - message = - "Project directory '#{normalized_project_dir}' is not a subdirectory of '#{root_path}'" - - {:error, message} - - is_nil(old_project.working_uri) and subdirectory?(root_path, normalized_project_dir) -> - :ok = File.cd(normalized_project_dir) - - mix_exs_path = find_mix_exs_path(normalized_project_dir) - mix_project? = mix_exs_exists?(mix_exs_path) - - mix_exs_uri = - if mix_project? do - SourceFile.Path.to_uri(mix_exs_path) - else - nil - end - - working_uri = SourceFile.Path.to_uri(normalized_project_dir) - - new_project = %__MODULE__{ - old_project - | working_uri: working_uri, - mix_project?: mix_project?, - mix_exs_uri: mix_exs_uri - } - - {:ok, new_project} - - project_path(old_project) != normalized_project_dir -> - {:restart, :warning, "Project directory change detected. ElixirLS will restart"} - - true -> - {:ok, old_project} - end - end - - defp set_working_uri(%__MODULE__{} = old_project, _) do - {:ok, old_project} - end - - # Mix env - - defp set_mix_env(%__MODULE__{mix_env: old_env} = old_project, new_env) - when is_binary(new_env) and new_env != "" do - case {old_env, String.to_existing_atom(new_env)} do - {nil, nil} -> - Mix.env(:test) - {:ok, %__MODULE__{old_project | mix_env: :test}} - - {nil, new_env} -> - Mix.env(new_env) - {:ok, %__MODULE__{old_project | mix_env: new_env}} - - {same, same} -> - {:ok, old_project} - - _ -> - {:restart, :warning, "Mix env change detected. ElixirLS will restart."} - end - end - - defp set_mix_env(%__MODULE__{mix_env: nil} = project, _) do - Mix.env(:test) - - {:ok, %__MODULE__{project | mix_env: :test}} - end - - defp set_mix_env(%__MODULE__{} = project, _) do - {:ok, project} - end - - # Mix target - defp set_mix_target(%__MODULE__{} = old_project, new_target) - when is_binary(new_target) and new_target != "" do - case {old_project.mix_target, String.to_atom(new_target)} do - {nil, new_target} -> - Mix.target(new_target) - {:ok, %__MODULE__{old_project | mix_target: new_target}} - - {same, same} -> - {:ok, old_project} - - _ -> - {:restart, :warning, "Mix target change detected. ElixirLS will restart"} - end - end - - defp set_mix_target(%__MODULE__{} = old_project, _) do - {:ok, old_project} - end - - # Environment variables - - def set_env_vars(%__MODULE__{} = old_project, %{} = env_vars) do - case {old_project.env_variables, env_vars} do - {nil, vars} when map_size(vars) == 0 -> - {:ok, %__MODULE__{old_project | env_variables: vars}} - - {nil, new_vars} -> - System.put_env(new_vars) - {:ok, %__MODULE__{old_project | env_variables: new_vars}} - - {same, same} -> - {:ok, old_project} - - _ -> - {:restart, :warning, "Environment variables have changed. ElixirLS needs to restart"} - end - end - - def set_env_vars(%__MODULE__{} = old_project, _) do - {:ok, old_project} - end - - defp subdirectory?(parent, possible_child) do - parent_path = Path.expand(parent) - child_path = Path.expand(possible_child, parent) - - String.starts_with?(child_path, parent_path) - end - - defp find_mix_exs_path(project_directory) do - case System.get_env("MIX_EXS") do - nil -> - Path.join(project_directory, "mix.exs") - - mix_exs -> - mix_exs - end - end - - defp mix_exs_exists?(mix_exs_path) do - File.exists?(mix_exs_path) - end -end diff --git a/apps/language_server/lib/language_server/experimental/protocol.ex b/apps/language_server/lib/language_server/experimental/protocol.ex deleted file mode 100644 index e69de29bb..000000000 diff --git a/apps/language_server/lib/language_server/experimental/protocol/id.ex b/apps/language_server/lib/language_server/experimental/protocol/id.ex deleted file mode 100644 index 9562da8f2..000000000 --- a/apps/language_server/lib/language_server/experimental/protocol/id.ex +++ /dev/null @@ -1,7 +0,0 @@ -defmodule ElixirLS.LanguageServer.Experimental.Protocol.Id do - def next do - [:monotonic, :positive] - |> System.unique_integer() - |> to_string() - end -end diff --git a/apps/language_server/lib/language_server/experimental/protocol/notifications.ex b/apps/language_server/lib/language_server/experimental/protocol/notifications.ex deleted file mode 100644 index 305944c12..000000000 --- a/apps/language_server/lib/language_server/experimental/protocol/notifications.ex +++ /dev/null @@ -1,70 +0,0 @@ -defmodule LSP.Notifications do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - alias LSP.Types - - defmodule Initialized do - use Proto - defnotification "initialized", :shared - end - - defmodule Cancel do - use Proto - - defnotification "$/cancelRequest", :shared, id: integer() - end - - defmodule DidOpen do - use Proto - - defnotification "textDocument/didOpen", :shared, text_document: Types.TextDocument.Item - end - - defmodule DidClose do - use Proto - - defnotification "textDocument/didClose", :shared, text_document: Types.TextDocument.Identifier - end - - defmodule DidChange do - use Proto - - defnotification "textDocument/didChange", :shared, - text_document: Types.TextDocument.Versioned.Identifier, - content_changes: - list_of( - one_of([ - Types.TextDocument.ContentChangeEvent.TextDocumentContentChangeEvent, - Types.TextDocument.ContentChangeEvent.TextDocumentContentChangeEvent1 - ]) - ) - end - - defmodule DidChangeConfiguration do - use Proto - - defnotification "workspace/didChangeConfiguration", :shared, settings: map_of(any()) - end - - defmodule DidChangeWatchedFiles do - use Proto - - defnotification "workspace/didChangeWatchedFiles", :shared, changes: list_of(Types.FileEvent) - end - - defmodule DidSave do - use Proto - - defnotification "textDocument/didSave", :shared, text_document: Types.TextDocument.Identifier - end - - defmodule PublishDiagnostics do - use Proto - - defnotification "textDocument/publishDiagnostics", :shared, - uri: string(), - version: optional(integer()), - diagnostics: list_of(Types.Diagnostic) - end - - use Proto, decoders: :notifications -end diff --git a/apps/language_server/lib/language_server/experimental/protocol/proto.ex b/apps/language_server/lib/language_server/experimental/protocol/proto.ex deleted file mode 100644 index 8a38117c9..000000000 --- a/apps/language_server/lib/language_server/experimental/protocol/proto.ex +++ /dev/null @@ -1,48 +0,0 @@ -defmodule ElixirLS.LanguageServer.Experimental.Protocol.Proto do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto.Decoders - - defmacro __using__([]) do - quote location: :keep do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto.LspTypes - - import ElixirLS.LanguageServer.Experimental.Protocol.Proto.TypeFunctions - import Proto.Alias, only: [defalias: 1] - import Proto.Enum, only: [defenum: 1] - import Proto.Notification, only: [defnotification: 2, defnotification: 3] - import Proto.Request, only: [defrequest: 3] - import Proto.Response, only: [defresponse: 1] - import Proto.Type, only: [deftype: 1] - end - end - - defmacro __using__(opts) when is_list(opts) do - function_name = - case Keyword.get(opts, :decoders) do - :notifications -> - :for_notifications - - :requests -> - :for_requests - - _ -> - invalid_decoder!(__CALLER__) - end - - quote do - @before_compile {Decoders, unquote(function_name)} - end - end - - defmacro __using__(_) do - invalid_decoder!(__CALLER__) - end - - defp invalid_decoder!(caller) do - raise CompileError.exception( - description: "Invalid decoder type. Must be either :notifications or :requests", - file: caller.file, - line: caller.line - ) - end -end diff --git a/apps/language_server/lib/language_server/experimental/protocol/proto/alias.ex b/apps/language_server/lib/language_server/experimental/protocol/proto/alias.ex deleted file mode 100644 index 7ba249ce6..000000000 --- a/apps/language_server/lib/language_server/experimental/protocol/proto/alias.ex +++ /dev/null @@ -1,22 +0,0 @@ -defmodule ElixirLS.LanguageServer.Experimental.Protocol.Proto.Alias do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto.CompileMetadata - - defmacro defalias(alias_definition) do - caller_module = __CALLER__.module - CompileMetadata.add_type_alias_module(caller_module) - - quote location: :keep do - def definition do - unquote(alias_definition) - end - - def __meta__(:type) do - :type_alias - end - - def __meta__(:param_names) do - [] - end - end - end -end diff --git a/apps/language_server/lib/language_server/experimental/protocol/proto/compile_metadata.ex b/apps/language_server/lib/language_server/experimental/protocol/proto/compile_metadata.ex deleted file mode 100644 index b8011396b..000000000 --- a/apps/language_server/lib/language_server/experimental/protocol/proto/compile_metadata.ex +++ /dev/null @@ -1,62 +0,0 @@ -defmodule ElixirLS.LanguageServer.Experimental.Protocol.Proto.CompileMetadata do - @moduledoc """ - Compile-time storage of protocol metadata - """ - - @notification_modules_key {__MODULE__, :notification_modules} - @type_modules_key {__MODULE__, :type_modules} - @type_alias_modules_key {__MODULE__, :type_alias_modules} - @request_modules_key {__MODULE__, :request_modules} - @response_modules_key {__MODULE__, :response_modules} - - def notification_modules do - :persistent_term.get(@notification_modules_key, []) - end - - def request_modules do - :persistent_term.get(@request_modules_key, []) - end - - def response_modules do - :persistent_term.get(@response_modules_key, []) - end - - def type_alias_modules do - :persistent_term.get(@type_alias_modules_key) - end - - def type_modules do - :persistent_term.get(@type_modules_key) - end - - def add_notification_module(module) do - add_module(@notification_modules_key, module) - end - - def add_request_module(module) do - add_module(@request_modules_key, module) - end - - def add_response_module(module) do - add_module(@response_modules_key, module) - end - - def add_type_module(module) do - add_module(@type_modules_key, module) - end - - def add_type_alias_module(module) do - add_module(@type_alias_modules_key, module) - end - - defp update(key, initial_value, update_fn) do - case :persistent_term.get(key, :not_found) do - :not_found -> :persistent_term.put(key, initial_value) - found -> :persistent_term.put(key, update_fn.(found)) - end - end - - defp add_module(key, module) do - update(key, [module], fn old_list -> [module | old_list] end) - end -end diff --git a/apps/language_server/lib/language_server/experimental/protocol/proto/convert.ex b/apps/language_server/lib/language_server/experimental/protocol/proto/convert.ex deleted file mode 100644 index 47fdc68f9..000000000 --- a/apps/language_server/lib/language_server/experimental/protocol/proto/convert.ex +++ /dev/null @@ -1,96 +0,0 @@ -defmodule ElixirLS.LanguageServer.Experimental.Protocol.Proto.Convert do - alias ElixirLS.LanguageServer.SourceFile - alias LSP.Types - alias ElixirLS.LanguageServer.Experimental.SourceFile.Conversions - alias ElixirLS.LanguageServer.Experimental.SourceFile - - def to_elixir(%{lsp: lsp_request} = request) do - with {:ok, elixir_request, source_file} <- convert(lsp_request) do - updated_request = - case Map.merge(request, Map.from_struct(elixir_request)) do - %_{source_file: _} = updated -> Map.put(updated, :source_file, source_file) - updated -> updated - end - - {:ok, updated_request} - end - end - - def to_elixir(%_request_module{lsp: lsp_request} = request) do - converted = Map.merge(request, Map.from_struct(lsp_request)) - {:ok, converted} - end - - def to_elixir(request) do - request = Map.merge(request, Map.from_struct(request.lsp)) - - {:ok, request} - end - - defp fetch_source_file(%{text_document: %{uri: uri}}) do - SourceFile.Store.fetch(uri) - end - - defp fetch_source_file(%{source_file: %SourceFile{} = source_file}) do - {:ok, source_file} - end - - defp fetch_source_file(_) do - :error - end - - defp convert(%_{text_document: _} = request) do - with {:ok, source_file} <- fetch_source_file(request), - {:ok, converted} <- convert(request, source_file) do - {:ok, converted, source_file} - end - end - - defp convert(%_{} = request) do - {:ok, request, nil} - end - - defp convert(%Types.Range{} = range, %SourceFile{} = source_file) do - Conversions.to_elixir(range, source_file) - end - - defp convert(%Types.Position{} = pos, %SourceFile{} = source_file) do - Conversions.to_elixir(pos, source_file) - end - - defp convert(%_struct{} = request, %SourceFile{} = source_file) do - kvps = - request - |> Map.from_struct() - |> Enum.reduce(request, fn {key, value}, request -> - {:ok, value} = convert(value, source_file) - Map.put(request, key, value) - end) - - {:ok, Map.merge(request, kvps)} - end - - defp convert(list, %SourceFile{} = source_file) when is_list(list) do - items = - Enum.map(list, fn item -> - {:ok, item} = convert(item, source_file) - item - end) - - {:ok, items} - end - - defp convert(%{} = map, %SourceFile{} = source_file) do - converted = - Map.new(map, fn {k, v} -> - {:ok, converted} = convert(v, source_file) - {k, converted} - end) - - {:ok, converted} - end - - defp convert(item, %SourceFile{} = _) do - {:ok, item} - end -end diff --git a/apps/language_server/lib/language_server/experimental/protocol/proto/decoders.ex b/apps/language_server/lib/language_server/experimental/protocol/proto/decoders.ex deleted file mode 100644 index ef1c8f115..000000000 --- a/apps/language_server/lib/language_server/experimental/protocol/proto/decoders.ex +++ /dev/null @@ -1,184 +0,0 @@ -defmodule ElixirLS.LanguageServer.Experimental.Protocol.Proto.Decoders do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto.CompileMetadata - - defmacro for_notifications(_) do - notification_modules = CompileMetadata.notification_modules() - notification_matchers = Enum.map(notification_modules, &build_notification_matcher_macro/1) - notification_decoders = Enum.map(notification_modules, &build_notifications_decoder/1) - access_map = build_acces_map(notification_modules) - - quote do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto.Convert - - defmacro notification(method) do - quote do - %{"method" => unquote(method), "jsonrpc" => "2.0"} - end - end - - defmacro notification(method, params) do - quote do - %{"method" => unquote(method), "params" => unquote(params), "jsonrpc" => "2.0"} - end - end - - unquote(build_typespec(:notification, notification_modules)) - - unquote_splicing(notification_matchers) - - @spec decode(String.t(), map()) :: {:ok, notification} | {:error, any} - unquote_splicing(notification_decoders) - - def decode(method, _) do - {:error, {:unknown_notification, method}} - end - - def __meta__(:events) do - unquote(notification_modules) - end - - def __meta__(:notifications) do - unquote(notification_modules) - end - - def __meta__(:access) do - %{unquote_splicing(access_map)} - end - - def to_elixir(%{lsp: _} = request_or_notification) do - Convert.to_elixir(request_or_notification) - end - end - end - - defmacro for_requests(_) do - request_modules = CompileMetadata.request_modules() - request_matchers = Enum.map(request_modules, &build_request_matcher_macro/1) - request_decoders = Enum.map(request_modules, &build_request_decoder/1) - access_map = build_acces_map(request_modules) - - quote do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto.Convert - - def __meta__(:requests) do - unquote(request_modules) - end - - def __meta__(:access) do - %{unquote_splicing(access_map)} - end - - defmacro request(id, method) do - quote do - %{"method" => unquote(method), "id" => unquote(id), "jsonrpc" => "2.0"} - end - end - - defmacro request(id, method, params) do - quote do - %{"method" => unquote(method), "id" => unquote(id), "params" => unquote(params)} - end - end - - unquote(build_typespec(:request, request_modules)) - - unquote_splicing(request_matchers) - - @spec decode(String.t(), map()) :: {:ok, request} | {:error, any} - unquote_splicing(request_decoders) - - def decode(method, _) do - {:error, {:unknown_request, method}} - end - - def to_elixir(%{lsp: _} = request_or_notification) do - Convert.to_elixir(request_or_notification) - end - end - end - - defp build_acces_map(modules) do - Enum.map(modules, fn module -> - quote(do: {unquote(module.method()), unquote(module.__meta__(:access))}) - end) - end - - defp build_notification_matcher_macro(notification_module) do - macro_name = module_to_macro_name(notification_module) - method_name = notification_module.__meta__(:method_name) - - quote do - defmacro unquote(macro_name)() do - method_name = unquote(method_name) - - quote do - %{"method" => unquote(method_name), "jsonrpc" => "2.0"} - end - end - end - end - - defp build_notifications_decoder(notification_module) do - method_name = notification_module.__meta__(:method_name) - - quote do - def decode(unquote(method_name), request) do - unquote(notification_module).parse(request) - end - end - end - - defp build_request_matcher_macro(notification_module) do - macro_name = module_to_macro_name(notification_module) - method_name = notification_module.__meta__(:method_name) - - quote do - defmacro unquote(macro_name)(id) do - method_name = unquote(method_name) - - quote do - %{"method" => unquote(method_name), "id" => unquote(id), "jsonrpc" => "2.0"} - end - end - end - end - - defp build_request_decoder(request_module) do - method_name = request_module.__meta__(:method_name) - - quote do - def decode(unquote(method_name), request) do - unquote(request_module).parse(request) - end - end - end - - def build_typespec(type_name, modules) do - spec_name = {type_name, [], nil} - - spec = - Enum.reduce(modules, nil, fn - module, nil -> - quote do - unquote(module).t() - end - - module, spec -> - quote do - unquote(module).t() | unquote(spec) - end - end) - - quote do - @type unquote(spec_name) :: unquote(spec) - end - end - - defp module_to_macro_name(module) do - module - |> Module.split() - |> List.last() - |> Macro.underscore() - |> String.to_atom() - end -end diff --git a/apps/language_server/lib/language_server/experimental/protocol/proto/enum.ex b/apps/language_server/lib/language_server/experimental/protocol/proto/enum.ex deleted file mode 100644 index 7549d1a89..000000000 --- a/apps/language_server/lib/language_server/experimental/protocol/proto/enum.ex +++ /dev/null @@ -1,54 +0,0 @@ -defmodule ElixirLS.LanguageServer.Experimental.Protocol.Proto.Enum do - defmacro defenum(opts) do - parse_functions = - for {name, value} <- opts do - quote location: :keep do - def parse(unquote(value)) do - {:ok, unquote(name)} - end - end - end - - enum_macros = - for {name, value} <- opts do - quote location: :keep do - defmacro unquote(name)() do - unquote(value) - end - end - end - - encoders = - for {name, value} <- opts do - quote location: :keep do - def encode(unquote(name)) do - {:ok, unquote(value)} - end - end - end - - quote location: :keep do - unquote(parse_functions) - - def parse(unknown) do - {:error, {:invalid_constant, unknown}} - end - - unquote_splicing(encoders) - - def encode(val) do - {:error, {:invalid_value, __MODULE__, val}} - end - - unquote_splicing(enum_macros) - - def __meta__(:types) do - {:constant, __MODULE__} - end - - def __meta__(:type) do - :enum - end - end - end -end diff --git a/apps/language_server/lib/language_server/experimental/protocol/proto/field.ex b/apps/language_server/lib/language_server/experimental/protocol/proto/field.ex deleted file mode 100644 index 1c49fe363..000000000 --- a/apps/language_server/lib/language_server/experimental/protocol/proto/field.ex +++ /dev/null @@ -1,287 +0,0 @@ -defmodule ElixirLS.LanguageServer.Experimental.Protocol.Proto.Field do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto.Text - - def extract(:any, _, value) do - {:ok, value} - end - - def extract({:literal, same_value}, _name, same_value) do - {:ok, same_value} - end - - def extract({:optional, _}, _name, nil) do - {:ok, nil} - end - - def extract({:optional, type}, name, orig_val) do - extract(type, name, orig_val) - end - - def extract({:one_of, type_list}, name, value) do - result = - Enum.reduce_while(type_list, nil, fn type, _acc -> - case extract(type, name, value) do - {:ok, _} = success -> {:halt, success} - error -> {:cont, error} - end - end) - - case result do - {:ok, _} = success -> success - _error -> {:error, {:incorrect_type, type_list, value}} - end - end - - def extract({:list, list_type}, name, orig_value) when is_list(orig_value) do - result = - Enum.reduce_while(orig_value, [], fn orig, acc -> - case extract(list_type, name, orig) do - {:ok, value} -> {:cont, [value | acc]} - error -> {:halt, error} - end - end) - - case result do - value_list when is_list(value_list) -> {:ok, Enum.reverse(value_list)} - error -> error - end - end - - def extract(:integer, _name, orig_value) when is_integer(orig_value) do - {:ok, orig_value} - end - - def extract(:float, _name, orig_value) when is_float(orig_value) do - {:ok, orig_value} - end - - def extract(:string, _name, orig_value) when is_binary(orig_value) do - {:ok, orig_value} - end - - def extract(:boolean, _name, orig_value) when is_boolean(orig_value) do - {:ok, orig_value} - end - - def extract({:type_alias, alias_module}, name, orig_value) do - extract(alias_module.definition(), name, orig_value) - end - - def extract(module, _name, orig_value) - when is_atom(module) and module not in [:integer, :string, :boolean, :float] do - module.parse(orig_value) - end - - def extract({:map, type, _opts}, field_name, field_value) - when is_map(field_value) do - result = - Enum.reduce_while(field_value, [], fn {k, v}, acc -> - case extract(type, field_name, v) do - {:ok, value} -> {:cont, [{k, value} | acc]} - error -> {:halt, error} - end - end) - - case result do - values when is_list(values) -> {:ok, Map.new(values)} - error -> error - end - end - - def extract({:tuple, tuple_types}, field_name, field_value) when is_list(field_value) do - result = - field_value - |> Enum.zip(tuple_types) - |> Enum.reduce_while([], fn {value, type}, acc -> - case extract(type, field_name, value) do - {:ok, value} -> {:cont, [value | acc]} - error -> {:halt, error} - end - end) - - case result do - value when is_list(value) -> - value_as_tuple = - value - |> Enum.reverse() - |> List.to_tuple() - - {:ok, value_as_tuple} - - error -> - error - end - end - - def extract({:params, param_defs}, _field_name, field_value) - when is_map(field_value) do - result = - Enum.reduce_while(param_defs, [], fn {param_name, param_type}, acc -> - value = Map.get(field_value, Text.camelize(param_name)) - - case extract(param_type, param_name, value) do - {:ok, value} -> {:cont, [{param_name, value} | acc]} - error -> {:halt, error} - end - end) - - case result do - values when is_list(values) -> {:ok, Map.new(values)} - error -> error - end - end - - def extract(_type, name, orig_value) do - {:error, {:invalid_value, name, orig_value}} - end - - def encode(:any, field_value) do - {:ok, field_value} - end - - def encode({:literal, value}, _) do - {:ok, value} - end - - def encode({:optional, _}, nil) do - {:ok, :"$__drop__"} - end - - def encode({:optional, field_type}, field_value) do - encode(field_type, field_value) - end - - def encode({:one_of, types}, field_value) do - encoded = - Enum.reduce_while(types, nil, fn type, _ -> - case encode(type, field_value) do - {:ok, _} = success -> {:halt, success} - error -> {:cont, error} - end - end) - - case encoded do - encoded_list when is_list(encoded_list) -> {:ok, encoded_list} - error -> error - end - end - - def encode({:list, list_type}, field_value) when is_list(field_value) do - encoded = - Enum.reduce_while(field_value, [], fn element, acc -> - case encode(list_type, element) do - {:ok, encoded} -> {:cont, [encoded | acc]} - error -> {:halt, error} - end - end) - - case encoded do - encoded_list when is_list(encoded_list) -> - {:ok, Enum.reverse(encoded_list)} - - error -> - error - end - end - - def encode(:integer, field_value) when is_integer(field_value) do - {:ok, field_value} - end - - def encode(:integer, string_value) when is_binary(string_value) do - case Integer.parse(string_value) do - {int_value, ""} -> {:ok, int_value} - _ -> {:error, {:invalid_integer, string_value}} - end - end - - def encode(:float, float_value) when is_float(float_value) do - {:ok, float_value} - end - - def encode(:float, field_value) when is_float(field_value) do - field_value - end - - def encode(:string, field_value) when is_binary(field_value) do - {:ok, field_value} - end - - def encode(:boolean, field_value) when is_boolean(field_value) do - {:ok, field_value} - end - - def encode({:map, value_type, _}, field_value) when is_map(field_value) do - map_fields = - Enum.reduce_while(field_value, [], fn {key, value}, acc -> - case encode(value_type, value) do - {:ok, encoded_value} -> {:cont, [{key, encoded_value} | acc]} - error -> {:halt, error} - end - end) - - case map_fields do - fields when is_list(fields) -> {:ok, Map.new(fields)} - error -> error - end - end - - def encode({:tuple, types}, field_value) when is_tuple(field_value) do - encoded = - field_value - |> Tuple.to_list() - |> Enum.zip(types) - |> Enum.reduce_while([], fn {value, type}, acc -> - case encode(type, value) do - {:ok, encoded} -> {:cont, [encoded | acc]} - error -> {:halt, error} - end - end) - - case encoded do - encoded_list when is_list(encoded_list) -> {:ok, Enum.reverse(encoded_list)} - error -> error - end - end - - def encode({:params, param_defs}, field_value) when is_map(field_value) do - param_fields = - Enum.reduce_while(param_defs, [], fn {param_name, param_type}, acc -> - unencoded = Map.get(field_value, param_name) - - case encode(param_type, unencoded) do - {:ok, encoded_value} -> {:cont, [{param_name, encoded_value} | acc]} - error -> {:halt, error} - end - end) - - case param_fields do - fields when is_list(fields) -> {:ok, Map.new(fields)} - error -> error - end - end - - def encode({:constant, constant_module}, field_value) do - {:ok, constant_module.encode(field_value)} - end - - def encode({:type_alias, alias_module}, field_value) do - encode(alias_module.definition(), field_value) - end - - def encode(module, field_value) when is_atom(module) do - if function_exported?(module, :encode, 1) do - module.encode(field_value) - else - {:ok, field_value} - end - end - - def encode(_, nil) do - nil - end - - def encode(type, value) do - {:error, {:invalid_type, type, value}} - end -end diff --git a/apps/language_server/lib/language_server/experimental/protocol/proto/lsp_types.ex b/apps/language_server/lib/language_server/experimental/protocol/proto/lsp_types.ex deleted file mode 100644 index 388f75d2f..000000000 --- a/apps/language_server/lib/language_server/experimental/protocol/proto/lsp_types.ex +++ /dev/null @@ -1,41 +0,0 @@ -defmodule ElixirLS.LanguageServer.Experimental.Protocol.Proto.LspTypes do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - use Proto - - defmodule ErrorCodes do - use Proto - - defenum parse_error: -32700, - invalid_request: -32600, - method_not_found: -32601, - invalid_params: -32602, - internal_error: -32603, - server_not_initialized: -32002, - unknown_error_code: -32001, - request_failed: -32803, - server_cancelled: -32802, - content_modified: -32801, - request_cancelled: -32800 - end - - defmodule ResponseError do - use Proto - deftype code: ErrorCodes, message: string(), data: optional(any()) - end - - defmodule ClientInfo do - use Proto - deftype name: string(), version: optional(string()) - end - - defmodule TraceValue do - use Proto - defenum off: "off", messages: "messages", verbose: "verbose" - end - - defmodule Registration do - use Proto - - deftype id: string(), method: string(), register_options: optional(any()) - end -end diff --git a/apps/language_server/lib/language_server/experimental/protocol/proto/macros/access.ex b/apps/language_server/lib/language_server/experimental/protocol/proto/macros/access.ex deleted file mode 100644 index 181c4ad94..000000000 --- a/apps/language_server/lib/language_server/experimental/protocol/proto/macros/access.ex +++ /dev/null @@ -1,34 +0,0 @@ -defmodule ElixirLS.LanguageServer.Experimental.Protocol.Proto.Macros.Access do - def build do - quote location: :keep do - def fetch(proto, key) when is_map_key(proto, key) do - {:ok, Map.get(proto, key)} - end - - def fetch(_, _) do - :error - end - - def get_and_update(proto, key, function) when is_map_key(proto, key) do - old_value = Map.get(proto, key) - - case function.(old_value) do - {current_value, updated_value} -> {current_value, Map.put(proto, key, updated_value)} - :pop -> {old_value, Map.put(proto, key, nil)} - end - end - - def get_and_update(proto, key, function) do - {{:error, {:nonexistent_key, key}}, proto} - end - - def pop(proto, key) when is_map_key(proto, key) do - {Map.get(proto, key), proto} - end - - def pop(proto, _key) do - {nil, proto} - end - end - end -end diff --git a/apps/language_server/lib/language_server/experimental/protocol/proto/macros/inspect.ex b/apps/language_server/lib/language_server/experimental/protocol/proto/macros/inspect.ex deleted file mode 100644 index 9a2896726..000000000 --- a/apps/language_server/lib/language_server/experimental/protocol/proto/macros/inspect.ex +++ /dev/null @@ -1,36 +0,0 @@ -defmodule ElixirLS.LanguageServer.Experimental.Protocol.Proto.Macros.Inspect do - def build(dest_module) do - trimmed_name = trim_module_name(dest_module) - - quote location: :keep do - defimpl Inspect, for: unquote(dest_module) do - import Inspect.Algebra - - def inspect(proto_type, opts) do - proto_map = Map.from_struct(proto_type) - concat(["%#{unquote(trimmed_name)}", to_doc(proto_map, opts), ""]) - end - end - end - end - - def trim_module_name(long_name) do - {sub_modules, _} = - long_name - |> Module.split() - |> Enum.reduce({[], false}, fn - "Protocol", _ -> - {["Protocol"], true} - - _ignored_module, {_, false} = state -> - state - - submodule, {mod_list, true} -> - {[submodule | mod_list], true} - end) - - sub_modules - |> Enum.reverse() - |> Enum.join(".") - end -end diff --git a/apps/language_server/lib/language_server/experimental/protocol/proto/macros/json.ex b/apps/language_server/lib/language_server/experimental/protocol/proto/macros/json.ex deleted file mode 100644 index 6fe09ee57..000000000 --- a/apps/language_server/lib/language_server/experimental/protocol/proto/macros/json.ex +++ /dev/null @@ -1,46 +0,0 @@ -defmodule ElixirLS.LanguageServer.Experimental.Protocol.Proto.Macros.Json do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto.Field - - def build(dest_module) do - quote location: :keep do - defimpl JasonV.Encoder, for: unquote(dest_module) do - def encode(%struct_module{} = value, opts) do - encoded_pairs = - for {field_name, field_type} <- unquote(dest_module).__meta__(:types), - field_value = get_field_value(value, field_name), - {:ok, encoded_value} = Field.encode(field_type, field_value), - encoded_value != :"$__drop__" do - {field_name, encoded_value} - end - - encoded_pairs - |> Enum.flat_map(fn - # flatten the spread into the current map - {:.., value} when is_map(value) -> Enum.to_list(value) - {k, v} -> [{camelize(k), v}] - end) - |> JasonV.Encode.keyword(opts) - end - - defp get_field_value(%struct_module{} = struct, :..) do - get_field_value(struct, struct_module.__meta__(:spread_alias)) - end - - defp get_field_value(struct, field_name) do - Map.get(struct, field_name) - end - - def camelize(field_name) do - field_name - |> to_string() - |> Macro.camelize() - |> downcase_first() - end - - defp downcase_first(<>) do - String.downcase(c) <> rest - end - end - end - end -end diff --git a/apps/language_server/lib/language_server/experimental/protocol/proto/macros/match.ex b/apps/language_server/lib/language_server/experimental/protocol/proto/macros/match.ex deleted file mode 100644 index 6b37e3e8e..000000000 --- a/apps/language_server/lib/language_server/experimental/protocol/proto/macros/match.ex +++ /dev/null @@ -1,20 +0,0 @@ -defmodule ElixirLS.LanguageServer.Experimental.Protocol.Proto.Macros.Match do - def build(field_types, dest_module) do - macro_name = - dest_module - |> Macro.underscore() - |> String.replace("/", "_") - |> String.to_atom() - - quote location: :keep do - defmacro unquote(macro_name)(opts \\ []) do - cond do - Keyword.keyword?(opts) -> - %unquote(dest_module){unquote_splicing(field_types)} - end - end - end - - nil - end -end diff --git a/apps/language_server/lib/language_server/experimental/protocol/proto/macros/message.ex b/apps/language_server/lib/language_server/experimental/protocol/proto/macros/message.ex deleted file mode 100644 index 9b2fa8e96..000000000 --- a/apps/language_server/lib/language_server/experimental/protocol/proto/macros/message.ex +++ /dev/null @@ -1,64 +0,0 @@ -defmodule ElixirLS.LanguageServer.Experimental.Protocol.Proto.Macros.Message do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto.Macros.{ - Access, - Struct, - Parse, - Typespec, - Meta - } - - alias ElixirLS.LanguageServer.Experimental.SourceFile - - def build(meta_type, method, access, types, param_names, opts \\ []) do - parse_fn = - if Keyword.get(opts, :include_parse?, true) do - Parse.build(types) - end - - quote do - unquote(Access.build()) - unquote(Struct.build(types)) - unquote(Typespec.build()) - unquote(parse_fn) - unquote(Meta.build(types)) - - def method do - unquote(method) - end - - def __meta__(:method_name) do - unquote(method) - end - - def __meta__(:type) do - unquote(meta_type) - end - - def __meta__(:param_names) do - unquote(param_names) - end - - def __meta__(:access) do - unquote(access) - end - end - end - - def generate_elixir_types(caller_module, message_types) do - message_types - |> Enum.reduce(message_types, fn - {:text_document, _}, types -> - Keyword.put(types, :source_file, quote(do: SourceFile)) - - {:position, _}, types -> - Keyword.put(types, :position, quote(do: SourceFile.Position)) - - {:range, _}, types -> - Keyword.put(types, :range, quote(do: SourceFile.Range)) - - _, types -> - types - end) - |> Keyword.put(:lsp, quote(do: unquote(caller_module).LSP)) - end -end diff --git a/apps/language_server/lib/language_server/experimental/protocol/proto/macros/meta.ex b/apps/language_server/lib/language_server/experimental/protocol/proto/macros/meta.ex deleted file mode 100644 index d4ff9d4a0..000000000 --- a/apps/language_server/lib/language_server/experimental/protocol/proto/macros/meta.ex +++ /dev/null @@ -1,37 +0,0 @@ -defmodule ElixirLS.LanguageServer.Experimental.Protocol.Proto.Macros.Meta do - def build(opts) do - field_types = - for {field_name, field_type} <- opts do - field_meta(field_name, field_type) - end - - quote location: :keep do - unquote_splicing(field_types) - - def __meta__(:types) do - %{unquote_splicing(opts)} - end - end - end - - defp field_meta(:.., {:map_of, ctx, [key_type, [as: key_alias]]}) do - # a spread operator, generate meta for both the spread name and the aliased name - - quote do - def __meta__(:spread_alias) do - unquote(key_alias) - end - - unquote(field_meta(:.., {:map_of, ctx, [key_type]})) - unquote(field_meta(key_alias, {:map_of, ctx, [key_type]})) - end - end - - defp field_meta(field_name, field_type) do - quote location: :keep do - def __meta__(:type, unquote(field_name)) do - unquote(field_type) - end - end - end -end diff --git a/apps/language_server/lib/language_server/experimental/protocol/proto/macros/parse.ex b/apps/language_server/lib/language_server/experimental/protocol/proto/macros/parse.ex deleted file mode 100644 index d7db9c896..000000000 --- a/apps/language_server/lib/language_server/experimental/protocol/proto/macros/parse.ex +++ /dev/null @@ -1,140 +0,0 @@ -defmodule ElixirLS.LanguageServer.Experimental.Protocol.Proto.Macros.Parse do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto.Field - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto.Text - - def build(opts) do - {optional_opts, required_opts} = - Enum.split_with(opts, fn - {_key, {:optional, _, _}} -> true - {:.., _} -> true - _ -> false - end) - - {splat_opt, optional_opts} = Keyword.pop(optional_opts, :..) - - required_keys = Keyword.keys(required_opts) - - map_parameter_var = - if Enum.empty?(optional_opts) && is_nil(splat_opt) do - Macro.var(:_, nil) - else - Macro.var(:json_rpc_message, nil) - end - - struct_keys = Keyword.keys(opts) - - map_vars = Map.new(struct_keys, fn k -> {k, Macro.var(k, nil)} end) - - map_keys = Enum.map(required_keys, &Text.camelize/1) - - map_pairs = - map_vars - |> Map.take(required_keys) - |> Enum.map(fn {k, v} -> {Text.camelize(k), v} end) - - map_extractors = map_extractor(map_pairs) - - required_extractors = - for {field_name, field_type} <- required_opts do - quote location: :keep do - {unquote(field_name), - Field.extract( - unquote(field_type), - unquote(field_name), - unquote(Map.get(map_vars, field_name)) - )} - end - end - - optional_extractors = - for {field_name, field_type} <- optional_opts do - quote location: :keep do - {unquote(field_name), - Field.extract( - unquote(field_type), - unquote(field_name), - Map.get(unquote(map_parameter_var), unquote(Text.camelize(field_name))) - )} - end - end - - splat_extractors = - if splat_opt do - known_keys = opts |> Keyword.keys() |> Enum.map(&Text.camelize/1) - - quoted_extractor = - quote location: :keep do - {(fn -> - {:map, _, field_name} = unquote(splat_opt) - field_name - end).(), - Field.extract( - unquote(splat_opt), - :.., - unquote(map_parameter_var) - |> Enum.reject(fn {k, _} -> k in unquote(known_keys) end) - |> Map.new() - )} - end - - [quoted_extractor] - else - [] - end - - all_extractors = required_extractors ++ optional_extractors ++ splat_extractors - error_parse = maybe_build_error_parse(required_extractors, map_keys) - - quote location: :keep do - def parse(unquote(map_extractors) = unquote(map_parameter_var)) do - result = - unquote(all_extractors) - |> Enum.reduce_while([], fn - {field, {:ok, result}}, acc -> - {:cont, [{field, result} | acc]} - - {field, {:error, _} = err}, acc -> - {:halt, err} - end) - - case result do - {:error, _} = err -> err - keyword when is_list(keyword) -> {:ok, struct(__MODULE__, keyword)} - end - end - - unquote(error_parse) - - def parse(not_map) do - {:error, {:invalid_map, not_map}} - end - end - end - - defp maybe_build_error_parse([], _) do - end - - defp maybe_build_error_parse(_, map_keys) do - # this is only built if there are required fields - quote do - def parse(%{} = unmatched) do - missing_keys = - Enum.reduce(unquote(map_keys), [], fn key, acc -> - if Map.has_key?(unmatched, key) do - acc - else - [key | acc] - end - end) - - {:error, {:missing_keys, missing_keys, __MODULE__}} - end - end - end - - defp map_extractor(map_pairs) do - quote location: :keep do - %{unquote_splicing(map_pairs)} - end - end -end diff --git a/apps/language_server/lib/language_server/experimental/protocol/proto/macros/struct.ex b/apps/language_server/lib/language_server/experimental/protocol/proto/macros/struct.ex deleted file mode 100644 index 2fece5328..000000000 --- a/apps/language_server/lib/language_server/experimental/protocol/proto/macros/struct.ex +++ /dev/null @@ -1,48 +0,0 @@ -defmodule ElixirLS.LanguageServer.Experimental.Protocol.Proto.Macros.Struct do - def build(opts) do - keys = Keyword.keys(opts) - required_keys = required_keys(opts) - - keys = - if :.. in keys do - {splat_def, rest} = Keyword.pop(opts, :..) - - quote location: :keep do - [ - (fn -> - {_, _, field_name} = unquote(splat_def) - field_name - end).() - | unquote(rest) - ] - end - else - keys - end - - quote location: :keep do - @enforce_keys unquote(required_keys) - defstruct unquote(keys) - - def new(opts \\ []) do - struct!(__MODULE__, opts) - end - - defoverridable new: 0, new: 1 - end - end - - defp required_keys(opts) do - Enum.filter(opts, fn - # ignore the splat, it's always optional - {:.., _} -> false - # an optional signifier tuple - {_, {:optional, _}} -> false - # ast for an optional signifier tuple - {_, {:optional, _, _}} -> false - # everything else is required - _ -> true - end) - |> Keyword.keys() - end -end diff --git a/apps/language_server/lib/language_server/experimental/protocol/proto/macros/typespec.ex b/apps/language_server/lib/language_server/experimental/protocol/proto/macros/typespec.ex deleted file mode 100644 index fa20c4da6..000000000 --- a/apps/language_server/lib/language_server/experimental/protocol/proto/macros/typespec.ex +++ /dev/null @@ -1,7 +0,0 @@ -defmodule ElixirLS.LanguageServer.Experimental.Protocol.Proto.Macros.Typespec do - def build(_opts \\ []) do - quote do - @type t :: %__MODULE__{} - end - end -end diff --git a/apps/language_server/lib/language_server/experimental/protocol/proto/notification.ex b/apps/language_server/lib/language_server/experimental/protocol/proto/notification.ex deleted file mode 100644 index 97692cc9e..000000000 --- a/apps/language_server/lib/language_server/experimental/protocol/proto/notification.ex +++ /dev/null @@ -1,88 +0,0 @@ -defmodule ElixirLS.LanguageServer.Experimental.Protocol.Proto.Notification do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto.CompileMetadata - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto.Macros.Message - - defmacro defnotification(method, access, types \\ []) do - CompileMetadata.add_notification_module(__CALLER__.module) - - jsonrpc_types = [ - jsonrpc: quote(do: literal("2.0")), - method: quote(do: literal(unquote(method))) - ] - - param_names = Keyword.keys(types) - lsp_types = Keyword.merge(jsonrpc_types, types) - elixir_types = Message.generate_elixir_types(__CALLER__.module, lsp_types) - lsp_module_name = Module.concat(__CALLER__.module, LSP) - - quote location: :keep do - defmodule LSP do - unquote(Message.build({:notification, :lsp}, method, access, lsp_types, param_names)) - - def new(opts \\ []) do - opts - |> Keyword.merge(method: unquote(method), jsonrpc: "2.0") - |> super() - end - end - - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto.Convert - - unquote( - Message.build({:notification, :elixir}, method, access, elixir_types, param_names, - include_parse?: false - ) - ) - - unquote(build_parse(method)) - - def new(opts \\ []) do - opts = Keyword.merge(opts, method: unquote(method), jsonrpc: "2.0") - - # use struct here because initially, the non-lsp struct doesn't have - # to be filled out. Calling to_elixir fills it out. - struct(__MODULE__, lsp: LSP.new(opts), method: unquote(method), jsonrpc: "2.0") - end - - def to_elixir(%__MODULE__{} = request) do - Convert.to_elixir(request) - end - - defimpl JasonV.Encoder, for: unquote(__CALLER__.module) do - def encode(notification, opts) do - JasonV.Encoder.encode(notification.lsp, opts) - end - end - - defimpl JasonV.Encoder, for: unquote(lsp_module_name) do - def encode(notification, opts) do - %{ - jsonrpc: "2.0", - method: unquote(method), - params: Map.take(notification, unquote(param_names)) - } - |> JasonV.Encode.map(opts) - end - end - end - end - - defp build_parse(method) do - quote do - def parse(%{"method" => unquote(method), "jsonrpc" => "2.0"} = request) do - params = Map.get(request, "params", %{}) - flattened_notificaiton = Map.merge(request, params) - - case LSP.parse(flattened_notificaiton) do - {:ok, raw_lsp} -> - struct_opts = [method: unquote(method), jsonrpc: "2.0", lsp: raw_lsp] - notification = struct(__MODULE__, struct_opts) - {:ok, notification} - - error -> - error - end - end - end - end -end diff --git a/apps/language_server/lib/language_server/experimental/protocol/proto/request.ex b/apps/language_server/lib/language_server/experimental/protocol/proto/request.ex deleted file mode 100644 index 2ff9ad3ff..000000000 --- a/apps/language_server/lib/language_server/experimental/protocol/proto/request.ex +++ /dev/null @@ -1,97 +0,0 @@ -defmodule ElixirLS.LanguageServer.Experimental.Protocol.Proto.Request do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto.CompileMetadata - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto.Macros.Message - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto.TypeFunctions - - import TypeFunctions, only: [optional: 1, literal: 1] - - defmacro defrequest(method, access, types) do - CompileMetadata.add_request_module(__CALLER__.module) - # id is optional so we can resuse the parse function. If it's required, - # it will go in the pattern match for the params, which won't work. - - jsonrpc_types = [ - id: quote(do: optional(one_of([string(), integer()]))), - jsonrpc: quote(do: literal("2.0")), - method: quote(do: literal(unquote(method))) - ] - - lsp_types = Keyword.merge(jsonrpc_types, types) - elixir_types = Message.generate_elixir_types(__CALLER__.module, lsp_types) - param_names = Keyword.keys(types) - lsp_module_name = Module.concat(__CALLER__.module, LSP) - - quote location: :keep do - defmodule LSP do - unquote(Message.build({:request, :lsp}, method, access, lsp_types, param_names)) - - def new(opts \\ []) do - opts - |> Keyword.merge(method: unquote(method), jsonrpc: "2.0") - |> super() - end - end - - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto.Convert - alias LSP.Types - - unquote( - Message.build({:request, :elixir}, method, access, elixir_types, param_names, - include_parse?: false - ) - ) - - unquote(build_parse(method)) - - def new(opts \\ []) do - opts = Keyword.merge(opts, method: unquote(method), jsonrpc: "2.0") - - raw = LSP.new(opts) - # use struct here because initially, the non-lsp struct doesn't have - # to be filled out. Calling to_elixir fills it out. - struct(__MODULE__, lsp: raw, id: raw.id, method: unquote(method), jsonrpc: "2.0") - end - - def to_elixir(%__MODULE__{} = request) do - Convert.to_elixir(request) - end - - defimpl JasonV.Encoder, for: unquote(__CALLER__.module) do - def encode(request, opts) do - JasonV.Encoder.encode(request.lsp, opts) - end - end - - defimpl JasonV.Encoder, for: unquote(lsp_module_name) do - def encode(request, opts) do - %{ - id: request.id, - jsonrpc: "2.0", - method: unquote(method), - params: Map.take(request, unquote(param_names)) - } - |> JasonV.Encode.map(opts) - end - end - end - end - - defp build_parse(method) do - quote do - def parse(%{"method" => unquote(method), "id" => id, "jsonrpc" => "2.0"} = request) do - params = Map.get(request, "params", %{}) - flattened_request = Map.merge(request, params) - - case LSP.parse(flattened_request) do - {:ok, raw_lsp} -> - struct_opts = [id: id, method: unquote(method), jsonrpc: "2.0", lsp: raw_lsp] - request = struct(__MODULE__, struct_opts) - {:ok, request} - - error -> - error - end - end - end - end -end diff --git a/apps/language_server/lib/language_server/experimental/protocol/proto/response.ex b/apps/language_server/lib/language_server/experimental/protocol/proto/response.ex deleted file mode 100644 index 98f5efb7d..000000000 --- a/apps/language_server/lib/language_server/experimental/protocol/proto/response.ex +++ /dev/null @@ -1,58 +0,0 @@ -defmodule ElixirLS.LanguageServer.Experimental.Protocol.Proto.Response do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto.CompileMetadata - - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto.Macros.{ - Access, - Struct, - Typespec, - Json, - Meta - } - - defmacro defresponse(response_type) do - CompileMetadata.add_response_module(__CALLER__.module) - - jsonrpc_types = [ - id: quote(do: optional(one_of([integer(), string()]))), - error: quote(do: optional(LspTypes.ResponseError)), - result: quote(do: optional(unquote(response_type))) - ] - - quote location: :keep do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto.LspTypes - unquote(Json.build(__CALLER__.module)) - unquote(Access.build()) - unquote(Struct.build(jsonrpc_types)) - unquote(Typespec.build()) - unquote(Meta.build(jsonrpc_types)) - - def new(id, result) do - struct(__MODULE__, result: result, id: id) - end - - def error(id, error_code) when is_integer(error_code) do - %__MODULE__{id: id, error: LspTypes.ResponseError.new(code: error_code)} - end - - def error(id, error_code) when is_atom(error_code) do - %__MODULE__{id: id, error: LspTypes.ResponseError.new(code: error_code)} - end - - def error(id, error_code, error_message) - when is_integer(error_code) and is_binary(error_message) do - %__MODULE__{ - id: id, - error: LspTypes.ResponseError.new(code: error_code, message: error_message) - } - end - - def error(id, error_code, error_message) - when is_atom(error_code) and is_binary(error_message) do - %__MODULE__{ - id: id, - error: LspTypes.ResponseError.new(code: error_code, message: error_message) - } - end - end - end -end diff --git a/apps/language_server/lib/language_server/experimental/protocol/proto/text.ex b/apps/language_server/lib/language_server/experimental/protocol/proto/text.ex deleted file mode 100644 index 620eb91c5..000000000 --- a/apps/language_server/lib/language_server/experimental/protocol/proto/text.ex +++ /dev/null @@ -1,10 +0,0 @@ -defmodule ElixirLS.LanguageServer.Experimental.Protocol.Proto.Text do - def camelize(atom) when is_atom(atom) do - atom |> Atom.to_string() |> camelize() - end - - def camelize(string) do - <> = Macro.camelize(string) - String.downcase(first) <> rest - end -end diff --git a/apps/language_server/lib/language_server/experimental/protocol/proto/type.ex b/apps/language_server/lib/language_server/experimental/protocol/proto/type.ex deleted file mode 100644 index d4ad1ef06..000000000 --- a/apps/language_server/lib/language_server/experimental/protocol/proto/type.ex +++ /dev/null @@ -1,38 +0,0 @@ -defmodule ElixirLS.LanguageServer.Experimental.Protocol.Proto.Type do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto.CompileMetadata - - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto.Macros.{ - Access, - Inspect, - Json, - Match, - Meta, - Parse, - Struct, - Typespec - } - - defmacro deftype(types) do - caller_module = __CALLER__.module - CompileMetadata.add_type_module(caller_module) - - quote location: :keep do - unquote(Json.build(caller_module)) - unquote(Inspect.build(caller_module)) - unquote(Access.build()) - unquote(Struct.build(types)) - unquote(Typespec.build(types)) - unquote(Parse.build(types)) - unquote(Match.build(types, caller_module)) - unquote(Meta.build(types)) - - def __meta__(:type) do - :type - end - - def __meta__(:param_names) do - unquote(Keyword.keys(types)) - end - end - end -end diff --git a/apps/language_server/lib/language_server/experimental/protocol/proto/type_functions.ex b/apps/language_server/lib/language_server/experimental/protocol/proto/type_functions.ex deleted file mode 100644 index b1f749667..000000000 --- a/apps/language_server/lib/language_server/experimental/protocol/proto/type_functions.ex +++ /dev/null @@ -1,58 +0,0 @@ -defmodule ElixirLS.LanguageServer.Experimental.Protocol.Proto.TypeFunctions do - def integer do - :integer - end - - def float do - :float - end - - def string do - :string - end - - def boolean do - :boolean - end - - def uri do - :string - end - - def type_alias(alias_module) do - {:type_alias, alias_module} - end - - def literal(what) do - {:literal, what} - end - - def list_of(type) do - {:list, type} - end - - def tuple_of(types) when is_list(types) do - {:tuple, types} - end - - def map_of(type, opts \\ []) do - field_name = Keyword.get(opts, :as) - {:map, type, field_name} - end - - def one_of(options) when is_list(options) do - {:one_of, options} - end - - def optional(type) do - {:optional, type} - end - - def params(opts) do - {:params, opts} - end - - def any do - :any - end -end diff --git a/apps/language_server/lib/language_server/experimental/protocol/requests.ex b/apps/language_server/lib/language_server/experimental/protocol/requests.ex deleted file mode 100644 index eee1aa669..000000000 --- a/apps/language_server/lib/language_server/experimental/protocol/requests.ex +++ /dev/null @@ -1,65 +0,0 @@ -defmodule LSP.Requests do - alias ElixirLS.LanguageServer.Experimental.Protocol.LspTypes - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - alias LSP.Types - - # Client -> Server request - defmodule Initialize do - use Proto - - defrequest "initialize", :shared, - process_id: optional(integer()), - client_info: optional(LspTypes.ClientInfo), - locale: optional(string()), - root_path: optional(string()), - root_uri: string(), - initialization_options: optional(any()), - trace: optional(string()), - workspace_folders: optional(list_of(Types.Workspace.Folder)), - capabilities: optional(map_of(any())) - end - - defmodule FindReferences do - use Proto - - defrequest "textDocument/references", :exclusive, - text_document: Types.TextDocument.Identifier, - position: Types.Position - end - - defmodule GotoDefinition do - use Proto - - defrequest "textDocument/definition", :exclusive, - text_document: Types.TextDocument.Identifier, - position: Types.Position - end - - defmodule Formatting do - use Proto - - defrequest "textDocument/formatting", :exclusive, - text_document: Types.TextDocument.Identifier, - options: Types.Formatting.Options - end - - defmodule CodeAction do - use Proto - - defrequest "textDocument/codeAction", :exclusive, - text_document: Types.TextDocument.Identifier, - range: Types.Range, - context: Types.CodeAction.Context - end - - # Server -> Client requests - - defmodule RegisterCapability do - use Proto - - defrequest "client/registerCapability", :shared, - registrations: optional(list_of(LspTypes.Registration)) - end - - use Proto, decoders: :requests -end diff --git a/apps/language_server/lib/language_server/experimental/protocol/responses.ex b/apps/language_server/lib/language_server/experimental/protocol/responses.ex deleted file mode 100644 index 7aece8894..000000000 --- a/apps/language_server/lib/language_server/experimental/protocol/responses.ex +++ /dev/null @@ -1,30 +0,0 @@ -defmodule LSP.Responses do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - alias LSP.Types - - defmodule FindReferences do - use Proto - - defresponse optional(list_of(Types.Location)) - end - - defmodule GotoDefinition do - use Proto - - defresponse optional(Types.Location) - end - - defmodule Formatting do - use Proto - - defresponse optional(list_of(Types.TextEdit)) - end - - defmodule CodeAction do - use Proto - - defresponse optional(list_of(Types.CodeAction)) - end - - @type response :: FindReferences.t() | CodeAction.t() | Formatting.t() -end diff --git a/apps/language_server/lib/language_server/experimental/provider/code_action/replace_remote_function.ex b/apps/language_server/lib/language_server/experimental/provider/code_action/replace_remote_function.ex deleted file mode 100644 index 24ce301c5..000000000 --- a/apps/language_server/lib/language_server/experimental/provider/code_action/replace_remote_function.ex +++ /dev/null @@ -1,176 +0,0 @@ -defmodule ElixirLS.LanguageServer.Experimental.Provider.CodeAction.ReplaceRemoteFunction do - @moduledoc """ - Code actions that replace unknown remote function with ones suggested by the warning message - """ - - alias ElixirLS.LanguageServer.Experimental.CodeMod - alias ElixirLS.LanguageServer.Experimental.CodeMod.Ast - alias LSP.Requests.CodeAction - alias LSP.Types.CodeAction, as: CodeActionResult - alias LSP.Types.Diagnostic - alias LSP.Types.TextEdit - alias LSP.Types.Workspace - alias ElixirLS.LanguageServer.Experimental.SourceFile - alias ElixirSense.Core.Parser - - @function_re ~r/(.*)\/(.*) is undefined or private. .*:\n(.*)/s - - @spec apply(CodeAction.t()) :: [CodeActionResult.t()] - def apply(%CodeAction{} = code_action) do - source_file = code_action.source_file - diagnostics = get_in(code_action, [:context, :diagnostics]) || [] - - diagnostics - |> Enum.flat_map(fn %Diagnostic{} = diagnostic -> - one_based_line = extract_start_line(diagnostic) - suggestions = extract_suggestions(diagnostic.message) - - with {:ok, module_alias, name} <- extract_function(diagnostic.message), - {:ok, replies} <- - build_code_actions(source_file, one_based_line, module_alias, name, suggestions) do - replies - else - _ -> [] - end - end) - end - - defp extract_function(message) do - case Regex.scan(@function_re, message) do - [[_, full_name, _, _]] -> - {module_alias, name} = separate_module_from_name(full_name) - {:ok, module_alias, name} - - _ -> - :error - end - end - - defp separate_module_from_name(full_name) do - {name, module_alias} = - full_name - |> String.split(".") - |> Enum.map(&String.to_atom/1) - |> List.pop_at(-1) - - {module_alias, name} - end - - @suggestion_re ~r/\* .*\/[\d]+/ - defp extract_suggestions(message) do - case Regex.scan(@function_re, message) do - [[_, _, arity, suggestions_string]] -> - @suggestion_re - |> Regex.scan(suggestions_string) - |> Enum.flat_map(fn [suggestion] -> - case String.split(suggestion, [" ", "/"]) do - ["*", name, ^arity] -> [String.to_atom(name)] - _ -> [] - end - end) - - _ -> - [] - end - end - - defp extract_start_line(%Diagnostic{} = diagnostic) do - diagnostic.range.start.line - end - - defp build_code_actions( - %SourceFile{} = source_file, - one_based_line, - module_alias, - name, - suggestions - ) do - with {:ok, line_text} <- SourceFile.fetch_text_at(source_file, one_based_line), - {:ok, line_ast} <- Ast.from(line_text), - {:ok, possible_aliases} <- - fetch_possible_aliases(source_file, one_based_line, module_alias), - {:ok, edits_per_suggestion} <- - text_edits_per_suggestion(line_text, line_ast, possible_aliases, name, suggestions) do - case edits_per_suggestion do - [] -> - :error - - [_ | _] -> - replies = - Enum.map(edits_per_suggestion, fn {text_edits, suggestion} -> - text_edits = Enum.map(text_edits, &update_line(&1, one_based_line)) - - CodeActionResult.new( - title: construct_title(module_alias, suggestion), - kind: :quick_fix, - edit: Workspace.Edit.new(changes: %{source_file.uri => text_edits}) - ) - end) - - {:ok, replies} - end - end - end - - # Extracted `ElixirSense.Core.State.Env` contains all reachable aliases as a list of tuples - # `{alias, aliased}`. If `aliased` is a prefix of `module_alias`, the function to be replaced - # may use the corresponding `alias`. - defp fetch_possible_aliases(source_file, one_based_line, module_alias) do - metadata = - source_file - |> SourceFile.to_string() - |> Parser.parse_string(true, true, one_based_line) - - case metadata.lines_to_env[one_based_line] do - %ElixirSense.Core.State.Env{aliases: aliases} -> - possible_aliases = - Enum.flat_map(aliases, fn {_alias, aliased} -> - aliased = aliased |> Module.split() |> Enum.map(&String.to_atom/1) - - if aliased == Enum.take(module_alias, length(aliased)) do - [Enum.drop(module_alias, length(aliased) - 1)] - else - [] - end - end) - - {:ok, [module_alias | possible_aliases]} - - _ -> - :error - end - end - - defp text_edits_per_suggestion(line_text, line_ast, possible_aliases, name, suggestions) do - suggestions - |> Enum.reduce_while([], fn suggestion, acc -> - case CodeMod.ReplaceRemoteFunction.text_edits( - line_text, - line_ast, - possible_aliases, - name, - suggestion - ) do - {:ok, []} -> {:cont, acc} - {:ok, edits} -> {:cont, [{edits, suggestion} | acc]} - :error -> {:halt, :error} - end - end) - |> case do - :error -> :error - edits -> {:ok, edits} - end - end - - defp update_line(%TextEdit{} = text_edit, line_number) do - text_edit - |> put_in([:range, :start, :line], line_number - 1) - |> put_in([:range, :end, :line], line_number - 1) - end - - defp construct_title(module_alias, suggestion) do - module_string = Enum.map_join(module_alias, ".", &Atom.to_string/1) - - "Replace with #{module_string}.#{suggestion}" - end -end diff --git a/apps/language_server/lib/language_server/experimental/provider/code_action/replace_with_underscore.ex b/apps/language_server/lib/language_server/experimental/provider/code_action/replace_with_underscore.ex deleted file mode 100644 index 6ffc30db9..000000000 --- a/apps/language_server/lib/language_server/experimental/provider/code_action/replace_with_underscore.ex +++ /dev/null @@ -1,83 +0,0 @@ -defmodule ElixirLS.LanguageServer.Experimental.Provider.CodeAction.ReplaceWithUnderscore do - @moduledoc """ - A code action that prefixes unused variables with an underscore - """ - - alias ElixirLS.LanguageServer.Experimental.CodeMod - alias ElixirLS.LanguageServer.Experimental.CodeMod.Ast - alias LSP.Requests.CodeAction - alias LSP.Types.CodeAction, as: CodeActionResult - alias LSP.Types.Diagnostic - alias LSP.Types.TextEdit - alias LSP.Types.Workspace - alias ElixirLS.LanguageServer.Experimental.SourceFile - - @spec apply(CodeAction.t()) :: [CodeActionResult.t()] - def apply(%CodeAction{} = code_action) do - source_file = code_action.source_file - diagnostics = get_in(code_action, [:context, :diagnostics]) || [] - - diagnostics - |> Enum.flat_map(fn %Diagnostic{} = diagnostic -> - with {:ok, variable_name, one_based_line} <- extract_variable_and_line(diagnostic), - {:ok, reply} <- build_code_action(source_file, one_based_line, variable_name) do - [reply] - else - _ -> - [] - end - end) - end - - defp build_code_action(%SourceFile{} = source_file, one_based_line, variable_name) do - with {:ok, line_text} <- SourceFile.fetch_text_at(source_file, one_based_line), - {:ok, line_ast} <- Ast.from(line_text), - {:ok, text_edits} <- - CodeMod.ReplaceWithUnderscore.text_edits(line_text, line_ast, variable_name) do - case text_edits do - [] -> - :error - - [_ | _] -> - text_edits = Enum.map(text_edits, &update_line(&1, one_based_line)) - - reply = - CodeActionResult.new( - title: "Rename to _#{variable_name}", - kind: :quick_fix, - edit: Workspace.Edit.new(changes: %{source_file.uri => text_edits}) - ) - - {:ok, reply} - end - end - end - - defp update_line(%TextEdit{} = text_edit, line_number) do - text_edit - |> put_in([:range, :start, :line], line_number - 1) - |> put_in([:range, :end, :line], line_number - 1) - end - - defp extract_variable_and_line(%Diagnostic{} = diagnostic) do - with {:ok, variable_name} <- extract_variable_name(diagnostic.message), - {:ok, line} <- extract_line(diagnostic) do - {:ok, variable_name, line} - end - end - - @variable_re ~r/variable "([^"]+)" is unused/ - defp extract_variable_name(message) do - case Regex.scan(@variable_re, message) do - [[_, variable_name]] -> - {:ok, String.to_atom(variable_name)} - - _ -> - :error - end - end - - defp extract_line(%Diagnostic{} = diagnostic) do - {:ok, diagnostic.range.start.line} - end -end diff --git a/apps/language_server/lib/language_server/experimental/provider/env.ex b/apps/language_server/lib/language_server/experimental/provider/env.ex deleted file mode 100644 index 1bdde12cf..000000000 --- a/apps/language_server/lib/language_server/experimental/provider/env.ex +++ /dev/null @@ -1,27 +0,0 @@ -defmodule ElixirLS.LanguageServer.Experimental.Provider.Env do - @moduledoc """ - An environment passed to provider handlers. - This represents the current state of the project, and should include additional - information that provider handles might need to complete their tasks. - """ - - alias ElixirLS.LanguageServer.Experimental.Project - alias ElixirLS.LanguageServer.Experimental.Server.Configuration - - defstruct [:root_uri, :root_path, :project_uri, :project_path] - - @type t :: %__MODULE__{} - - def new do - %__MODULE__{} - end - - def from_configuration(%Configuration{} = config) do - %__MODULE__{ - root_uri: config.project.root_uri, - root_path: Project.root_path(config.project), - project_uri: config.project.root_uri, - project_path: Project.project_path(config.project) - } - end -end diff --git a/apps/language_server/lib/language_server/experimental/provider/handlers/code_action.ex b/apps/language_server/lib/language_server/experimental/provider/handlers/code_action.ex deleted file mode 100644 index c1b8a7763..000000000 --- a/apps/language_server/lib/language_server/experimental/provider/handlers/code_action.ex +++ /dev/null @@ -1,20 +0,0 @@ -defmodule ElixirLS.LanguageServer.Experimental.Provider.Handlers.CodeAction do - alias ElixirLS.LanguageServer.Experimental.Provider.CodeAction.ReplaceRemoteFunction - alias ElixirLS.LanguageServer.Experimental.Provider.CodeAction.ReplaceWithUnderscore - alias ElixirLS.LanguageServer.Experimental.Provider.Env - alias LSP.Requests - alias LSP.Responses - - require Logger - - @code_actions [ReplaceRemoteFunction, ReplaceWithUnderscore] - - def handle(%Requests.CodeAction{} = request, %Env{}) do - code_actions = - Enum.flat_map(@code_actions, fn code_action_module -> code_action_module.apply(request) end) - - reply = Responses.CodeAction.new(request.id, code_actions) - - {:reply, reply} - end -end diff --git a/apps/language_server/lib/language_server/experimental/provider/handlers/find_references.ex b/apps/language_server/lib/language_server/experimental/provider/handlers/find_references.ex deleted file mode 100644 index 7b464a9a0..000000000 --- a/apps/language_server/lib/language_server/experimental/provider/handlers/find_references.ex +++ /dev/null @@ -1,61 +0,0 @@ -defmodule ElixirLS.LanguageServer.Experimental.Provider.Handlers.FindReferences do - alias ElixirLS.LanguageServer.Build - alias ElixirLS.LanguageServer.Tracer - - alias LSP.Requests.FindReferences - alias LSP.Responses - alias LSP.Types.Location - alias ElixirLS.LanguageServer.Experimental.SourceFile - alias ElixirLS.LanguageServer.Experimental.SourceFile.Conversions - - require Logger - - def handle(%FindReferences{} = request, _) do - source_file = request.source_file - pos = request.position - trace = Tracer.get_trace() - # elixir_ls uses 1 based columns, so add 1 here. - character = pos.character + 1 - - Build.with_build_lock(fn -> - references = - source_file - |> SourceFile.to_string() - |> ElixirSense.references(pos.line, character, trace) - |> Enum.reduce([], fn reference, acc -> - case build_reference(reference, source_file) do - {:ok, location} -> - [location | acc] - - _ -> - acc - end - end) - |> Enum.reverse() - # ElixirSense returns references from both compile tracer and current buffer - # There may be duplicates - |> Enum.uniq() - - response = Responses.FindReferences.new(request.id, references) - Logger.info("found #{length(references)} refs") - {:reply, response} - end) - end - - defp build_reference(%{range: _, uri: _} = elixir_sense_reference, current_source_file) do - with {:ok, source_file} <- get_source_file(elixir_sense_reference, current_source_file), - {:ok, elixir_range} <- Conversions.to_elixir(elixir_sense_reference, source_file), - {:ok, ls_range} <- Conversions.to_lsp(elixir_range, source_file) do - uri = Conversions.ensure_uri(source_file.uri) - {:ok, Location.new(uri: uri, range: ls_range)} - end - end - - defp get_source_file(%{uri: nil}, current_source_file) do - {:ok, current_source_file} - end - - defp get_source_file(%{uri: uri}, _) do - SourceFile.Store.open_temporary(uri) - end -end diff --git a/apps/language_server/lib/language_server/experimental/provider/handlers/formatting.ex b/apps/language_server/lib/language_server/experimental/provider/handlers/formatting.ex deleted file mode 100644 index c76332ebc..000000000 --- a/apps/language_server/lib/language_server/experimental/provider/handlers/formatting.ex +++ /dev/null @@ -1,29 +0,0 @@ -defmodule ElixirLS.LanguageServer.Experimental.Provider.Handlers.Formatting do - alias ElixirLS.LanguageServer.Experimental.Provider.Env - alias ElixirLS.LanguageServer.Experimental.CodeMod.Format - alias LSP.Requests - alias LSP.Responses - require Logger - - def handle(%Requests.Formatting{} = request, %Env{} = env) do - document = request.source_file - - with {:ok, text_edits} <- Format.text_edits(document, env.project_path) do - response = Responses.Formatting.new(request.id, text_edits) - {:reply, response} - else - {:error, reason} -> - Logger.error("Formatter failed #{inspect(reason)}") - - {:reply, Responses.Formatting.error(request.id, :request_failed, message(reason))} - end - end - - defp message(reason) when is_exception(reason) do - Exception.message(reason) - end - - defp message(reason) do - inspect(reason) - end -end diff --git a/apps/language_server/lib/language_server/experimental/provider/handlers/goto_definition.ex b/apps/language_server/lib/language_server/experimental/provider/handlers/goto_definition.ex deleted file mode 100644 index 364874fdb..000000000 --- a/apps/language_server/lib/language_server/experimental/provider/handlers/goto_definition.ex +++ /dev/null @@ -1,34 +0,0 @@ -defmodule ElixirLS.LanguageServer.Experimental.Provider.Handlers.GotoDefinition do - alias LSP.Requests.GotoDefinition - alias LSP.Responses - alias ElixirLS.LanguageServer.Experimental.SourceFile - alias ElixirLS.LanguageServer.Experimental.SourceFile.Conversions - require Logger - - def handle(%GotoDefinition{} = request, _) do - source_file = request.source_file - pos = request.position - - maybe_location = - source_file |> SourceFile.to_string() |> ElixirSense.definition(pos.line, pos.character + 1) - - case to_response(request.id, maybe_location, source_file) do - {:ok, response} -> - {:reply, response} - - {:error, reason} -> - Logger.error("GotoDefinition conversion failed: #{inspect(reason)}") - {:error, Responses.GotoDefinition.error(request.id, :request_failed, inspect(reason))} - end - end - - defp to_response(request_id, %ElixirSense.Location{} = location, %SourceFile{} = source_file) do - with {:ok, lsp_location} <- Conversions.to_lsp(location, source_file) do - {:ok, Responses.GotoDefinition.new(request_id, lsp_location)} - end - end - - defp to_response(request_id, nil, _source_file) do - {:ok, Responses.GotoDefinition.new(request_id, nil)} - end -end diff --git a/apps/language_server/lib/language_server/experimental/provider/queue.ex b/apps/language_server/lib/language_server/experimental/provider/queue.ex deleted file mode 100644 index 0dd6e2912..000000000 --- a/apps/language_server/lib/language_server/experimental/provider/queue.ex +++ /dev/null @@ -1,230 +0,0 @@ -defmodule ElixirLS.LanguageServer.Experimental.Provider.Queue do - defmodule State do - alias ElixirLS.LanguageServer.Experimental.Provider.Env - alias ElixirLS.LanguageServer.Experimental - alias LSP.Requests - alias ElixirLS.LanguageServer.Experimental.Provider.Handlers - alias ElixirLS.LanguageServer.Experimental.Provider.Queue - alias ElixirLS.Utils.WireProtocol - require Logger - - defstruct tasks_by_id: %{}, pids_to_ids: %{} - - @type t :: %__MODULE__{} - - @requests_to_handler %{ - Requests.FindReferences => Handlers.FindReferences, - Requests.Formatting => Handlers.Formatting, - Requests.CodeAction => Handlers.CodeAction, - Requests.GotoDefinition => Handlers.GotoDefinition - } - - def new do - %__MODULE__{} - end - - defp handler_for(%request_module{}) do - case Map.fetch(@requests_to_handler, request_module) do - {:ok, _} = success -> - success - - :error -> - {:error, {:unhandled, request_module}} - end - end - - @spec add(t, Requests.request(), Env.t()) :: {:ok, t} | :error - def add(%__MODULE__{} = state, request, env) do - with {:ok, handler_module} <- handler_for(request), - {:ok, req} <- request.__struct__.to_elixir(request) do - task = %Task{} = as_task(request, fn -> handler_module.handle(req, env) end) - - new_state = %__MODULE__{ - state - | tasks_by_id: Map.put(state.tasks_by_id, request.id, task), - pids_to_ids: Map.put(state.pids_to_ids, task.pid, request.id) - } - - {:ok, new_state} - else - {:error, {:unhandled, _}} -> - Logger.info("unhandled request #{request.method}") - :error - - _ -> - :error - end - end - - @spec cancel(t, pos_integer()) :: t - def cancel(%__MODULE__{} = state, request_id) do - with {:ok, %Task{} = task} <- Map.fetch(state.tasks_by_id, request_id), - true <- Process.exit(task.pid, :kill) do - %State{ - state - | tasks_by_id: Map.delete(state.tasks_by_id, request_id), - pids_to_ids: Map.delete(state.pids_to_ids, task.pid) - } - else - _ -> - state - end - end - - def size(%__MODULE__{} = state) do - map_size(state.tasks_by_id) - end - - def task_finished(%__MODULE__{} = state, pid, reason) do - case Map.pop(state.pids_to_ids, pid) do - {nil, _} -> - Logger.warning("Got an exit for pid #{inspect(pid)}, but it wasn't in the queue") - state - - {request_id, new_pids_to_ids} -> - maybe_log_task(reason, request_id) - - %__MODULE__{ - state - | pids_to_ids: new_pids_to_ids, - tasks_by_id: Map.delete(state.tasks_by_id, request_id) - } - end - end - - def running?(%__MODULE__{} = state, request_id) do - Map.has_key?(state.tasks_by_id, request_id) - end - - defp maybe_log_task(:normal, _), - do: :ok - - defp maybe_log_task(reason, %{id: request_id} = _request), - do: maybe_log_task(reason, request_id) - - defp maybe_log_task(reason, request_id), - do: Logger.warning("Request id #{request_id} failed with reason #{inspect(reason)}") - - defp as_task(%{id: _} = request, func) do - handler = fn -> - try do - case func.() do - :noreply -> - {:request_complete, request} - - {:reply, reply} -> - WireProtocol.send(reply) - {:request_complete, request} - - {:reply_and_alert, reply} -> - WireProtocol.send(reply) - Experimental.Server.response_complete(request, reply) - {:request_complete, request} - end - rescue - e -> - exception_string = Exception.format(:error, e, __STACKTRACE__) - Logger.error(exception_string) - - WireProtocol.send(%{ - id: request.id, - error: exception_string - }) - - {:request_complete, request} - end - end - - Queue.Supervisor.run_in_task(handler) - end - end - - alias ElixirLS.LanguageServer.Experimental.Provider.Env - alias ElixirLS.LanguageServer.Experimental.Server.Configuration - alias LSP.Requests - - use GenServer - - # public interface - @spec add(Requests.request(), Configuration.t() | Env.t()) :: :ok - def add(request, %Configuration{} = config) do - env = Env.from_configuration(config) - add(request, env) - end - - def add(request, %Env{} = env) do - GenServer.call(__MODULE__, {:add, request, env}) - end - - @spec size() :: non_neg_integer() - def size do - GenServer.call(__MODULE__, :size) - end - - def cancel(%{id: request_id}) do - cancel(request_id) - end - - def cancel(request_id) when is_binary(request_id) do - GenServer.call(__MODULE__, {:cancel, request_id}) - end - - def running?(%{id: request_id}) do - running?(request_id) - end - - def running?(request_id) when is_binary(request_id) do - GenServer.call(__MODULE__, {:running?, request_id}) - end - - # genserver callbacks - - def child_spec do - __MODULE__ - end - - def start_link(_) do - GenServer.start_link(__MODULE__, [], name: __MODULE__) - end - - def init(_) do - {:ok, State.new()} - end - - def handle_call({:add, request, env}, _from, %State{} = state) do - {reply, new_state} = - case State.add(state, request, env) do - {:ok, new_state} -> {:ok, new_state} - error -> {error, state} - end - - {:reply, reply, new_state} - end - - def handle_call({:cancel, request_id}, _from, %State{} = state) do - new_state = State.cancel(state, request_id) - {:reply, :ok, new_state} - end - - def handle_call({:running?, request_id}, _from, %State{} = state) do - {:reply, State.running?(state, request_id), state} - end - - def handle_call(:size, _from, %State{} = state) do - {:reply, State.size(state), state} - end - - def handle_info({:DOWN, _ref, :process, pid, reason}, state) do - new_state = State.task_finished(state, pid, reason) - - {:noreply, new_state} - end - - def handle_info({ref, {:request_complete, _response}}, %State{} = state) - when is_reference(ref) do - # This head handles the replies from the tasks, which we don't really care about. - {:noreply, state} - end - - # private -end diff --git a/apps/language_server/lib/language_server/experimental/provider/supervisor.ex b/apps/language_server/lib/language_server/experimental/provider/supervisor.ex deleted file mode 100644 index d10706d64..000000000 --- a/apps/language_server/lib/language_server/experimental/provider/supervisor.ex +++ /dev/null @@ -1,20 +0,0 @@ -defmodule ElixirLS.LanguageServer.Experimental.Provider.Queue.Supervisor do - def name do - __MODULE__ - end - - def child_spec do - {Task.Supervisor, name: name()} - end - - def run_in_task(provider_fn) do - name() - |> Task.Supervisor.async(provider_fn) - |> unlink() - end - - defp unlink(%Task{} = task) do - Process.unlink(task.pid) - task - end -end diff --git a/apps/language_server/lib/language_server/experimental/server.ex b/apps/language_server/lib/language_server/experimental/server.ex deleted file mode 100644 index 86b1a4e9d..000000000 --- a/apps/language_server/lib/language_server/experimental/server.ex +++ /dev/null @@ -1,120 +0,0 @@ -defmodule ElixirLS.LanguageServer.Experimental.Server do - alias ElixirLS.LanguageServer.Experimental.Provider - alias LSP.Notifications - alias LSP.Requests - alias LSP.Responses - alias ElixirLS.LanguageServer.Experimental.Server.State - - import Logger - import Notifications, only: [notification: 1] - import Requests, only: [request: 2] - - use GenServer - - @spec response_complete(Requests.request(), Responses.response()) :: :ok - def response_complete(request, response) do - GenServer.call(__MODULE__, {:response_complete, request, response}) - end - - def start_link(_) do - GenServer.start_link(__MODULE__, [], name: __MODULE__) - end - - def init(_) do - {:ok, State.new()} - end - - def handle_call({:response_complete, _request, _response}, _from, %State{} = state) do - {:reply, :ok, state} - end - - def handle_cast({:receive_packet, request(_id, method) = request}, %State{} = state) do - new_state = - with {:ok, request} <- Requests.decode(method, request), - {:ok, new_state} <- handle_request(request, %State{} = state) do - new_state - else - {:error, {:unknown_request, _}} -> - state - - error -> - error("Could not decode request #{method} #{inspect(error)}") - state - end - - {:noreply, new_state} - end - - def handle_cast({:receive_packet, notification(method) = notification}, %State{} = state) do - new_state = - with {:ok, notification} <- Notifications.decode(method, notification), - {:ok, new_state} <- handle_notification(notification, %State{} = state) do - new_state - else - {:error, {:unknown_notification, _}} -> - state - - error -> - error("Failed to handle #{method} #{inspect(error)}") - state - end - - {:noreply, new_state} - end - - def handle_cast(other, %State{} = state) do - info("got other: #{inspect(other)}") - - {:noreply, state} - end - - def handle_info(:default_config, %State{configuration: nil} = state) do - Logger.warning( - "Did not receive workspace/didChangeConfiguration notification after 5 seconds. " <> - "Using default settings." - ) - - {:ok, config} = State.default_configuration(state.configuration) - {:noreply, %State{state | configuration: config}} - end - - def handle_info(:default_config, %State{} = state) do - {:noreply, state} - end - - def handle_request(%Requests.Initialize{} = initialize, %State{} = state) do - Logger.info("handling initialize") - Process.send_after(self(), :default_config, :timer.seconds(5)) - - case State.initialize(state, initialize) do - {:ok, _state} = success -> - success - - error -> - {error, state} - end - end - - def handle_request(request, %State{} = state) do - Provider.Queue.add(request, state.configuration) - - {:ok, %State{} = state} - end - - def handle_notification(notification, %State{} = state) do - case apply_to_state(state, notification) do - {:ok, _} = success -> - success - - error -> - error("Failed to handle #{notification.__struct__}, #{inspect(error)}") - end - end - - defp apply_to_state(%State{} = state, %{} = request_or_notification) do - case State.apply(state, request_or_notification) do - {:ok, new_state} -> {:ok, new_state} - error -> {error, state} - end - end -end diff --git a/apps/language_server/lib/language_server/experimental/server/configuration.ex b/apps/language_server/lib/language_server/experimental/server/configuration.ex deleted file mode 100644 index 5fdac7133..000000000 --- a/apps/language_server/lib/language_server/experimental/server/configuration.ex +++ /dev/null @@ -1,137 +0,0 @@ -defmodule ElixirLS.LanguageServer.Experimental.Server.Configuration do - alias ElixirLS.LanguageServer.Dialyzer - alias ElixirLS.LanguageServer.Experimental.LanguageServer - alias ElixirLS.LanguageServer.Experimental.Project - alias ElixirLS.LanguageServer.Experimental.Protocol.Id - alias LSP.Notifications.DidChangeConfiguration - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto.LspTypes.Registration - alias LSP.Requests - alias LSP.Requests.RegisterCapability - alias ElixirLS.LanguageServer.Experimental.Server.Configuration.Support - - defstruct project: nil, - support: nil, - additional_watched_extensions: nil, - dialyzer_enabled?: false - - @type t :: %__MODULE__{} - - @spec new(LanguageServer.uri(), map()) :: t - def new(root_uri, client_capabilities) do - support = Support.new(client_capabilities) - project = Project.new(root_uri) - %__MODULE__{support: support, project: project} - end - - @spec default(t) :: - {:ok, t} - | {:ok, t, Requests.RegisterCapability.t()} - | {:restart, Logger.level(), String.t()} - | {:error, String.t()} - def default(%__MODULE__{} = config) do - apply_config_change(config, default_config()) - end - - @spec on_change(t, DidChangeConfiguration.t()) :: - {:ok, t} - | {:ok, t, Requests.RegisterCapability.t()} - | {:restart, Logger.level(), String.t()} - | {:error, String.t()} - def on_change(%__MODULE__{} = old_config, :defaults) do - apply_config_change(old_config, default_config()) - end - - def on_change(%__MODULE__{} = old_config, %DidChangeConfiguration{} = change) do - apply_config_change(old_config, change.lsp.settings) - end - - defp default_config do - %{} - end - - defp apply_config_change(%__MODULE__{} = old_config, %{} = settings) do - with {:ok, new_config} <- maybe_set_mix_env(old_config, settings), - {:ok, new_config} <- maybe_set_env_vars(new_config, settings), - {:ok, new_config} <- maybe_set_mix_target(new_config, settings), - {:ok, new_config} <- maybe_set_project_directory(new_config, settings), - {:ok, new_config} <- maybe_enable_dialyzer(new_config, settings) do - maybe_add_watched_extensions(new_config, settings) - end - end - - defp maybe_set_mix_env(%__MODULE__{} = old_config, settings) do - new_env = Map.get(settings, "mixEnv") - - with {:ok, new_project} <- Project.change_mix_env(old_config.project, new_env) do - {:ok, %__MODULE__{old_config | project: new_project}} - end - end - - defp maybe_set_env_vars(%__MODULE__{} = old_config, settings) do - env_vars = Map.get(settings, "envVariables") - - with {:ok, new_project} <- Project.set_env_vars(old_config.project, env_vars) do - {:ok, %__MODULE__{old_config | project: new_project}} - end - end - - defp maybe_set_mix_target(%__MODULE__{} = old_config, settings) do - mix_target = Map.get(settings, "mixTarget") - - with {:ok, new_project} <- Project.change_mix_target(old_config.project, mix_target) do - {:ok, %__MODULE__{old_config | project: new_project}} - end - end - - defp maybe_set_project_directory(%__MODULE__{} = old_config, settings) do - project_dir = Map.get(settings, "projectDir") - - with {:ok, new_project} <- Project.change_project_directory(old_config.project, project_dir) do - {:ok, %__MODULE__{old_config | project: new_project}} - end - end - - defp maybe_enable_dialyzer(%__MODULE__{} = old_config, settings) do - enabled? = - case Dialyzer.check_support() do - :ok -> - Map.get(settings, "dialyzerEnabled", true) - - _ -> - false - end - - {:ok, %__MODULE__{old_config | dialyzer_enabled?: enabled?}} - end - - defp maybe_add_watched_extensions(%__MODULE__{} = old_config, %{ - "additionalWatchedExtensions" => [] - }) do - {:ok, old_config} - end - - defp maybe_add_watched_extensions(%__MODULE__{} = old_config, %{ - "additionalWatchedExtensions" => extensions - }) - when is_list(extensions) do - register_id = Id.next() - request_id = Id.next() - - watchers = Enum.map(extensions, fn ext -> %{"globPattern" => "**/*#{ext}"} end) - - registration = - Registration.new( - id: request_id, - method: "workspace/didChangeWatchedFiles", - register_options: %{"watchers" => watchers} - ) - - request = RegisterCapability.new(id: register_id, registrations: [registration]) - - {:ok, old_config, request} - end - - defp maybe_add_watched_extensions(%__MODULE__{} = old_config, _) do - {:ok, old_config} - end -end diff --git a/apps/language_server/lib/language_server/experimental/server/configuration/support.ex b/apps/language_server/lib/language_server/experimental/server/configuration/support.ex deleted file mode 100644 index 520ebb433..000000000 --- a/apps/language_server/lib/language_server/experimental/server/configuration/support.ex +++ /dev/null @@ -1,49 +0,0 @@ -defmodule ElixirLS.LanguageServer.Experimental.Server.Configuration.Support do - defstruct code_action_dynamic_registration?: false, - hierarchical_document_symbols?: false, - snippet?: false, - deprecated?: false, - tags?: false, - signature_help?: false - - def new(client_capabilities) do - dynamic_registration? = - fetch_bool(client_capabilities, ~w(textDocument codeAction dynamicRegistration)) - - hierarchical_symbols? = - fetch_bool( - client_capabilities, - ~w(textDocument documentSymbol hierarchicalDocumentSymbolSupport) - ) - - snippet? = - fetch_bool(client_capabilities, ~w(textDocument completion completionItem snippetSupport)) - - deprecated? = - fetch_bool( - client_capabilities, - ~w(textDocument completion completionItem deprecatedSupport) - ) - - tags? = fetch_bool(client_capabilities, ~w(textDocument completion completionItem tagSupport)) - - signature_help? = fetch_bool(client_capabilities, ~w(textDocument signatureHelp)) - - %__MODULE__{ - code_action_dynamic_registration?: dynamic_registration?, - hierarchical_document_symbols?: hierarchical_symbols?, - snippet?: snippet?, - deprecated?: deprecated?, - tags?: tags?, - signature_help?: signature_help? - } - end - - def fetch_bool(client_capabilities, path) do - case get_in(client_capabilities, path) do - nil -> false - false -> false - _ -> true - end - end -end diff --git a/apps/language_server/lib/language_server/experimental/server/state.ex b/apps/language_server/lib/language_server/experimental/server/state.ex deleted file mode 100644 index 4ef4b600b..000000000 --- a/apps/language_server/lib/language_server/experimental/server/state.ex +++ /dev/null @@ -1,121 +0,0 @@ -defmodule ElixirLS.LanguageServer.Experimental.Server.State do - alias ElixirLS.Utils.WireProtocol - - alias LSP.Notifications.{ - DidChange, - DidChangeConfiguration, - DidClose, - DidOpen, - DidSave - } - - alias LSP.Requests.Initialize - alias LSP.Types.TextDocument - alias ElixirLS.LanguageServer.Experimental.Server.Configuration - alias ElixirLS.LanguageServer.Experimental.SourceFile - - import Logger - - defstruct configuration: nil, initialized?: false - - @type t :: %__MODULE__{} - - def new do - %__MODULE__{} - end - - def initialize(%__MODULE__{initialized?: false} = state, %Initialize{ - lsp: %Initialize.LSP{} = event - }) do - config = Configuration.new(event.root_uri, event.capabilities) - new_state = %__MODULE__{state | configuration: config, initialized?: true} - {:ok, new_state} - end - - def initialize(%__MODULE__{initialized?: true}, %Initialize{}) do - {:error, :already_initialized} - end - - def default_configuration(%__MODULE__{configuration: config} = state) do - with {:ok, config} <- Configuration.default(config) do - {:ok, %__MODULE__{state | configuration: config}} - end - end - - def apply(%__MODULE__{initialized?: false}, request) do - Logger.error("Received #{request.method} before server was initialized") - {:error, :not_initialized} - end - - def apply(%__MODULE__{} = state, %DidChangeConfiguration{} = event) do - case Configuration.on_change(state.configuration, event) do - {:ok, config} -> - {:ok, %__MODULE__{state | configuration: config}} - - {:ok, config, response} -> - WireProtocol.send(response) - {:ok, %__MODULE__{state | configuration: config}} - - error -> - error - end - end - - def apply(%__MODULE__{} = state, %DidChange{lsp: event}) do - uri = event.text_document.uri - version = event.text_document.version - - case SourceFile.Store.update( - uri, - &SourceFile.apply_content_changes(&1, version, event.content_changes) - ) do - :ok -> {:ok, state} - error -> error - end - end - - def apply(%__MODULE__{} = state, %DidOpen{lsp: event}) do - %TextDocument.Item{text: text, uri: uri, version: version} = - text_document = event.text_document - - case SourceFile.Store.open(uri, text, version) do - :ok -> - info("opened #{uri}") - {:ok, state} - - error -> - error("Could not open #{text_document.uri} #{inspect(error)}") - error - end - end - - def apply(%__MODULE__{} = state, %DidClose{lsp: event}) do - uri = event.text_document.uri - - case SourceFile.Store.close(uri) do - :ok -> - {:ok, state} - - error -> - warning("Received textDocument/didClose for a file that wasn't open. URI was #{uri}") - error - end - end - - def apply(%__MODULE__{} = state, %DidSave{lsp: event}) do - uri = event.text_document.uri - - case SourceFile.Store.save(uri) do - :ok -> - {:ok, state} - - error -> - warning("Save failed for uri #{uri} error was #{inspect(error)}") - error - end - end - - def apply(%__MODULE__{} = state, _) do - {:ok, state} - end -end diff --git a/apps/language_server/lib/language_server/experimental/source_file.ex b/apps/language_server/lib/language_server/experimental/source_file.ex deleted file mode 100644 index 805e3c89e..000000000 --- a/apps/language_server/lib/language_server/experimental/source_file.ex +++ /dev/null @@ -1,273 +0,0 @@ -defmodule ElixirLS.LanguageServer.Experimental.SourceFile do - alias LSP.Types.TextDocument.ContentChangeEvent.TextDocumentContentChangeEvent, - as: RangedTextDocumentContentChangeEvent - - alias LSP.Types.TextDocument.ContentChangeEvent.TextDocumentContentChangeEvent1, - as: ReplaceContentChangeEvent - - alias LSP.Types.TextEdit - alias ElixirLS.LanguageServer.Experimental.SourceFile.Conversions - alias ElixirLS.LanguageServer.Experimental.SourceFile.Document - alias ElixirLS.LanguageServer.Experimental.SourceFile.Line - alias ElixirLS.LanguageServer.Experimental.SourceFile.Position - alias ElixirLS.LanguageServer.Experimental.SourceFile.Range - alias ElixirLS.LanguageServer.SourceFile - import ElixirLS.LanguageServer.Protocol, only: [range: 4] - import ElixirLS.LanguageServer.Experimental.SourceFile.Line - - defstruct [:uri, :path, :version, dirty?: false, document: nil] - - @type t :: %__MODULE__{ - uri: String.t(), - version: pos_integer(), - dirty?: boolean, - document: Document.t(), - path: String.t() - } - - @type version :: pos_integer() - @type change_application_error :: {:error, {:invalid_range, map()}} - @type content_change_event :: - RangedTextDocumentContentChangeEvent.t() | ReplaceContentChangeEvent.t() - # public - - def new(uri, text, version) do - uri = Conversions.ensure_uri(uri) - - %__MODULE__{ - uri: uri, - version: version, - document: Document.new(text), - path: SourceFile.Path.from_uri(uri) - } - end - - @spec size(t) :: non_neg_integer() - def size(%__MODULE__{} = source) do - Document.size(source.document) - end - - @spec mark_dirty(t) :: t - def mark_dirty(%__MODULE__{} = source) do - %__MODULE__{source | dirty?: true} - end - - @spec mark_clean(t) :: t - def mark_clean(%__MODULE__{} = source) do - %__MODULE__{source | dirty?: false} - end - - @spec fetch_text_at(t, version()) :: {:ok, String.t()} | :error - def fetch_text_at(%__MODULE{} = source, line_number) do - case fetch_line_at(source, line_number) do - {:ok, line(text: text)} -> {:ok, text} - _ -> :error - end - end - - @spec fetch_line_at(t, version()) :: {:ok, Line.t()} | :error - def fetch_line_at(%__MODULE__{} = source, line_number) do - case Document.fetch_line(source.document, line_number) do - {:ok, line} -> {:ok, line} - _ -> :error - end - end - - @spec apply_content_changes(t, pos_integer(), [map | content_change_event]) :: - {:ok, t} | change_application_error() - def apply_content_changes(%__MODULE__{version: current_version}, new_version, _) - when new_version <= current_version do - {:error, :invalid_version} - end - - def apply_content_changes(%__MODULE__{} = source, _, []) do - {:ok, source} - end - - def apply_content_changes(%__MODULE__{} = source, version, changes) when is_list(changes) do - result = - Enum.reduce_while(changes, source, fn change, source -> - case apply_change(source, change) do - {:ok, new_source} -> - {:cont, new_source} - - error -> - {:halt, error} - end - end) - - case result do - %__MODULE__{} = source -> - source = mark_dirty(%__MODULE__{source | version: version}) - - {:ok, source} - - error -> - error - end - end - - def to_string(%__MODULE__{} = source) do - source - |> to_iodata() - |> IO.iodata_to_binary() - end - - # private - - defp line_count(%__MODULE__{} = source) do - Document.size(source.document) - end - - defp apply_change( - %__MODULE__{} = source, - %Range{start: %Position{} = start_pos, end: %Position{} = end_pos}, - new_text - ) do - start_line = start_pos.line - - new_lines_iodata = - cond do - start_line > line_count(source) -> - append_to_end(source, new_text) - - start_line <= 0 -> - prepend_to_beginning(source, new_text) - - true -> - apply_valid_edits(source, new_text, start_pos, end_pos) - end - - new_document = - new_lines_iodata - |> IO.iodata_to_binary() - |> Document.new() - - {:ok, %__MODULE__{source | document: new_document}} - end - - defp apply_change(%__MODULE__{} = source, %ReplaceContentChangeEvent{} = change) do - new_state = - source.uri - |> new(change.text, source.version) - |> increment_version() - - {:ok, new_state} - end - - defp apply_change(%__MODULE__{} = source, %RangedTextDocumentContentChangeEvent{} = change) do - with {:ok, ex_range} <- Conversions.to_elixir(change.range, source) do - apply_change(source, ex_range, change.text) - else - _ -> {:error, {:invalid_range, change.range}} - end - end - - defp apply_change(%__MODULE__{} = source, %TextEdit{} = change) do - with {:ok, ex_range} <- Conversions.to_elixir(change.range, source) do - apply_change(source, ex_range, change.new_text) - else - _ -> {:error, {:invalid_range, change.range}} - end - end - - defp apply_change( - %__MODULE__{} = source, - %{ - "range" => range(start_line, start_char, end_line, end_char) = range, - "text" => new_text - } - ) - when start_line >= 0 and start_char >= 0 and end_line >= 0 and end_char >= 0 do - with {:ok, ex_range} <- Conversions.to_elixir(range, source) do - apply_change(source, ex_range, new_text) - else - _ -> - {:error, {:invalid_range, range}} - end - end - - defp apply_change(%__MODULE__{}, %{"range" => invalid_range}) do - {:error, {:invalid_range, invalid_range}} - end - - defp apply_change( - %__MODULE__{} = source, - %{"text" => new_text} - ) do - {:ok, %__MODULE__{source | document: Document.new(new_text)}} - end - - defp append_to_end(%__MODULE__{} = source, edit_text) do - [to_iodata(source), edit_text] - end - - defp prepend_to_beginning(%__MODULE__{} = source, edit_text) do - [edit_text, to_iodata(source)] - end - - defp apply_valid_edits(%__MODULE{} = source, edit_text, start_pos, end_pos) do - Document.reduce(source.document, [], fn line() = line, acc -> - case edit_action(line, edit_text, start_pos, end_pos) do - :drop -> - acc - - {:append, io_data} -> - [acc, io_data] - end - end) - end - - defp edit_action(line() = line, edit_text, %Position{} = start_pos, %Position{} = end_pos) do - %Position{line: start_line, character: start_char} = start_pos - %Position{line: end_line, character: end_char} = end_pos - - line(line_number: line_number, text: text, ending: ending) = line - - cond do - line_number < start_line -> - {:append, [text, ending]} - - line_number > end_line -> - {:append, [text, ending]} - - line_number == start_line && line_number == end_line -> - prefix_text = utf8_prefix(line, start_char) - suffix_text = utf8_suffix(line, end_char) - - {:append, [prefix_text, edit_text, suffix_text, ending]} - - line_number == start_line -> - prefix_text = utf8_prefix(line, start_char) - {:append, [prefix_text, edit_text]} - - line_number == end_line -> - suffix_text = utf8_suffix(line, end_char) - {:append, [suffix_text, ending]} - - true -> - :drop - end - end - - defp utf8_prefix(line(text: text), start_code_unit) do - length = max(0, start_code_unit) - binary_part(text, 0, length) - end - - defp utf8_suffix(line(text: text), start_code_unit) do - byte_count = byte_size(text) - start_index = min(start_code_unit, byte_count) - length = byte_count - start_index - - binary_part(text, start_index, length) - end - - defp to_iodata(%__MODULE__{} = source) do - Document.to_iodata(source.document) - end - - defp increment_version(%__MODULE__{} = source) do - %__MODULE__{source | version: source.version + 1} - end -end diff --git a/apps/language_server/lib/language_server/experimental/source_file/conversions.ex b/apps/language_server/lib/language_server/experimental/source_file/conversions.ex deleted file mode 100644 index 0a2bca2bf..000000000 --- a/apps/language_server/lib/language_server/experimental/source_file/conversions.ex +++ /dev/null @@ -1,173 +0,0 @@ -defmodule ElixirLS.LanguageServer.Experimental.SourceFile.Conversions do - @moduledoc """ - Functions to convert between language server representations and elixir-native representations. - - The LSP protocol defines positions in terms of their utf-16 representation (thanks, windows), - so when a document change comes in, we need to recalculate the positions of the change if - the line contains non-ascii characters. If it's a pure ascii line, then the positions - are the same in both utf-8 and utf-16, since they reference characters and not bytes. - """ - alias ElixirLS.LanguageServer.Experimental.CodeUnit - alias ElixirLS.LanguageServer.Experimental.SourceFile - alias ElixirLS.LanguageServer.Experimental.SourceFile.Line - alias ElixirLS.LanguageServer.Experimental.SourceFile.Document - alias ElixirLS.LanguageServer.Experimental.SourceFile.Range, as: ElixirRange - alias ElixirLS.LanguageServer.Experimental.SourceFile.Position, as: ElixirPosition - alias LSP.Types.Position, as: LSPosition - alias LSP.Types.Range, as: LSRange - alias LSP.Types.Location, as: LSLocation - alias ElixirLS.LanguageServer.Protocol - - import Line - import Protocol, only: [range: 4] - - @elixir_ls_index_base 1 - - def ensure_uri("file://" <> _ = uri), do: uri - - def ensure_uri(path), - do: ElixirLS.LanguageServer.SourceFile.Path.to_uri(path) - - def ensure_path("file://" <> _ = uri), - do: ElixirLS.LanguageServer.SourceFile.Path.from_uri(uri) - - def ensure_path(path), do: path - - def to_elixir( - %LSRange{} = ls_range, - %SourceFile{} = source - ) do - with {:ok, start_pos} <- to_elixir(ls_range.start, source.document), - {:ok, end_pos} <- to_elixir(ls_range.end, source.document) do - {:ok, %ElixirRange{start: start_pos, end: end_pos}} - end - end - - def to_elixir(range(start_line, start_char, end_line, end_char), %SourceFile{} = source) do - ls_range = %LSRange{ - start: %LSPosition{line: start_line, character: start_char}, - end: %LSPosition{line: end_line, character: end_char} - } - - to_elixir(ls_range, source) - end - - def to_elixir(%LSPosition{} = position, %SourceFile{} = source_file) do - to_elixir(position, source_file.document) - end - - def to_elixir(%ElixirPosition{} = position, _) do - position - end - - def to_elixir(%LSPosition{} = position, %Document{} = document) do - document_size = Document.size(document) - # we need to handle out of bounds line numbers, because it's possible to build a document - # by starting with an empty document and appending to the beginning of it, with a start range of - # {0, 0} and and end range of {1, 0} (replace the first line) - document_line_number = min(position.line, document_size) - elixir_line_number = document_line_number + @elixir_ls_index_base - ls_character = position.character - - cond do - document_line_number == document_size and ls_character == 0 -> - # allow a line one more than the document size, as long as the character is 0. - # that means we're operating on the last line of the document - - {:ok, ElixirPosition.new(elixir_line_number, ls_character)} - - position.line >= document_size -> - # they've specified something outside of the document clamp it down so they can append at the - # end - {:ok, ElixirPosition.new(elixir_line_number, 0)} - - true -> - with {:ok, line} <- Document.fetch_line(document, elixir_line_number), - {:ok, elixir_character} <- extract_elixir_character(position, line) do - {:ok, ElixirPosition.new(elixir_line_number, elixir_character)} - end - end - end - - def to_elixir(%{range: %{start: start_pos, end: end_pos}}, _source_file) do - # this is actually an elixir sense range... note that it's a bare map with - # column keys rather than character keys. - %{line: start_line, column: start_col} = start_pos - %{line: end_line, column: end_col} = end_pos - - range = %ElixirRange{ - start: ElixirPosition.new(start_line, start_col - 1), - end: ElixirPosition.new(end_line, end_col - 1) - } - - {:ok, range} - end - - def to_lsp(%ElixirSense.Location{} = location, %SourceFile{} = source_file) do - position = SourceFile.Position.new(location.line, location.column - 1) - - with {:ok, source_file} <- fetch_source_file(location, source_file), - {:ok, ls_position} <- to_lsp(position, source_file) do - ls_range = %LSRange{start: ls_position, end: ls_position} - {:ok, LSLocation.new(uri: source_file.uri, range: ls_range)} - end - end - - def to_lsp(%ElixirRange{} = ex_range, %SourceFile{} = source) do - with {:ok, start_pos} <- to_lsp(ex_range.start, source.document), - {:ok, end_pos} <- to_lsp(ex_range.end, source.document) do - {:ok, %LSRange{start: start_pos, end: end_pos}} - end - end - - def to_lsp(%ElixirPosition{} = position, %SourceFile{} = source_file) do - to_lsp(position, source_file.document) - end - - def to_lsp(%ElixirPosition{} = position, %Document{} = document) do - with {:ok, line} <- Document.fetch_line(document, position.line), - {:ok, lsp_character} <- extract_lsp_character(position, line) do - ls_pos = - LSPosition.new(character: lsp_character, line: position.line - @elixir_ls_index_base) - - {:ok, ls_pos} - end - end - - def to_lsp(%LSPosition{} = position, _) do - {:ok, position} - end - - # Private - defp fetch_source_file(%{file: nil}, source_file) do - {:ok, source_file} - end - - defp fetch_source_file(%{file: path}, _) do - SourceFile.Store.open_temporary(path) - end - - defp extract_lsp_character(%ElixirPosition{} = position, line(ascii?: true, text: text)) do - character = min(position.character, byte_size(text)) - {:ok, character} - end - - defp extract_lsp_character(%ElixirPosition{} = position, line(text: utf8_text)) do - with {:ok, code_unit} <- CodeUnit.to_utf16(utf8_text, position.character) do - character = min(code_unit, CodeUnit.count(:utf16, utf8_text)) - {:ok, character} - end - end - - defp extract_elixir_character(%LSPosition{} = position, line(ascii?: true, text: text)) do - character = min(position.character, byte_size(text)) - {:ok, character} - end - - defp extract_elixir_character(%LSPosition{} = position, line(text: utf8_text)) do - with {:ok, code_unit} <- CodeUnit.to_utf8(utf8_text, position.character) do - character = min(code_unit, byte_size(utf8_text)) - {:ok, character} - end - end -end diff --git a/apps/language_server/lib/language_server/experimental/source_file/document.ex b/apps/language_server/lib/language_server/experimental/source_file/document.ex deleted file mode 100644 index 0a3538c93..000000000 --- a/apps/language_server/lib/language_server/experimental/source_file/document.ex +++ /dev/null @@ -1,104 +0,0 @@ -defmodule ElixirLS.LanguageServer.Experimental.SourceFile.Document do - alias ElixirLS.LanguageServer.Experimental.SourceFile.LineParser - alias ElixirLS.LanguageServer.Experimental.SourceFile.Line - - import Line - defstruct lines: nil, starting_index: 1 - - @type t :: %__MODULE__{} - - def new(text, starting_index \\ 1) do - lines = - text - |> LineParser.parse(starting_index) - |> List.to_tuple() - - %__MODULE__{lines: lines, starting_index: starting_index} - end - - def to_iodata(%__MODULE__{} = document) do - reduce(document, [], fn line(text: text, ending: ending), acc -> - [acc | [text | ending]] - end) - end - - def to_string(%__MODULE__{} = document) do - document - |> to_iodata() - |> IO.iodata_to_binary() - end - - def size(%__MODULE__{} = document) do - tuple_size(document.lines) - end - - def fetch_line(%__MODULE__{lines: lines, starting_index: starting_index}, index) - when index - starting_index >= tuple_size(lines) do - :error - end - - def fetch_line(%__MODULE__{} = document, index) when is_integer(index) do - case elem(document.lines, index - document.starting_index) do - line() = line -> {:ok, line} - _ -> :error - end - end - - def reduce(%__MODULE__{} = document, initial, reducer_fn) do - size = size(document) - - if size == 0 do - initial - else - Enum.reduce(0..(size - 1), initial, fn index, acc -> - document.lines - |> elem(index) - |> reducer_fn.(acc) - end) - end - end -end - -defimpl Enumerable, for: ElixirLS.LanguageServer.Experimental.SourceFile.Document do - alias ElixirLS.LanguageServer.Experimental.SourceFile.Document - - def count(%Document{} = document) do - {:ok, Document.size(document)} - end - - def member?(%Document{}, _) do - {:error, Document} - end - - def reduce(%Document{} = document, acc, fun) do - tuple_reduce({0, tuple_size(document.lines), document.lines}, acc, fun) - end - - def slice(%Document{} = document) do - {:ok, Document.size(document), fn start, len -> do_slice(document, start, len) end} - end - - defp do_slice(%Document{} = document, start, 1) do - [elem(document.lines, start)] - end - - defp do_slice(%Document{} = document, start, length) do - Enum.map(start..(start + length - 1), &elem(document.lines, &1)) - end - - defp tuple_reduce(_, {:halt, acc}, _fun) do - {:halted, acc} - end - - defp tuple_reduce(current_state, {:suspend, acc}, fun) do - {:suspended, acc, &tuple_reduce(current_state, &1, fun)} - end - - defp tuple_reduce({same, same, _}, {:cont, acc}, _) do - {:done, acc} - end - - defp tuple_reduce({index, size, tuple}, {:cont, acc}, fun) do - tuple_reduce({index + 1, size, tuple}, fun.(elem(tuple, index), acc), fun) - end -end diff --git a/apps/language_server/lib/language_server/experimental/source_file/line.ex b/apps/language_server/lib/language_server/experimental/source_file/line.ex deleted file mode 100644 index 75e313d4b..000000000 --- a/apps/language_server/lib/language_server/experimental/source_file/line.ex +++ /dev/null @@ -1,7 +0,0 @@ -defmodule ElixirLS.LanguageServer.Experimental.SourceFile.Line do - import Record - - defrecord :line, text: nil, ending: nil, line_number: 0, ascii?: true - - @type t :: tuple() -end diff --git a/apps/language_server/lib/language_server/experimental/source_file/line_parser.ex b/apps/language_server/lib/language_server/experimental/source_file/line_parser.ex deleted file mode 100644 index 658080743..000000000 --- a/apps/language_server/lib/language_server/experimental/source_file/line_parser.ex +++ /dev/null @@ -1,102 +0,0 @@ -defmodule ElixirLS.LanguageServer.Experimental.SourceFile.LineParser do - @moduledoc """ - A parser that parses a binary into `Line` records.any() - - The approach taken by the parser is to first go through the binary to find out where - the lines break, what their endings are and if the line is ascii. As we go through the - binary, we store this information, and when we're done, go back and split up the binary - using binary_slice. This performs 3x faster than iterating through the binary and collecting - IOlists that represent each line. - - I determines if a line is ascii (and what it really means is utf8 ascii) by checking to see if - each byte is greater than 0 and less than 128. UTF-16 files won't be marked as ascii, which - allows us to skip a lot of byte conversions later in the process. - """ - import ElixirLS.LanguageServer.Experimental.SourceFile.Line - - # it's important that "\r\n" comes before \r here, otherwise the generated pattern - # matches won't match. - @endings ["\r\n", "\r", "\n"] - @max_ascii_character 127 - - def parse(text, starting_index) do - text - |> traverse(starting_index) - |> Enum.reduce([], fn index, acc -> [extract_line(text, index) | acc] end) - end - - defp extract_line(text, {line_number, start, stop, is_ascii?, ending}) do - line_text = binary_part(text, start, stop) - line(line_number: line_number, text: line_text, ascii?: is_ascii?, ending: ending) - end - - defp traverse(text, starting_index) do - traverse(text, 0, starting_index, 0, true, []) - end - - for ending <- @endings, - ending_length = byte_size(ending) do - defp traverse( - <>, - current_index, - line_number, - line_start_index, - is_ascii?, - acc - ) do - line_length = current_index - line_start_index - line_index = {line_number, line_start_index, line_length, is_ascii?, unquote(ending)} - [line_index | acc] - end - - defp traverse( - <>, - current_index, - line_number, - line_start_index, - is_ascii?, - acc - ) do - line_length = current_index - line_start_index - - acc = [{line_number, line_start_index, line_length, is_ascii?, unquote(ending)} | acc] - next_index = current_index + unquote(ending_length) - traverse(rest, next_index, line_number + 1, next_index, is_ascii?, acc) - end - end - - defp traverse( - <>, - current_index, - line_number, - line_start_index, - is_ascii?, - acc - ) do - # Note, this heuristic assumes the NUL character won't occur in elixir source files. - # if this isn't true, then we need a better heuristic for detecting utf16 text. - is_still_ascii? = is_ascii? and c <= @max_ascii_character and c > 0 - - traverse( - rest, - current_index + 1, - line_number, - line_start_index, - is_still_ascii?, - acc - ) - end - - defp traverse(<<>>, same_index, _line_number, same_index, _is_ascii, acc) do - # this is a line at the end of the document with no content - # I'm choosing not to represent it as a line to simplify things - # and to make the line count what we expect - acc - end - - defp traverse(<<>>, current_index, line_number, line_start_index, is_ascii?, acc) do - # file doesn't end with a newline - line_length = current_index - line_start_index - [{line_number, line_start_index, line_length, is_ascii?, ""} | acc] - end -end diff --git a/apps/language_server/lib/language_server/experimental/source_file/position.ex b/apps/language_server/lib/language_server/experimental/source_file/position.ex deleted file mode 100644 index a1e085433..000000000 --- a/apps/language_server/lib/language_server/experimental/source_file/position.ex +++ /dev/null @@ -1,7 +0,0 @@ -defmodule ElixirLS.LanguageServer.Experimental.SourceFile.Position do - defstruct [:line, :character] - - def new(line, character) when is_number(line) and is_number(character) do - %__MODULE__{line: line, character: character} - end -end diff --git a/apps/language_server/lib/language_server/experimental/source_file/range.ex b/apps/language_server/lib/language_server/experimental/source_file/range.ex deleted file mode 100644 index 79b2e3833..000000000 --- a/apps/language_server/lib/language_server/experimental/source_file/range.ex +++ /dev/null @@ -1,9 +0,0 @@ -defmodule ElixirLS.LanguageServer.Experimental.SourceFile.Range do - alias ElixirLS.LanguageServer.Experimental.SourceFile.Position - - defstruct start: nil, end: nil - - def new(%Position{} = start_pos, %Position{} = end_pos) do - %__MODULE__{start: start_pos, end: end_pos} - end -end diff --git a/apps/language_server/lib/language_server/experimental/source_file/store.ex b/apps/language_server/lib/language_server/experimental/source_file/store.ex deleted file mode 100644 index 8cf79ea38..000000000 --- a/apps/language_server/lib/language_server/experimental/source_file/store.ex +++ /dev/null @@ -1,301 +0,0 @@ -defmodule ElixirLS.LanguageServer.Experimental.SourceFile.Store do - defmodule State do - alias ElixirLS.LanguageServer.Experimental.SourceFile - alias ElixirLS.LanguageServer.Experimental.SourceFile.Conversions - alias ElixirLS.LanguageServer.Experimental.SourceFile.Store - require Logger - - defstruct source_files: %{}, temp_files: %{}, temporary_open_refs: %{} - @type t :: %__MODULE__{} - def new do - %__MODULE__{} - end - - @spec fetch(t, Store.uri()) :: {:ok, SourceFile.t()} | {:error, :not_open} - def fetch(%__MODULE__{} = store, uri) do - with :error <- Map.fetch(store.source_files, uri), - :error <- Map.fetch(store.temp_files, uri) do - {:error, :not_open} - end - end - - @spec save(t, Store.uri()) :: {:ok, t()} | {:error, :not_open} - def save(%__MODULE__{} = store, uri) do - case Map.fetch(store.source_files, uri) do - {:ok, source_file} -> - source_file = SourceFile.mark_clean(source_file) - store = %__MODULE__{store | source_files: Map.put(store.source_files, uri, source_file)} - {:ok, store} - - :error -> - {:error, :not_open} - end - end - - @spec open(t, Store.uri(), String.t(), pos_integer()) :: {:ok, t} | {:error, :already_open} - def open(%__MODULE__{} = store, uri, text, version) do - case Map.fetch(store.source_files, uri) do - {:ok, _} -> - {:error, :already_open} - - :error -> - source_file = SourceFile.new(uri, text, version) - store = %__MODULE__{store | source_files: Map.put(store.source_files, uri, source_file)} - {:ok, store} - end - end - - def open?(%__MODULE__{} = store, uri) do - Map.has_key?(store.source_files, uri) or Map.has_key?(store.temp_files, uri) - end - - def close(%__MODULE__{} = store, uri) do - case Map.pop(store.source_files, uri) do - {nil, _store} -> - {:error, :not_open} - - {_, source_files} -> - store = %__MODULE__{store | source_files: source_files} - {:ok, store} - end - end - - def get_and_update(%__MODULE__{} = store, uri, updater_fn) do - with {:ok, source_file} <- fetch(store, uri), - {:ok, updated_source} <- updater_fn.(source_file) do - new_store = %__MODULE__{ - store - | source_files: Map.put(store.source_files, uri, updated_source) - } - - {:ok, updated_source, new_store} - else - error -> - normalize_error(error) - end - end - - def update(%__MODULE__{} = store, uri, updater_fn) do - with {:ok, _, new_store} <- get_and_update(store, uri, updater_fn) do - {:ok, new_store} - end - end - - def open_temporarily(%__MODULE__{} = store, path_or_uri, timeout) do - uri = Conversions.ensure_uri(path_or_uri) - path = Conversions.ensure_path(path_or_uri) - - with {:ok, contents} <- File.read(path) do - source_file = SourceFile.new(uri, contents, 0) - ref = schedule_unload(uri, timeout) - - new_refs = - store - |> maybe_cancel_old_ref(uri) - |> Map.put(uri, ref) - - temp_files = Map.put(store.temp_files, uri, source_file) - - new_store = %__MODULE__{store | temp_files: temp_files, temporary_open_refs: new_refs} - - {:ok, source_file, new_store} - end - end - - def extend_timeout(%__MODULE__{} = store, uri, timeout) do - case store.temporary_open_refs do - %{^uri => ref} -> - Process.cancel_timer(ref) - new_ref = schedule_unload(uri, timeout) - new_open_refs = Map.put(store.temporary_open_refs, uri, new_ref) - %__MODULE__{store | temporary_open_refs: new_open_refs} - - _ -> - store - end - end - - def unload(%__MODULE__{} = store, uri) do - new_refs = Map.delete(store.temporary_open_refs, uri) - temp_files = Map.delete(store.temp_files, uri) - - %__MODULE__{ - store - | temp_files: temp_files, - temporary_open_refs: new_refs - } - end - - defp maybe_cancel_old_ref(%__MODULE__{} = store, uri) do - {_, new_refs} = - Map.get_and_update(store.temporary_open_refs, uri, fn - nil -> - :pop - - old_ref when is_reference(old_ref) -> - Process.cancel_timer(old_ref) - :pop - end) - - new_refs - end - - defp schedule_unload(uri, timeout) do - Process.send_after(self(), {:unload, uri}, timeout) - end - - defp normalize_error(:error), do: {:error, :not_open} - defp normalize_error(e), do: e - end - - alias ElixirLS.LanguageServer.Experimental.ProcessCache - alias ElixirLS.LanguageServer.Experimental.SourceFile - alias ElixirLS.LanguageServer.Experimental.SourceFile.Conversions - import ElixirLS.LanguageServer.Experimental.Log - - @type t :: %State{} - - @type uri :: String.t() - @type updater :: (SourceFile.t() -> {:ok, SourceFile.t()} | {:error, any()}) - - use GenServer - - @spec fetch(uri()) :: {:ok, SourceFile.t()} | :error - def fetch(uri) do - GenServer.call(__MODULE__, {:fetch, uri}) - end - - @spec save(uri()) :: :ok | {:error, :not_open} - def save(uri) do - GenServer.call(__MODULE__, {:save, uri}) - end - - @spec open?(uri()) :: boolean() - def open?(uri) do - GenServer.call(__MODULE__, {:open?, uri}) - end - - @spec open(uri(), String.t(), pos_integer()) :: :ok | {:error, :already_open} - def open(uri, text, version) do - GenServer.call(__MODULE__, {:open, uri, text, version}) - end - - def open_temporary(uri, timeout \\ 5000) do - path = uri |> Conversions.ensure_path() |> Path.basename() - file_name = Path.basename(path) - - ProcessCache.trans(uri, 50, fn -> - log_and_time "open temporarily: #{file_name}" do - GenServer.call(__MODULE__, {:open_temporarily, uri, timeout}) - end - end) - end - - @spec close(uri()) :: :ok | {:error, :not_open} - def close(uri) do - GenServer.call(__MODULE__, {:close, uri}) - end - - @spec get_and_update(uri(), updater()) :: {SourceFile.t(), State.t()} - def get_and_update(uri, update_fn) do - GenServer.call(__MODULE__, {:get_and_update, uri, update_fn}) - end - - @spec update(uri(), updater()) :: :ok | {:error, any()} - def update(uri, update_fn) do - GenServer.call(__MODULE__, {:update, uri, update_fn}) - end - - def start_link(_) do - GenServer.start_link(__MODULE__, [], name: __MODULE__) - end - - def init(_) do - {:ok, State.new()} - end - - def handle_call({:fetch, uri}, _, %State{} = state) do - {reply, new_state} = - case State.fetch(state, uri) do - {:ok, _} = success -> {success, state} - error -> {error, state} - end - - {:reply, reply, new_state} - end - - def handle_call({:save, uri}, _from, %State{} = state) do - {reply, new_state} = - case State.save(state, uri) do - {:ok, _} = success -> success - error -> {error, state} - end - - {:reply, reply, new_state} - end - - def handle_call({:open, uri, text, version}, _from, %State{} = state) do - {reply, new_state} = - case State.open(state, uri, text, version) do - {:ok, _} = success -> success - error -> {error, state} - end - - {:reply, reply, new_state} - end - - def handle_call({:open_temporarily, uri, timeout_ms}, _, %State{} = state) do - {reply, new_state} = - with {:error, :not_open} <- State.fetch(state, uri), - {:ok, source_file, new_state} <- State.open_temporarily(state, uri, timeout_ms) do - {{:ok, source_file}, new_state} - else - {:ok, source_file} -> - new_state = State.extend_timeout(state, uri, timeout_ms) - {{:ok, source_file}, new_state} - - error -> - {error, state} - end - - {:reply, reply, new_state} - end - - def handle_call({:open?, uri}, _from, %State{} = state) do - {:reply, State.open?(state, uri), state} - end - - def handle_call({:close, uri}, _from, %State{} = state) do - {reply, new_state} = - case State.close(state, uri) do - {:ok, _} = success -> success - error -> {error, state} - end - - {:reply, reply, new_state} - end - - def handle_call({:get_and_update, uri, update_fn}, _from, %State{} = state) do - {reply, new_state} = - case State.get_and_update(state, uri, update_fn) do - {:ok, updated_source, new_state} -> {{:ok, updated_source}, new_state} - error -> {error, state} - end - - {:reply, reply, new_state} - end - - def handle_call({:update, uri, updater_fn}, _, %State{} = state) do - {reply, new_state} = - case State.update(state, uri, updater_fn) do - {:ok, _} = success -> success - error -> {error, state} - end - - {:reply, reply, new_state} - end - - def handle_info({:unload, uri}, %State{} = state) do - {:noreply, State.unload(state, uri)} - end -end diff --git a/apps/language_server/lib/language_server/experimental/supervisor.ex b/apps/language_server/lib/language_server/experimental/supervisor.ex deleted file mode 100644 index 0d35acbd8..000000000 --- a/apps/language_server/lib/language_server/experimental/supervisor.ex +++ /dev/null @@ -1,21 +0,0 @@ -defmodule ElixirLS.LanguageServer.Experimental.Supervisor do - alias ElixirLS.LanguageServer.Experimental - alias ElixirLS.LanguageServer.Experimental.Provider - use Supervisor - - def start_link(init_arg) do - Supervisor.start_link(__MODULE__, init_arg, name: __MODULE__) - end - - @impl Supervisor - def init(_) do - children = [ - Experimental.SourceFile.Store, - Experimental.Server, - Provider.Queue.Supervisor.child_spec(), - Provider.Queue.child_spec() - ] - - Supervisor.init(children, strategy: :one_for_one) - end -end diff --git a/apps/language_server/lib/language_server/packet_router.ex b/apps/language_server/lib/language_server/packet_router.ex deleted file mode 100644 index 9fb3c4fa0..000000000 --- a/apps/language_server/lib/language_server/packet_router.ex +++ /dev/null @@ -1,92 +0,0 @@ -defmodule ElixirLS.LanguageServer.PacketRouter do - defmodule State do - defstruct monitor_references: %{}, names_to_pids: %{} - - def new(names_or_pids) when is_list(names_or_pids) do - Enum.reduce(names_or_pids, %__MODULE__{}, &add(&2, &1)) - end - - def add(%__MODULE__{} = state, pid) when is_pid(pid) do - new_monitors = Map.put(state.monitor_references, Process.monitor(pid), pid) - %__MODULE__{state | monitor_references: new_monitors} - end - - def add(%__MODULE__{} = state, name) do - add(state, Process.whereis(name)) - end - - def delete_ref(%__MODULE__{} = state, ref) when is_reference(ref) do - new_references = Map.pop(state.monitor_references, ref) - %__MODULE__{state | monitor_references: new_references} - end - - def broadcast(%__MODULE__{} = state, type, message) do - broadcast_fn = - case type do - :call -> &GenServer.call/2 - :cast -> &GenServer.cast/2 - :info -> &send/2 - end - - state.monitor_references - |> Map.values() - |> Enum.each(fn pid -> - broadcast_fn.(pid, message) - end) - - state - end - end - - use GenServer - - def registrations do - GenServer.call(__MODULE__, :registrations) - end - - def receive_packet(packet) do - broadcast_cast({:receive_packet, packet}) - end - - def register do - GenServer.call(__MODULE__, {:register, self()}) - end - - def broadcast_call(message) do - GenServer.cast(__MODULE__, {:broadcast, :call, message}) - end - - def broadcast_cast(message) do - GenServer.cast(__MODULE__, {:broadcast, :cast, message}) - end - - def broadcast_info(message) do - GenServer.cast(__MODULE__, {:broadcast, :info, message}) - end - - def start_link(names_or_pids) do - GenServer.start_link(__MODULE__, [names_or_pids], name: __MODULE__) - end - - def init([names_or_pids]) do - {:ok, State.new(names_or_pids)} - end - - def handle_call(:registrations, _, %State{} = state) do - {:reply, Map.values(state.monitor_references), state} - end - - def handle_call({:register, caller}, _, %State{} = state) do - new_state = State.add(state, caller) - {:reply, :ok, new_state} - end - - def handle_cast({:broadcast, type, message}, %State{} = state) do - State.broadcast(state, type, message) - {:noreply, state} - end - - def handle_info({:DOWN, ref, :process, _}, %State{} = state) do - {:noreply, State.delete_ref(state, ref)} - end -end diff --git a/apps/language_server/lib/language_server/server.ex b/apps/language_server/lib/language_server/server.ex index 0d7c4426b..63097dec1 100644 --- a/apps/language_server/lib/language_server/server.ex +++ b/apps/language_server/lib/language_server/server.ex @@ -17,8 +17,6 @@ defmodule ElixirLS.LanguageServer.Server do use GenServer require Logger - alias ElixirLS.LanguageServer.Experimental - alias ElixirLS.LanguageServer.Server.Decider alias ElixirLS.LanguageServer.{SourceFile, Build, Protocol, JsonRpc, Dialyzer, Diagnostics} alias ElixirLS.LanguageServer.Providers.{ @@ -173,41 +171,26 @@ defmodule ElixirLS.LanguageServer.Server do end @impl GenServer - def handle_cast({:receive_packet, request(id, method, _) = packet}, state = %__MODULE__{}) do - new_state = - if Decider.handles?(:standard, method) do - handle_request_packet(id, packet, state) - else - state - end + def handle_cast({:receive_packet, request(id, _method, _) = packet}, state = %__MODULE__{}) do + new_state = handle_request_packet(id, packet, state) {:noreply, new_state} end @impl GenServer def handle_cast({:receive_packet, request(id, method)}, state = %__MODULE__{}) do - new_state = - if Decider.handles?(:standard, method) do - handle_request_packet(id, request(id, method, nil), state) - else - state - end + new_state = handle_request_packet(id, request(id, method, nil), state) {:noreply, new_state} end @impl GenServer def handle_cast( - {:receive_packet, notification(method) = packet}, + {:receive_packet, notification(_method) = packet}, state = %__MODULE__{received_shutdown?: false, server_instance_id: server_instance_id} ) when is_initialized(server_instance_id) do - new_state = - if Decider.handles?(:standard, method) do - handle_notification(packet, state) - else - state - end + new_state = handle_notification(packet, state) {:noreply, new_state} end @@ -216,12 +199,7 @@ defmodule ElixirLS.LanguageServer.Server do def handle_cast({:receive_packet, notification(_) = packet}, state = %__MODULE__{}) do case packet do notification("exit") -> - new_state = - if Decider.handles?(:standard, "exit") do - handle_notification(packet, state) - else - state - end + new_state = handle_notification(packet, state) {:noreply, new_state} @@ -900,7 +878,7 @@ defmodule ElixirLS.LanguageServer.Server do "workspaceFolders" => %{"supported" => false, "changeNotifications" => false} }, "foldingRangeProvider" => true, - "codeActionProvider" => Experimental.LanguageServer.enabled?() + "codeActionProvider" => false } end diff --git a/apps/language_server/lib/language_server/server/decider.ex b/apps/language_server/lib/language_server/server/decider.ex deleted file mode 100644 index 770a6daca..000000000 --- a/apps/language_server/lib/language_server/server/decider.ex +++ /dev/null @@ -1,24 +0,0 @@ -defmodule ElixirLS.LanguageServer.Server.Decider do - @moduledoc """ - A module that determines if a message should be handled by - the extant server or the experimental server - """ - alias ElixirLS.LanguageServer.Experimental.LanguageServer, as: ExperimentalLS - import ElixirLS.LanguageServer.JsonRpc, only: [request: 2, notification: 1] - - def handles?(type, notification(method_name)) do - handles?(type, method_name) - end - - def handles?(type, request(_id, method_name)) do - handles?(type, method_name) - end - - def handles?(:standard, method_name) when is_binary(method_name) do - ExperimentalLS.handler_state(method_name) != :exclusive - end - - def handles?(:experimental, method_name) when is_binary(method_name) do - ExperimentalLS.handler_state(method_name) != :ignored - end -end diff --git a/apps/language_server/lib/mix/tasks/lsp/data_model.ex b/apps/language_server/lib/mix/tasks/lsp/data_model.ex deleted file mode 100644 index d5a7c51c2..000000000 --- a/apps/language_server/lib/mix/tasks/lsp/data_model.ex +++ /dev/null @@ -1,125 +0,0 @@ -defmodule Mix.Tasks.Lsp.DataModel do - alias Mix.Tasks.Lsp.DataModel.Enumeration - alias Mix.Tasks.Lsp.DataModel.Structure - alias Mix.Tasks.Lsp.DataModel.TypeAlias - - defstruct names_to_types: %{}, - notifications: %{}, - requests: %{}, - structures: %{}, - type_aliases: %{}, - enumerations: %{} - - def new do - with {:ok, root_meta} <- load_meta_model() do - names_to_types = - root_meta - |> Map.take(~w(structures enumerations typeAliases)) - |> Enum.flat_map(fn {type, list_of_things} -> - Enum.map(list_of_things, fn %{"name" => name} -> {name, type_name(type)} end) - end) - |> Map.new() - - type_aliases = load_from_meta(root_meta, "typeAliases", &TypeAlias.new/1) - enumerations = load_from_meta(root_meta, "enumerations", &Enumeration.new/1) - structures = load_from_meta(root_meta, "structures", &Structure.new/1) - - data_model = %__MODULE__{ - names_to_types: names_to_types, - enumerations: enumerations, - type_aliases: type_aliases, - structures: structures - } - - {:ok, data_model} - end - end - - def all_types(%__MODULE__{} = data_model) do - aliases = Map.values(data_model.type_aliases) - structures = Map.values(data_model.structures) - enumerations = Map.values(data_model.enumerations) - - aliases ++ enumerations ++ structures - end - - def fetch(%__MODULE__{} = data_model, name) do - field = - case kind(data_model, name) do - {:ok, :structure} -> :structures - {:ok, :type_alias} -> :type_aliases - {:ok, :enumeration} -> :enumerations - :error -> :error - end - - data_model - |> Map.get(field, %{}) - |> Map.fetch(name) - |> case do - {:ok, %element_module{} = element} -> - {:ok, element_module.resolve(element, data_model)} - - :error -> - :error - end - end - - def fetch!(%__MODULE__{} = data_model, name) do - case fetch(data_model, name) do - {:ok, thing} -> thing - :error -> raise "Could not find type #{name}" - end - end - - def references(%__MODULE__{} = data_model, %{name: name}) do - references(data_model, name) - end - - def references(%__MODULE__{} = data_model, roots) do - collect_references(data_model, List.wrap(roots), MapSet.new()) - end - - defp collect_references(%__MODULE__{}, [], %MapSet{} = references) do - MapSet.to_list(references) - end - - defp collect_references(%__MODULE__{} = data_model, [first | rest], %MapSet{} = references) do - with false <- MapSet.member?(references, first), - {:ok, %referred_type{} = referred} <- fetch(data_model, first) do - new_refs = referred_type.references(referred) - collect_references(data_model, rest ++ new_refs, MapSet.put(references, first)) - else - _ -> - collect_references(data_model, rest, references) - end - end - - defp load_from_meta(root_meta, name, new_fn) do - root_meta - |> Map.get(name) - |> Map.new(fn definition -> - loaded = new_fn.(definition) - {loaded.name, loaded} - end) - end - - defp kind(%__MODULE__{} = data_model, name) do - Map.fetch(data_model.names_to_types, name) - end - - defp type_name("structures"), do: :structure - defp type_name("enumerations"), do: :enumeration - defp type_name("typeAliases"), do: :type_alias - - @meta_model_file_name "metamodel.3.17.json" - defp load_meta_model do - file_name = - __ENV__.file - |> Path.dirname() - |> Path.join([@meta_model_file_name]) - - with {:ok, file_contents} <- File.read(file_name) do - JasonV.decode(file_contents) - end - end -end diff --git a/apps/language_server/lib/mix/tasks/lsp/data_model/enumeration.ex b/apps/language_server/lib/mix/tasks/lsp/data_model/enumeration.ex deleted file mode 100644 index fc3c451e9..000000000 --- a/apps/language_server/lib/mix/tasks/lsp/data_model/enumeration.ex +++ /dev/null @@ -1,65 +0,0 @@ -defmodule Mix.Tasks.Lsp.DataModel.Enumeration do - defmodule Value do - defstruct [:name, :value, :documentation] - - def new(%{"name" => name, "value" => value} = value_meta) do - docs = value_meta["documentation"] - %__MODULE__{name: name, value: value, documentation: docs} - end - end - - alias Mix.Tasks.Lsp.Mappings - alias Mix.Tasks.Lsp.DataModel - alias Mix.Tasks.Lsp.DataModel.Type - defstruct [:name, :values, :type] - - def new(%{"name" => name, "type" => type, "values" => values}) do - %__MODULE__{ - name: name, - type: Type.new(name, type), - values: Enum.map(values, &Value.new/1) - } - end - - def to_protocol(%__MODULE__{} = enumeration, _, _) do - module_name = Module.concat([enumeration.name]) - quote(do: unquote(module_name)) - end - - def resolve(%__MODULE__{} = enumeration, %DataModel{} = data_model) do - %__MODULE__{enumeration | type: Type.resolve(enumeration.type, data_model)} - end - - def build_definition( - %__MODULE__{} = enumeration, - %Mappings{} = mappings, - %DataModel{} - ) do - proto_module = Mappings.proto_module(mappings) - - with {:ok, destination_module} <- - Mappings.fetch_destination_module(mappings, enumeration.name) do - values = - Enum.map(enumeration.values, fn value -> - name = value.name |> Macro.underscore() |> String.to_atom() - quote(do: {unquote(name), unquote(value.value)}) - end) - - ast = - quote do - defmodule unquote(destination_module) do - alias unquote(proto_module) - use Proto - - defenum unquote(values) - end - end - - {:ok, ast} - end - end - - def references(%__MODULE__{}) do - [] - end -end diff --git a/apps/language_server/lib/mix/tasks/lsp/data_model/notification.ex b/apps/language_server/lib/mix/tasks/lsp/data_model/notification.ex deleted file mode 100644 index 52fcd3289..000000000 --- a/apps/language_server/lib/mix/tasks/lsp/data_model/notification.ex +++ /dev/null @@ -1,3 +0,0 @@ -defmodule Mix.Tasks.Lsp.DataModel.Notification do - defstruct [:method, :direction, :params, :documentation] -end diff --git a/apps/language_server/lib/mix/tasks/lsp/data_model/property.ex b/apps/language_server/lib/mix/tasks/lsp/data_model/property.ex deleted file mode 100644 index 4f8bef525..000000000 --- a/apps/language_server/lib/mix/tasks/lsp/data_model/property.ex +++ /dev/null @@ -1,37 +0,0 @@ -defmodule Mix.Tasks.Lsp.DataModel.Property do - alias Mix.Tasks.Lsp.DataModel - alias Mix.Tasks.Lsp.Mappings - alias Mix.Tasks.Lsp.DataModel.Type - - defstruct [:name, :type, :required?, :references, :documentation] - - def new(%{"name" => name, "type" => type} = property_meta) do - required? = !Map.get(property_meta, "optional", false) - - keys = Keyword.merge([name: name, required?: required?], type: Type.new(name, type)) - struct(__MODULE__, keys) - end - - def resolve(%__MODULE__{} = property, %DataModel{} = data_model) do - %__MODULE__{property | type: Type.resolve(property.type, data_model)} - end - - def to_protocol(%__MODULE__{} = property, %DataModel{} = data_model, %Mappings{} = mappings) do - underscored = property.name |> Macro.underscore() |> String.to_atom() - type_call = Type.to_protocol(property.type, data_model, mappings) - - if property.required? do - quote(do: {unquote(underscored), unquote(type_call)}) - else - quote(do: {unquote(underscored), optional(unquote(type_call))}) - end - end - - def references(%__MODULE__{} = property) do - %type_module{} = property.type - - property.type - |> type_module.references() - |> Enum.reject(fn name -> String.starts_with?(name, "LSP") end) - end -end diff --git a/apps/language_server/lib/mix/tasks/lsp/data_model/request.ex b/apps/language_server/lib/mix/tasks/lsp/data_model/request.ex deleted file mode 100644 index a125eae4c..000000000 --- a/apps/language_server/lib/mix/tasks/lsp/data_model/request.ex +++ /dev/null @@ -1,3 +0,0 @@ -defmodule Mix.Tasks.Lsp.DataModel.Request do - defstruct [:method, :result, :direction, :params] -end diff --git a/apps/language_server/lib/mix/tasks/lsp/data_model/structure.ex b/apps/language_server/lib/mix/tasks/lsp/data_model/structure.ex deleted file mode 100644 index cc0246c1f..000000000 --- a/apps/language_server/lib/mix/tasks/lsp/data_model/structure.ex +++ /dev/null @@ -1,131 +0,0 @@ -defmodule Mix.Tasks.Lsp.DataModel.Structure do - alias Mix.Tasks.Lsp.Mappings.NumberingContext - alias Mix.Tasks.Lsp.DataModel.Type.ObjectLiteral - alias Mix.Tasks.Lsp.Mappings - alias Mix.Tasks.Lsp.DataModel - alias Mix.Tasks.Lsp.DataModel.Type - alias Mix.Tasks.Lsp.DataModel.Property - - defstruct name: nil, documentation: nil, properties: nil, definition: nil, module: nil - - def new(%{"name" => name, "properties" => _} = definition) do - NumberingContext.new() - - %__MODULE__{ - name: name, - documentation: definition[:documentation], - definition: definition, - module: Module.concat([name]) - } - end - - def to_protocol(%__MODULE__{} = structure, _, %Mappings{} = _mappings) do - quote(do: unquote(structure.module)) - end - - def build_definition( - %__MODULE__{} = structure, - %Mappings{} = mappings, - %DataModel{} = data_model - ) do - with {:ok, destination_module} <- Mappings.fetch_destination_module(mappings, structure.name) do - NumberingContext.new() - types_module = Mappings.types_module(mappings) - proto_module = Mappings.proto_module(mappings) - structure = resolve(structure, data_model) - object_literals = Type.collect_object_literals(structure, data_model) - - literal_definitions = - Enum.map(object_literals, &ObjectLiteral.build_definition(&1, data_model, mappings)) - - protocol_properties = - structure.properties - |> Enum.sort_by(& &1.name) - |> Enum.map(&Property.to_protocol(&1, data_model, mappings)) - - type_module_alias = - case references(structure) do - [] -> [] - _ -> [quote(do: alias(unquote(types_module)))] - end - - ast = - quote do - defmodule unquote(destination_module) do - alias unquote(proto_module) - unquote_splicing(type_module_alias) - - unquote_splicing(literal_definitions) - - use Proto - deftype unquote(protocol_properties) - end - end - - {:ok, ast} - end - end - - def references(%__MODULE__{} = structure) do - Enum.flat_map(structure.properties, &Property.references/1) - end - - def resolve(%__MODULE__{properties: properties} = structure) when is_list(properties) do - structure - end - - def resolve(%__MODULE__{} = structure, %DataModel{} = data_model) do - %__MODULE__{structure | properties: properties(structure, data_model)} - end - - def properties(%__MODULE__{properties: properties}) when is_list(properties) do - properties - end - - def properties(%__MODULE__{} = structure, %DataModel{} = data_model) do - property_list(structure, data_model) - end - - defp resolve_remote_properties(%__MODULE__{} = structure, %DataModel{} = data_model) do - [] - |> add_extends(structure.definition) - |> add_mixins(structure.definition) - |> Enum.flat_map(fn %{"kind" => "reference", "name" => type_name} -> - data_model - |> DataModel.fetch!(type_name) - |> property_list(data_model) - end) - end - - defp property_list(%__MODULE__{} = structure, %DataModel{} = data_model) do - base_properties = - structure.definition - |> Map.get("properties") - |> Enum.map(&Property.new/1) - - base_property_names = MapSet.new(base_properties, & &1.name) - - # Note: The reject here is so that properties defined in the - # current structure override those defined in mixins and extends - resolved_remote_properties = - structure - |> resolve_remote_properties(data_model) - |> Enum.reject(&(&1.name in base_property_names)) - - base_properties - |> Enum.concat(resolved_remote_properties) - |> Enum.sort_by(& &1.name) - end - - defp add_extends(queue, %{"extends" => extends}) do - extends ++ queue - end - - defp add_extends(queue, _), do: queue - - defp add_mixins(queue, %{"mixins" => mixins}) do - mixins ++ queue - end - - defp add_mixins(queue, _), do: queue -end diff --git a/apps/language_server/lib/mix/tasks/lsp/data_model/type.ex b/apps/language_server/lib/mix/tasks/lsp/data_model/type.ex deleted file mode 100644 index 241f020ef..000000000 --- a/apps/language_server/lib/mix/tasks/lsp/data_model/type.ex +++ /dev/null @@ -1,408 +0,0 @@ -defmodule Mix.Tasks.Lsp.DataModel.Type do - alias Mix.Tasks.Lsp.DataModel - alias Mix.Tasks.Lsp.DataModel.Property - alias Mix.Tasks.Lsp.DataModel.Structure - alias Mix.Tasks.Lsp.DataModel.TypeAlias - alias Mix.Tasks.Lsp.Mappings - - defmodule Base do - defstruct [:kind, :type_name] - - def new(type_name) do - %__MODULE__{kind: :base, type_name: type_name} - end - - def resolve(%__MODULE__{} = base, %DataModel{}) do - base - end - - def to_protocol(%__MODULE__{} = type, %DataModel{} = _data_model, _) do - case type.type_name do - "string" -> quote(do: string()) - "integer" -> quote(do: integer()) - "uinteger" -> quote(do: integer()) - "boolean" -> quote(do: boolean()) - "null" -> quote(do: nil) - "DocumentUri" -> quote(do: string()) - "decimal" -> quote(do: float()) - "URI" -> quote(do: string()) - end - end - - def references(%__MODULE__{}) do - [] - end - end - - defmodule Array do - alias Mix.Tasks.Lsp.DataModel.Type - defstruct [:kind, :element_type] - - def new(parent_name, element_type) do - %__MODULE__{kind: :array, element_type: Type.new(parent_name, element_type)} - end - - def resolve(%__MODULE__{} = array, %DataModel{} = data_model) do - %__MODULE__{array | element_type: Type.resolve(array.element_type, data_model)} - end - - def to_protocol( - %__MODULE__{} = type, - %DataModel{} = data_model, - %Mappings{} = mappings - ) do - element_protocol = Type.to_protocol(type.element_type, data_model, mappings) - quote(do: list_of(unquote(element_protocol))) - end - - def references(%__MODULE__{} = array) do - %type_module{} = array.element_type - type_module.references(array.element_type) - end - end - - defmodule Tuple do - alias Mix.Tasks.Lsp.DataModel.Type - defstruct [:kind, :item_types] - - def new(parent_name, items) do - item_types = Enum.map(items, &Type.new(parent_name, &1)) - %__MODULE__{kind: :tuple, item_types: item_types} - end - - def resolve(%__MODULE__{} = tuple, %DataModel{} = data_model) do - resolved_types = Enum.map(tuple.item_types, &Type.resolve(&1, data_model)) - %__MODULE__{tuple | item_types: resolved_types} - end - - def to_protocol( - %__MODULE__{} = type, - %DataModel{} = data_model, - %Mappings{} = mappings - ) do - types = Enum.map(type.item_types, &Type.to_protocol(&1, data_model, mappings)) - quote(do: tuple_of(unquote(types))) - end - - def references(%__MODULE__{} = tuple) do - Enum.flat_map(tuple.item_types, fn %type_module{} = type -> type_module.references(type) end) - end - end - - defmodule Reference do - alias Mix.Tasks.Lsp.DataModel.Enumeration - alias Mix.Tasks.Lsp.DataModel.Structure - alias Mix.Tasks.Lsp.DataModel.Type - alias Mix.Tasks.Lsp.DataModel.TypeAlias - defstruct [:kind, :reference] - - def new(reference) do - %__MODULE__{kind: :reference, reference: reference} - end - - def resolve(%__MODULE__{} = reference, %DataModel{} = data_model) do - case DataModel.fetch!(data_model, reference.reference) do - %Enumeration{} = enumeration -> - Enumeration.resolve(enumeration, data_model) - - %Structure{} = structure -> - structure - - %TypeAlias{} = type_alias -> - TypeAlias.resolve(type_alias, data_model) - end - end - - def to_protocol( - %__MODULE__{} = type, - %DataModel{} = data_model, - %Mappings{} = mappings - ) do - case DataModel.fetch!(data_model, type.reference) do - %Enumeration{} = enumeration -> - {:ok, enumeration_module} = - Mappings.fetch_destination_module(mappings, enumeration, true) - - quote(do: unquote(enumeration_module)) - - %Structure{} = structure -> - {:ok, mapped_module} = Mappings.fetch_destination_module(mappings, structure, true) - - quote(do: unquote(mapped_module)) - - %TypeAlias{} = type_alias -> - {:ok, mapped_module} = Mappings.fetch_destination_module(mappings, type_alias, true) - quote(do: unquote(mapped_module)) - end - end - - def references(%__MODULE__{} = reference) do - [reference.reference] - end - end - - defmodule Or do - alias Mix.Tasks.Lsp.Mappings.NumberingContext - alias Mix.Tasks.Lsp.DataModel.Property - alias Mix.Tasks.Lsp.DataModel.Type - - defstruct [:kind, :subtypes] - - def new(parent_name, subtypes) do - subtypes = Enum.map(subtypes, &Type.new(parent_name, &1)) - %__MODULE__{kind: :or, subtypes: subtypes} - end - - def resolve(%__MODULE__{} = or_type, %DataModel{} = data_model) do - resolved_subtypes = Enum.map(or_type.subtypes, &Type.resolve(&1, data_model)) - - %__MODULE__{or_type | subtypes: resolved_subtypes} - or_type - end - - def to_protocol(%__MODULE__{} = type, %DataModel{} = data_model, %Mappings{} = mappings) do - subtypes = Enum.map(type.subtypes, &Type.to_protocol(&1, data_model, mappings)) - quote(do: one_of(unquote(subtypes))) - end - - def references(%__MODULE__{} = type) do - Enum.flat_map(type.subtypes, fn %type_module{} = type -> type_module.references(type) end) - end - end - - defmodule ObjectLiteral do - alias Mix.Tasks.Lsp.Mappings.NumberingContext - alias Mix.Tasks.Lsp.DataModel.Structure - alias Mix.Tasks.Lsp.DataModel.Property - defstruct [:kind, :name, :properties, :definition, :module] - - def new(parent_name, definition) do - base_name = Macro.camelize(parent_name) - - module = - case NumberingContext.get_and_increment(base_name) do - 0 -> Module.concat([base_name]) - sequence -> Module.concat(["#{base_name}#{sequence}"]) - end - - properties = Enum.map(definition, &Property.new/1) - - %__MODULE__{ - definition: definition, - kind: :object_literal, - properties: properties, - name: base_name, - module: module - } - end - - def resolve(%__MODULE__{properties: nil} = literal, %DataModel{} = data_model) do - resolved_properties = - %{"properties" => literal.definition, "name" => "Literal"} - |> Structure.new() - |> Structure.resolve(data_model) - |> Structure.properties(data_model) - - %__MODULE__{literal | properties: resolved_properties} - end - - def resolve(%__MODULE__{} = literal, _) do - literal - end - - def to_protocol(%__MODULE__{} = literal, %DataModel{}, %Mappings{}) do - module = module(literal) - quote(do: unquote(module)) - end - - def build_definition( - %__MODULE__{} = literal, - %DataModel{} = data_model, - %Mappings{} = mappings - ) do - resolved = resolve(literal, data_model) - module = module(literal) - - properties = - resolved.properties - |> Enum.sort_by(& &1.name) - |> Enum.map(&Property.to_protocol(&1, data_model, mappings)) - - quote do - defmodule unquote(module) do - use Proto - - deftype unquote(properties) - end - end - end - - defp module(%__MODULE__{} = literal) do - literal.module - end - - def references(%__MODULE__{} = literal) do - Enum.flat_map(literal.properties, &Property.references/1) - end - end - - defmodule Literal do - defstruct [:kind, :value, :base_type] - - def new(base_type, value) do - %__MODULE__{base_type: base_type, value: value, kind: :literal} - end - - def resolve(%__MODULE__{} = literal, %DataModel{}) do - literal - end - - def to_protocol(%__MODULE__{} = type, %DataModel{}, %Mappings{}) do - quote(do: literal(unquote(type.value))) - end - - def references(%__MODULE__{}) do - [] - end - end - - defmodule Dictionary do - alias Mix.Tasks.Lsp.DataModel.Type - defstruct [:kind, :key_type, :value_type] - - def new(parent_name, key_type, value_type) do - %__MODULE__{ - kind: :map, - key_type: Type.new(parent_name, key_type), - value_type: Type.new(parent_name, value_type) - } - end - - def resolve(%__MODULE__{} = map, %DataModel{} = data_model) do - resolved_key_type = Type.resolve(map.key_type, data_model) - resolved_value_type = Type.resolve(map.value_type, data_model) - %__MODULE__{map | key_type: resolved_key_type, value_type: resolved_value_type} - end - - def to_protocol( - %__MODULE__{} = type, - %DataModel{} = data_model, - %Mappings{} = mappings - ) do - value_type = Type.to_protocol(type.value_type, data_model, mappings) - quote(do: map_of(unquote(value_type))) - end - - def references(%__MODULE__{} = dictionary) do - %key_module{} = dictionary.key_type - %value_module{} = dictionary.value_type - - List.flatten([ - key_module.references(dictionary.key_type), - value_module.references(dictionary.value_type) - ]) - end - end - - def new(_parent_name, %{"kind" => "base", "name" => name}) do - Base.new(name) - end - - def new(_parent_name, %{"kind" => "reference", "name" => name}) do - Reference.new(name) - end - - def new(parent_name, %{"kind" => "or", "items" => types}) do - Or.new(parent_name, types) - end - - def new(_parent_name, %{"kind" => "stringLiteral", "value" => value}) do - Literal.new(:string, value) - end - - def new(parent_name, %{"kind" => "literal", "value" => %{"properties" => properties}}) do - ObjectLiteral.new(parent_name, properties) - end - - def new(parent_name, %{"kind" => "array", "element" => element_type}) do - Array.new(parent_name, element_type) - end - - def new(parent_name, %{"kind" => "map", "key" => key_type, "value" => value_type}) do - Dictionary.new(parent_name, key_type, value_type) - end - - def new(parent_name, %{"kind" => "tuple", "items" => items}) do - Tuple.new(parent_name, items) - end - - def resolve(%type_module{} = type, %DataModel{} = data_model) do - type_module.resolve(type, data_model) - end - - def to_protocol(%{reference: "LSPAny"}, _, _) do - quote(do: any()) - end - - def to_protocol(%{reference: "LSPObject"}, _, _) do - quote(do: map_of(any())) - end - - def to_protocol(%{reference: "LSPArray"}, _, _) do - quote(do: list_of(any())) - end - - def to_protocol( - %type_module{} = type, - %DataModel{} = data_model, - %Mappings{} = mappings - ) do - type_module.to_protocol(type, data_model, mappings) - end - - def collect_object_literals(type, %DataModel{} = data_model) do - type - |> collect_object_literals(data_model, []) - |> Enum.sort_by(& &1.module) - end - - def collect_object_literals(%ObjectLiteral{} = literal, %DataModel{} = data_model, acc) do - Enum.reduce(literal.properties, [literal | acc], &collect_object_literals(&1, data_model, &2)) - end - - def collect_object_literals(%Property{} = property, %DataModel{} = data_model, acc) do - collect_object_literals(property.type, data_model, acc) - end - - def collect_object_literals(%Array{} = array, %DataModel{} = data_model, acc) do - collect_object_literals(array.element_type, data_model, acc) - end - - def collect_object_literals(%Tuple{} = tuple, %DataModel{} = data_model, acc) do - Enum.reduce(tuple.item_types, acc, &collect_object_literals(&1, data_model, &2)) - end - - def collect_object_literals(%Structure{} = structure, %DataModel{} = data_model, acc) do - Enum.reduce(structure.properties, acc, &collect_object_literals(&1.type, data_model, &2)) - end - - def collect_object_literals(%Or{} = or_type, %DataModel{} = data_model, acc) do - Enum.reduce(or_type.subtypes, acc, &collect_object_literals(&1, data_model, &2)) - end - - def collect_object_literals(%Base{}, %DataModel{}, acc) do - acc - end - - def collect_object_literals(%Reference{}, %DataModel{}, acc) do - acc - end - - def collect_object_literals(%TypeAlias{name: "LSP" <> _}, _, acc) do - acc - end - - def collect_object_literals(_, _, acc) do - acc - end -end diff --git a/apps/language_server/lib/mix/tasks/lsp/data_model/type_alias.ex b/apps/language_server/lib/mix/tasks/lsp/data_model/type_alias.ex deleted file mode 100644 index 31e280a0f..000000000 --- a/apps/language_server/lib/mix/tasks/lsp/data_model/type_alias.ex +++ /dev/null @@ -1,76 +0,0 @@ -defmodule Mix.Tasks.Lsp.DataModel.TypeAlias do - alias Mix.Tasks.Lsp.DataModel.Type.ObjectLiteral - alias Mix.Tasks.Lsp.DataModel.Type.Base - alias Mix.Tasks.Lsp.Mappings - alias Mix.Tasks.Lsp.DataModel - alias Mix.Tasks.Lsp.DataModel.Type - - defstruct name: nil, type: nil - - def new(%{"name" => name, "type" => type}) do - type = Type.new(name, type) - - %__MODULE__{ - name: name, - type: type - } - end - - def resolve(%__MODULE__{name: "LSP" <> _} = type_alias, %DataModel{}) do - type_alias - end - - def resolve(%__MODULE__{} = type_alias, %DataModel{} = data_model) do - %__MODULE__{type_alias | type: Type.resolve(type_alias.type, data_model)} - end - - def build_definition(%__MODULE__{name: "LSP" <> _}, _, _) do - :skip - end - - def build_definition(%__MODULE__{type: %Base{}}, _, _) do - :skip - end - - def build_definition( - %__MODULE__{} = type_alias, - %Mappings{} = mappings, - %DataModel{} = data_model - ) do - with {:ok, destination_module} <- Mappings.fetch_destination_module(mappings, type_alias.name) do - type = Type.to_protocol(type_alias.type, data_model, mappings) - object_literals = Type.collect_object_literals(type_alias.type, data_model) - types_module = Mappings.types_module(mappings) - proto_module = Mappings.proto_module(mappings) - - literal_definitions = - Enum.map(object_literals, &ObjectLiteral.build_definition(&1, data_model, mappings)) - - type_module_alias = - case references(type_alias) do - [] -> [] - _ -> [quote(do: alias(unquote(types_module)))] - end - - ast = - quote do - defmodule unquote(destination_module) do - alias unquote(proto_module) - unquote_splicing(type_module_alias) - - unquote_splicing(literal_definitions) - - use Proto - defalias unquote(type) - end - end - - {:ok, ast} - end - end - - def references(%__MODULE__{} = type_alias) do - %type_module{} = type_alias.type - type_module.references(type_alias.type) - end -end diff --git a/apps/language_server/lib/mix/tasks/lsp/mappings.ex b/apps/language_server/lib/mix/tasks/lsp/mappings.ex deleted file mode 100644 index 950b26741..000000000 --- a/apps/language_server/lib/mix/tasks/lsp/mappings.ex +++ /dev/null @@ -1,142 +0,0 @@ -defmodule Mix.Tasks.Lsp.Mappings do - defmodule Mapping do - @derive JasonV.Encoder - - defstruct [:source, :destination, :imported_version] - - @version "3.17" - def new(%{ - "source" => source, - "destination" => destination - }) do - new(source, destination) - end - - def new(source, destination) do - %__MODULE__{source: source, destination: destination, imported_version: @version} - end - end - - @types_module LSP.Types - @proto_module ElixirLS.LanguageServer.Experimental.Protocol.Proto - - defstruct [:mappings, :imported_lsp_names, :types_module, :proto_module] - - def new(options \\ []) do - types_module = - options - |> Keyword.get(:types_module, @types_module) - |> List.wrap() - |> Module.concat() - - proto_module = - options - |> Keyword.get(:proto_module, @proto_module) - |> List.wrap() - |> Module.concat() - - with {:ok, type_mappings} = load_type_mappings() do - imported_lsp_names = MapSet.new(type_mappings, & &1.source) - - mappings = %__MODULE__{ - mappings: type_mappings, - imported_lsp_names: imported_lsp_names, - types_module: types_module, - proto_module: proto_module - } - - {:ok, mappings} - end - end - - def proto_module(%__MODULE__{} = mappings) do - mappings.proto_module - end - - def types_module(%__MODULE__{} = mappings) do - mappings.types_module - end - - def put_new(%__MODULE__{} = mappings, source, destination) do - if imported?(mappings, source) do - :error - else - i = Mapping.new(source, destination) - - mappings = %__MODULE__{ - imported_lsp_names: MapSet.put(mappings.imported_lsp_names, i.source), - mappings: [i | mappings.mappings] - } - - {:ok, mappings} - end - end - - def write(%__MODULE__{} = mappings) do - sorted = Enum.sort_by(mappings.mappings, fn %Mapping{} = mapping -> mapping.source end) - - with {:ok, json_text} <- JasonV.encode(sorted, pretty: true) do - json_text = [json_text, "\n"] - File.write(file_path(), json_text) - end - end - - def imported?(%__MODULE__{} = mappings, lsp_name) do - lsp_name in mappings.imported_lsp_names - end - - def fetch(%__MODULE__{} = mappings, lsp_name) do - case Enum.find(mappings.mappings, fn %Mapping{source: source} -> source == lsp_name end) do - %Mapping{} = mapping -> {:ok, mapping} - nil -> :error - end - end - - def fetch_destination_module(mappings, needle, truncate? \\ false) - - def fetch_destination_module(%__MODULE__{} = mappings, %_{name: lsp_name}, truncate?) do - fetch_destination_module(mappings, lsp_name, truncate?) - end - - def fetch_destination_module(%__MODULE__{} = mappings, lsp_name, truncate?) do - case fetch(mappings, lsp_name) do - {:ok, %Mapping{} = mapping} -> - module_string = - if truncate? do - aliased = - mappings - |> types_module() - |> Module.split() - |> List.last() - - Module.concat([aliased, mapping.destination]) - else - Module.concat([types_module(mappings), mapping.destination]) - end - - {:ok, Module.concat([module_string])} - - error -> - error - end - end - - @import_filename "type_mappings.json" - defp load_type_mappings do - import_file_path = file_path() - - with {:ok, json_text} <- File.read(import_file_path), - {:ok, contents} <- JasonV.decode(json_text) do - {:ok, from_json(contents)} - end - end - - defp from_json(json_file) do - Enum.map(json_file, &Mapping.new/1) - end - - defp file_path do - current_dir = Path.dirname(__ENV__.file) - Path.join([current_dir, @import_filename]) - end -end diff --git a/apps/language_server/lib/mix/tasks/lsp/mappings/generate.ex b/apps/language_server/lib/mix/tasks/lsp/mappings/generate.ex deleted file mode 100644 index 4e2bc7517..000000000 --- a/apps/language_server/lib/mix/tasks/lsp/mappings/generate.ex +++ /dev/null @@ -1,223 +0,0 @@ -defmodule Mix.Tasks.Lsp.Mappings.Generate do - use Mix.Task - @shortdoc "Generate the LSP protocol modules" - @moduledoc """ - Generate the LSP protocol modules - - This task reads the mapping file and generates all of the LSP protocol artifacts. - Prior to running this task, you must first generate the mapping file with `mix lsp.mappings.init`. - That will create the file `type_mappings.json` which contains the source and destination modules for all - defined LSP types. - - Once that file is generated, the file can be edited to control where the generated elixir modules will live. - While doing the mapping, it's often helpful to run `mix lsp.mappings.print` to see current state of the mapping. - Once you're satisfied, run this task and elixir files will be generated in `lib/generated`. - - - ## Command line options - * `--types-module` - Controls the module in which the generated structures are placed. - (defaults to `LSP.Types`) - * `--proto-module` - Controls the module in which the generated structures are placed. - (defaults to `ElixirLS.LanguageServer.Experimental.Protocol.Proto`) - * `--only` - Only generate the LSP types in the comma separated list - * `--roots` - A comma separated list of types to import. The types given will be interrogated - and all their references will also be imported. This is useful when importing complex structures, - as you don't need to specify all the types you wish to import. - """ - - alias Mix.Tasks.Lsp.DataModel - alias Mix.Tasks.Lsp.Mappings - alias Mix.Tasks.Lsp.Mappings.Mapping - - @generated_files_root ~w(lib generated) - @switches [ - only: :string, - proto_module: :string, - roots: :string, - types_module: :string - ] - - def run(args) do - args - |> parse_options() - |> do_run() - end - - def do_run(options) do - mappings_opts = Keyword.take(options, [:types_module, :proto_module]) - - with {:ok, %DataModel{} = data_model} <- DataModel.new(), - {:ok, mappings} <- Mappings.new(mappings_opts), - {:ok, types_to_map} <- get_mapped_types(options, data_model), - {:ok, results} <- map_lsp_types(types_to_map, data_model, mappings) do - IO.puts("Mapping complete, writing #{length(results)} files") - - for {file_name, ast} <- results do - write_file(file_name, ast) - IO.write(".") - end - - IO.puts("\nComplete.") - else - {:error, reason} -> - Mix.Shell.IO.error("An error occurred during mapping #{to_string(reason)}") - - error -> - Mix.Shell.IO.error("An error occurred during mapping #{inspect(error)}") - end - end - - defp parse_options(args) do - {keywords, _, _} = OptionParser.parse(args, strict: @switches) - - if Keyword.has_key?(keywords, :only) and Keyword.has_key?(keywords, :roots) do - raise "You can only specify one of --only and --roots" - end - - keywords - |> Keyword.replace_lazy(:only, &split_comma_delimited/1) - |> Keyword.replace_lazy(:roots, &split_comma_delimited/1) - end - - defp map_lsp_types(types_to_map, %DataModel{} = data_model, %Mappings{} = mappings) do - mapping_results = - types_to_map - |> Enum.map(&do_mapping(&1, mappings, data_model)) - |> Enum.reduce_while([], fn - :skip, acc -> - IO.write([IO.ANSI.yellow(), ".", IO.ANSI.reset()]) - - {:cont, acc} - - {:ok, file, ast}, results -> - IO.write([IO.ANSI.green(), ".", IO.ANSI.reset()]) - - {:cont, [{file, ast} | results]} - - error, _ -> - IO.write([IO.ANSI.red(), "x", IO.ANSI.reset()]) - - {:halt, error} - end) - - IO.puts("") - - case mapping_results do - results when is_list(results) -> - {:ok, Enum.reverse(results)} - - error -> - error - end - end - - defp do_mapping(%struct_module{} = structure, %Mappings{} = mappings, %DataModel{} = data_model) do - with {:ok, %Mapping{}} <- Mappings.fetch(mappings, structure.name), - {:ok, destination_module} <- Mappings.fetch_destination_module(mappings, structure.name), - {:ok, definition_ast} <- struct_module.build_definition(structure, mappings, data_model) do - {:ok, file_for(destination_module), definition_ast} - end - end - - defp get_mapped_types(options, %DataModel{} = data_model) do - cond do - Keyword.has_key?(options, :only) -> - options - |> Keyword.get(:only) - |> do_get_mapped_types(data_model) - - Keyword.has_key?(options, :roots) -> - roots = Keyword.get(options, :roots) - - data_model - |> DataModel.references(roots) - |> do_get_mapped_types(data_model) - - true -> - do_get_mapped_types(:all, data_model) - end - end - - defp do_get_mapped_types(:all, %DataModel{} = data_model) do - all_types = - data_model - |> DataModel.all_types() - |> Enum.sort_by(& &1.name) - - {:ok, all_types} - end - - defp do_get_mapped_types(structure_names, %DataModel{} = data_model) do - results = - Enum.reduce_while(structure_names, [], fn name, acc -> - case DataModel.fetch(data_model, name) do - {:ok, structure} -> {:cont, [structure | acc]} - _ -> {:halt, {:error, "'#{name}' is not the name of a valid LSP structure"}} - end - end) - - case results do - mappings when is_list(mappings) -> - {:ok, Enum.sort_by(mappings, & &1.name)} - - error -> - error - end - end - - defp file_for(destination_module) do - base = Path.split(File.cwd!()) ++ @generated_files_root - - pieces = Module.split(destination_module) - {modules, [file]} = Enum.split(pieces, length(pieces) - 1) - - directories = - for module <- modules, - module != "ElixirLS" do - Macro.underscore(module) - end - - file_name = - case Macro.underscore(file) do - "_" <> rest -> rest <> ".ex" - other -> other <> ".ex" - end - - (base ++ directories) - |> Path.join() - |> Path.join(file_name) - end - - def write_file(file_path, ast) do - dir = Path.dirname(file_path) - File.mkdir_p!(dir) - {formatter, options} = formatter_and_opts_for(file_path) - locals_without_parens = Keyword.get(options, :locals_without_parens) - code = ast_to_string(ast, locals_without_parens, formatter) - File.write!(file_path, [header(), code]) - end - - defp ast_to_string(ast, locals_without_parens, formatter) do - ast - |> Code.quoted_to_algebra(locals_without_parens: locals_without_parens) - |> Inspect.Algebra.format(:infinity) - |> IO.iodata_to_binary() - |> formatter.() - end - - defp formatter_and_opts_for(file_path) do - Mix.Tasks.Format.formatter_for_file(file_path) - end - - defp header do - """ - # This file's contents are auto-generated. Do not edit. - """ - end - - defp split_comma_delimited(string) do - string - |> String.split(",") - |> Enum.map(&String.trim/1) - end -end diff --git a/apps/language_server/lib/mix/tasks/lsp/mappings/init.ex b/apps/language_server/lib/mix/tasks/lsp/mappings/init.ex deleted file mode 100644 index 872355ef8..000000000 --- a/apps/language_server/lib/mix/tasks/lsp/mappings/init.ex +++ /dev/null @@ -1,48 +0,0 @@ -defmodule Mix.Tasks.Lsp.Mappings.Init do - alias Mix.Shell.IO, as: ShellIO - alias Mix.Tasks.Lsp.Mappings - alias Mix.Tasks.Lsp.DataModel - - use Mix.Task - @base_module "LSP.Types" - def run(_) do - with {:ok, data_model} <- DataModel.new(), - {:ok, current} <- Mappings.new() do - current = - current - |> write_structures(data_model) - |> write_enumerations(data_model) - |> write_type_aliases(data_model) - - Mappings.write(current) - end - end - - defp write_structures(%Mappings{} = mappings, %DataModel{} = data_model) do - write_data_type(data_model.structures, mappings) - end - - defp write_enumerations(%Mappings{} = mappings, %DataModel{} = data_model) do - write_data_type(data_model.enumerations, mappings) - end - - defp write_type_aliases(%Mappings{} = mappings, %DataModel{} = data_model) do - write_data_type(data_model.type_aliases, mappings) - end - - defp write_data_type(list_of_data_types, %Mappings{} = mappings) do - Enum.reduce(list_of_data_types, mappings, fn - {name, _}, %Mappings{} = curr -> - destination_module = "#{@base_module}.#{name}" - - case Mappings.put_new(curr, name, destination_module) do - {:ok, new_current} -> - new_current - - :error -> - ShellIO.info("#{name} has already been mapped") - mappings - end - end) - end -end diff --git a/apps/language_server/lib/mix/tasks/lsp/mappings/numbering_context.ex b/apps/language_server/lib/mix/tasks/lsp/mappings/numbering_context.ex deleted file mode 100644 index 45ae4e305..000000000 --- a/apps/language_server/lib/mix/tasks/lsp/mappings/numbering_context.ex +++ /dev/null @@ -1,32 +0,0 @@ -defmodule Mix.Tasks.Lsp.Mappings.NumberingContext do - def new do - Process.put(:numbering, %{}) - end - - def get(name) do - :numbering - |> Process.get(%{}) - |> Map.get(name) - end - - def get_and_increment(name) do - case Process.get(:numbering, :undefined) do - :undefined -> - Process.put(:numbering, %{name => 1}) - 0 - - %{} = other -> - {existing, updated} = - Map.get_and_update(other, name, fn - nil -> - {0, 1} - - current -> - {current, current + 1} - end) - - Process.put(:numbering, updated) - existing - end - end -end diff --git a/apps/language_server/lib/mix/tasks/lsp/mappings/print.ex b/apps/language_server/lib/mix/tasks/lsp/mappings/print.ex deleted file mode 100644 index 067dc9a9a..000000000 --- a/apps/language_server/lib/mix/tasks/lsp/mappings/print.ex +++ /dev/null @@ -1,183 +0,0 @@ -defmodule Mix.Tasks.Lsp.Mappings.Print do - alias IO.ANSI - alias Mix.Tasks.Lsp.Mappings.Mapping - alias Mix.Tasks.Lsp.Mappings - - defmodule Node do - defstruct path: nil, value: nil, children: %{} - - def new(path \\ nil) do - %__MODULE__{path: path} - end - - def children_size(%__MODULE__{} = node) do - map_size(node.children) - end - - def name(%__MODULE__{} = node) do - case node.path do - list when is_list(list) -> List.last(list) - nil -> "<>" - end - end - - def has_value?(%__MODULE__{} = node) do - node.value != nil - end - - def add(%__MODULE__{} = node, path, value) do - do_add(node, path, [], value) - end - - defp do_add(%__MODULE__{} = node, [], current_path, value) do - %__MODULE__{node | value: value, path: Enum.reverse(current_path)} - end - - defp do_add(%__MODULE__{} = node, [next | rest], current_path, value) do - current_path = [next | current_path] - - children = - Map.update( - node.children, - next, - current_path |> Enum.reverse() |> new() |> do_add(rest, current_path, value), - fn %Node{} = existing -> - do_add(existing, rest, current_path, value) - end - ) - - %__MODULE__{node | children: children} - end - end - - @shortdoc "Prints out the current mappings" - @moduledoc """ - Prints out the current mappings - This task reads `type_mappings.json` and generates a nested tree of the current mappings, much - like `mix deps.tree` does. - Use this task while determining where mappings live, as it's much easier to see the module structure - graphically as opposed to remembering all the mappings in the json file. - """ - use Mix.Task - @down "└" - @right "─" - @tee "├" - - def run(_) do - with {:ok, mappings} <- Mappings.new() do - print(mappings) - end - end - - def print(%Mappings{} = mappings) do - legend() - - mappings - |> build_tree() - |> print_tree() - end - - defp legend do - """ - Current Module mappings follow. - Modules that will result in a mapping file are #{mapped_module_color()}WrittenLikeThis#{ANSI.reset()} - while modules that just hold other modules are #{namespace_color()}WrittenLikeThis#{ANSI.reset()} - """ - |> IO.puts() - end - - defp mapped_module_color do - [ANSI.bright(), ANSI.white()] - end - - defp namespace_color do - [ANSI.cyan(), ANSI.italic()] - end - - defp print_tree(%Node{path: nil} = root) do - print_children(root, -1) - end - - defp print_tree(%Node{} = node, level \\ 0, last? \\ false) do - child_count_message = - case Node.children_size(node) do - 0 -> - "" - - child_count -> - ["(", pluralize(child_count, "child", "children"), ")"] - end - - sep = - cond do - level == 0 -> - "" - - last? -> - @down - - true -> - @tee - end - - name_color = - if Node.has_value?(node) do - mapped_module_color() - else - namespace_color() - end - - child_color = ANSI.yellow() - - indent = String.duplicate(" ", 2 * level) - - IO.puts([ - indent, - sep, - @right, - " ", - name_color, - Node.name(node), - ANSI.reset(), - " ", - child_color, - child_count_message, - ANSI.reset() - ]) - - print_children(node, level) - end - - defp print_children(%Node{children: children} = node, level) when map_size(children) > 0 do - child_count = Node.children_size(node) - - children - |> Map.values() - |> Enum.sort_by(&Node.name(&1)) - |> Enum.with_index() - |> Enum.each(fn {%Node{} = child, index} -> - print_tree(child, level + 1, last?(child_count, index)) - end) - end - - defp print_children(_, _) do - end - - defp pluralize(1, singular, _plural), do: "1 #{singular}" - defp pluralize(num, _, plural), do: "#{num} #{plural}" - - defp build_tree(%Mappings{} = mappings) do - Enum.reduce(mappings.mappings, Node.new(), fn %Mapping{} = mapping, %Node{} = root -> - path = split_module(mapping.destination) - Node.add(root, path, List.last(path)) - end) - end - - defp last?(item_count, index) do - index == item_count - 1 - end - - defp split_module(s) do - String.split(s, ".") - end -end diff --git a/apps/language_server/lib/mix/tasks/lsp/metamodel.3.17.json b/apps/language_server/lib/mix/tasks/lsp/metamodel.3.17.json deleted file mode 100644 index b43b4bdbb..000000000 --- a/apps/language_server/lib/mix/tasks/lsp/metamodel.3.17.json +++ /dev/null @@ -1,14383 +0,0 @@ -{ - "metaData": { - "version": "3.17.0" - }, - "requests": [ - { - "method": "textDocument/implementation", - "result": { - "kind": "or", - "items": [ - { - "kind": "reference", - "name": "Definition" - }, - { - "kind": "array", - "element": { - "kind": "reference", - "name": "DefinitionLink" - } - }, - { - "kind": "base", - "name": "null" - } - ] - }, - "messageDirection": "clientToServer", - "params": { - "kind": "reference", - "name": "ImplementationParams" - }, - "partialResult": { - "kind": "or", - "items": [ - { - "kind": "array", - "element": { - "kind": "reference", - "name": "Location" - } - }, - { - "kind": "array", - "element": { - "kind": "reference", - "name": "DefinitionLink" - } - } - ] - }, - "registrationOptions": { - "kind": "reference", - "name": "ImplementationRegistrationOptions" - }, - "documentation": "A request to resolve the implementation locations of a symbol at a given text\ndocument position. The request's parameter is of type [TextDocumentPositionParams]\n(#TextDocumentPositionParams) the response is of type [Definition](#Definition) or a\nThenable that resolves to such." - }, - { - "method": "textDocument/typeDefinition", - "result": { - "kind": "or", - "items": [ - { - "kind": "reference", - "name": "Definition" - }, - { - "kind": "array", - "element": { - "kind": "reference", - "name": "DefinitionLink" - } - }, - { - "kind": "base", - "name": "null" - } - ] - }, - "messageDirection": "clientToServer", - "params": { - "kind": "reference", - "name": "TypeDefinitionParams" - }, - "partialResult": { - "kind": "or", - "items": [ - { - "kind": "array", - "element": { - "kind": "reference", - "name": "Location" - } - }, - { - "kind": "array", - "element": { - "kind": "reference", - "name": "DefinitionLink" - } - } - ] - }, - "registrationOptions": { - "kind": "reference", - "name": "TypeDefinitionRegistrationOptions" - }, - "documentation": "A request to resolve the type definition locations of a symbol at a given text\ndocument position. The request's parameter is of type [TextDocumentPositionParams]\n(#TextDocumentPositionParams) the response is of type [Definition](#Definition) or a\nThenable that resolves to such." - }, - { - "method": "workspace/workspaceFolders", - "result": { - "kind": "or", - "items": [ - { - "kind": "array", - "element": { - "kind": "reference", - "name": "WorkspaceFolder" - } - }, - { - "kind": "base", - "name": "null" - } - ] - }, - "messageDirection": "serverToClient", - "documentation": "The `workspace/workspaceFolders` is sent from the server to the client to fetch the open workspace folders." - }, - { - "method": "workspace/configuration", - "result": { - "kind": "array", - "element": { - "kind": "reference", - "name": "LSPAny" - } - }, - "messageDirection": "serverToClient", - "params": { - "kind": "and", - "items": [ - { - "kind": "reference", - "name": "ConfigurationParams" - }, - { - "kind": "reference", - "name": "PartialResultParams" - } - ] - }, - "documentation": "The 'workspace/configuration' request is sent from the server to the client to fetch a certain\nconfiguration setting.\n\nThis pull model replaces the old push model were the client signaled configuration change via an\nevent. If the server still needs to react to configuration changes (since the server caches the\nresult of `workspace/configuration` requests) the server should register for an empty configuration\nchange event and empty the cache if such an event is received." - }, - { - "method": "textDocument/documentColor", - "result": { - "kind": "array", - "element": { - "kind": "reference", - "name": "ColorInformation" - } - }, - "messageDirection": "clientToServer", - "params": { - "kind": "reference", - "name": "DocumentColorParams" - }, - "partialResult": { - "kind": "array", - "element": { - "kind": "reference", - "name": "ColorInformation" - } - }, - "registrationOptions": { - "kind": "reference", - "name": "DocumentColorRegistrationOptions" - }, - "documentation": "A request to list all color symbols found in a given text document. The request's\nparameter is of type [DocumentColorParams](#DocumentColorParams) the\nresponse is of type [ColorInformation[]](#ColorInformation) or a Thenable\nthat resolves to such." - }, - { - "method": "textDocument/colorPresentation", - "result": { - "kind": "array", - "element": { - "kind": "reference", - "name": "ColorPresentation" - } - }, - "messageDirection": "clientToServer", - "params": { - "kind": "reference", - "name": "ColorPresentationParams" - }, - "partialResult": { - "kind": "array", - "element": { - "kind": "reference", - "name": "ColorPresentation" - } - }, - "registrationOptions": { - "kind": "and", - "items": [ - { - "kind": "reference", - "name": "WorkDoneProgressOptions" - }, - { - "kind": "reference", - "name": "TextDocumentRegistrationOptions" - } - ] - }, - "documentation": "A request to list all presentation for a color. The request's\nparameter is of type [ColorPresentationParams](#ColorPresentationParams) the\nresponse is of type [ColorInformation[]](#ColorInformation) or a Thenable\nthat resolves to such." - }, - { - "method": "textDocument/foldingRange", - "result": { - "kind": "or", - "items": [ - { - "kind": "array", - "element": { - "kind": "reference", - "name": "FoldingRange" - } - }, - { - "kind": "base", - "name": "null" - } - ] - }, - "messageDirection": "clientToServer", - "params": { - "kind": "reference", - "name": "FoldingRangeParams" - }, - "partialResult": { - "kind": "array", - "element": { - "kind": "reference", - "name": "FoldingRange" - } - }, - "registrationOptions": { - "kind": "reference", - "name": "FoldingRangeRegistrationOptions" - }, - "documentation": "A request to provide folding ranges in a document. The request's\nparameter is of type [FoldingRangeParams](#FoldingRangeParams), the\nresponse is of type [FoldingRangeList](#FoldingRangeList) or a Thenable\nthat resolves to such." - }, - { - "method": "textDocument/declaration", - "result": { - "kind": "or", - "items": [ - { - "kind": "reference", - "name": "Declaration" - }, - { - "kind": "array", - "element": { - "kind": "reference", - "name": "DeclarationLink" - } - }, - { - "kind": "base", - "name": "null" - } - ] - }, - "messageDirection": "clientToServer", - "params": { - "kind": "reference", - "name": "DeclarationParams" - }, - "partialResult": { - "kind": "or", - "items": [ - { - "kind": "array", - "element": { - "kind": "reference", - "name": "Location" - } - }, - { - "kind": "array", - "element": { - "kind": "reference", - "name": "DeclarationLink" - } - } - ] - }, - "registrationOptions": { - "kind": "reference", - "name": "DeclarationRegistrationOptions" - }, - "documentation": "A request to resolve the type definition locations of a symbol at a given text\ndocument position. The request's parameter is of type [TextDocumentPositionParams]\n(#TextDocumentPositionParams) the response is of type [Declaration](#Declaration)\nor a typed array of [DeclarationLink](#DeclarationLink) or a Thenable that resolves\nto such." - }, - { - "method": "textDocument/selectionRange", - "result": { - "kind": "or", - "items": [ - { - "kind": "array", - "element": { - "kind": "reference", - "name": "SelectionRange" - } - }, - { - "kind": "base", - "name": "null" - } - ] - }, - "messageDirection": "clientToServer", - "params": { - "kind": "reference", - "name": "SelectionRangeParams" - }, - "partialResult": { - "kind": "array", - "element": { - "kind": "reference", - "name": "SelectionRange" - } - }, - "registrationOptions": { - "kind": "reference", - "name": "SelectionRangeRegistrationOptions" - }, - "documentation": "A request to provide selection ranges in a document. The request's\nparameter is of type [SelectionRangeParams](#SelectionRangeParams), the\nresponse is of type [SelectionRange[]](#SelectionRange[]) or a Thenable\nthat resolves to such." - }, - { - "method": "window/workDoneProgress/create", - "result": { - "kind": "base", - "name": "null" - }, - "messageDirection": "serverToClient", - "params": { - "kind": "reference", - "name": "WorkDoneProgressCreateParams" - }, - "documentation": "The `window/workDoneProgress/create` request is sent from the server to the client to initiate progress\nreporting from the server." - }, - { - "method": "textDocument/prepareCallHierarchy", - "result": { - "kind": "or", - "items": [ - { - "kind": "array", - "element": { - "kind": "reference", - "name": "CallHierarchyItem" - } - }, - { - "kind": "base", - "name": "null" - } - ] - }, - "messageDirection": "clientToServer", - "params": { - "kind": "reference", - "name": "CallHierarchyPrepareParams" - }, - "registrationOptions": { - "kind": "reference", - "name": "CallHierarchyRegistrationOptions" - }, - "documentation": "A request to result a `CallHierarchyItem` in a document at a given position.\nCan be used as an input to an incoming or outgoing call hierarchy.\n\n@since 3.16.0", - "since": "3.16.0" - }, - { - "method": "callHierarchy/incomingCalls", - "result": { - "kind": "or", - "items": [ - { - "kind": "array", - "element": { - "kind": "reference", - "name": "CallHierarchyIncomingCall" - } - }, - { - "kind": "base", - "name": "null" - } - ] - }, - "messageDirection": "clientToServer", - "params": { - "kind": "reference", - "name": "CallHierarchyIncomingCallsParams" - }, - "partialResult": { - "kind": "array", - "element": { - "kind": "reference", - "name": "CallHierarchyIncomingCall" - } - }, - "documentation": "A request to resolve the incoming calls for a given `CallHierarchyItem`.\n\n@since 3.16.0", - "since": "3.16.0" - }, - { - "method": "callHierarchy/outgoingCalls", - "result": { - "kind": "or", - "items": [ - { - "kind": "array", - "element": { - "kind": "reference", - "name": "CallHierarchyOutgoingCall" - } - }, - { - "kind": "base", - "name": "null" - } - ] - }, - "messageDirection": "clientToServer", - "params": { - "kind": "reference", - "name": "CallHierarchyOutgoingCallsParams" - }, - "partialResult": { - "kind": "array", - "element": { - "kind": "reference", - "name": "CallHierarchyOutgoingCall" - } - }, - "documentation": "A request to resolve the outgoing calls for a given `CallHierarchyItem`.\n\n@since 3.16.0", - "since": "3.16.0" - }, - { - "method": "textDocument/semanticTokens/full", - "result": { - "kind": "or", - "items": [ - { - "kind": "reference", - "name": "SemanticTokens" - }, - { - "kind": "base", - "name": "null" - } - ] - }, - "messageDirection": "clientToServer", - "params": { - "kind": "reference", - "name": "SemanticTokensParams" - }, - "partialResult": { - "kind": "reference", - "name": "SemanticTokensPartialResult" - }, - "registrationMethod": "textDocument/semanticTokens", - "registrationOptions": { - "kind": "reference", - "name": "SemanticTokensRegistrationOptions" - }, - "documentation": "@since 3.16.0", - "since": "3.16.0" - }, - { - "method": "textDocument/semanticTokens/full/delta", - "result": { - "kind": "or", - "items": [ - { - "kind": "reference", - "name": "SemanticTokens" - }, - { - "kind": "reference", - "name": "SemanticTokensDelta" - }, - { - "kind": "base", - "name": "null" - } - ] - }, - "messageDirection": "clientToServer", - "params": { - "kind": "reference", - "name": "SemanticTokensDeltaParams" - }, - "partialResult": { - "kind": "or", - "items": [ - { - "kind": "reference", - "name": "SemanticTokensPartialResult" - }, - { - "kind": "reference", - "name": "SemanticTokensDeltaPartialResult" - } - ] - }, - "registrationMethod": "textDocument/semanticTokens", - "registrationOptions": { - "kind": "reference", - "name": "SemanticTokensRegistrationOptions" - }, - "documentation": "@since 3.16.0", - "since": "3.16.0" - }, - { - "method": "textDocument/semanticTokens/range", - "result": { - "kind": "or", - "items": [ - { - "kind": "reference", - "name": "SemanticTokens" - }, - { - "kind": "base", - "name": "null" - } - ] - }, - "messageDirection": "clientToServer", - "params": { - "kind": "reference", - "name": "SemanticTokensRangeParams" - }, - "partialResult": { - "kind": "reference", - "name": "SemanticTokensPartialResult" - }, - "registrationMethod": "textDocument/semanticTokens", - "documentation": "@since 3.16.0", - "since": "3.16.0" - }, - { - "method": "workspace/semanticTokens/refresh", - "result": { - "kind": "base", - "name": "null" - }, - "messageDirection": "clientToServer", - "documentation": "@since 3.16.0", - "since": "3.16.0" - }, - { - "method": "window/showDocument", - "result": { - "kind": "reference", - "name": "ShowDocumentResult" - }, - "messageDirection": "serverToClient", - "params": { - "kind": "reference", - "name": "ShowDocumentParams" - }, - "documentation": "A request to show a document. This request might open an\nexternal program depending on the value of the URI to open.\nFor example a request to open `https://code.visualstudio.com/`\nwill very likely open the URI in a WEB browser.\n\n@since 3.16.0", - "since": "3.16.0" - }, - { - "method": "textDocument/linkedEditingRange", - "result": { - "kind": "or", - "items": [ - { - "kind": "reference", - "name": "LinkedEditingRanges" - }, - { - "kind": "base", - "name": "null" - } - ] - }, - "messageDirection": "clientToServer", - "params": { - "kind": "reference", - "name": "LinkedEditingRangeParams" - }, - "registrationOptions": { - "kind": "reference", - "name": "LinkedEditingRangeRegistrationOptions" - }, - "documentation": "A request to provide ranges that can be edited together.\n\n@since 3.16.0", - "since": "3.16.0" - }, - { - "method": "workspace/willCreateFiles", - "result": { - "kind": "or", - "items": [ - { - "kind": "reference", - "name": "WorkspaceEdit" - }, - { - "kind": "base", - "name": "null" - } - ] - }, - "messageDirection": "clientToServer", - "params": { - "kind": "reference", - "name": "CreateFilesParams" - }, - "registrationOptions": { - "kind": "reference", - "name": "FileOperationRegistrationOptions" - }, - "documentation": "The will create files request is sent from the client to the server before files are actually\ncreated as long as the creation is triggered from within the client.\n\n@since 3.16.0", - "since": "3.16.0" - }, - { - "method": "workspace/willRenameFiles", - "result": { - "kind": "or", - "items": [ - { - "kind": "reference", - "name": "WorkspaceEdit" - }, - { - "kind": "base", - "name": "null" - } - ] - }, - "messageDirection": "clientToServer", - "params": { - "kind": "reference", - "name": "RenameFilesParams" - }, - "registrationOptions": { - "kind": "reference", - "name": "FileOperationRegistrationOptions" - }, - "documentation": "The will rename files request is sent from the client to the server before files are actually\nrenamed as long as the rename is triggered from within the client.\n\n@since 3.16.0", - "since": "3.16.0" - }, - { - "method": "workspace/willDeleteFiles", - "result": { - "kind": "or", - "items": [ - { - "kind": "reference", - "name": "WorkspaceEdit" - }, - { - "kind": "base", - "name": "null" - } - ] - }, - "messageDirection": "clientToServer", - "params": { - "kind": "reference", - "name": "DeleteFilesParams" - }, - "registrationOptions": { - "kind": "reference", - "name": "FileOperationRegistrationOptions" - }, - "documentation": "The did delete files notification is sent from the client to the server when\nfiles were deleted from within the client.\n\n@since 3.16.0", - "since": "3.16.0" - }, - { - "method": "textDocument/moniker", - "result": { - "kind": "or", - "items": [ - { - "kind": "array", - "element": { - "kind": "reference", - "name": "Moniker" - } - }, - { - "kind": "base", - "name": "null" - } - ] - }, - "messageDirection": "clientToServer", - "params": { - "kind": "reference", - "name": "MonikerParams" - }, - "partialResult": { - "kind": "array", - "element": { - "kind": "reference", - "name": "Moniker" - } - }, - "registrationOptions": { - "kind": "reference", - "name": "MonikerRegistrationOptions" - }, - "documentation": "A request to get the moniker of a symbol at a given text document position.\nThe request parameter is of type [TextDocumentPositionParams](#TextDocumentPositionParams).\nThe response is of type [Moniker[]](#Moniker[]) or `null`." - }, - { - "method": "textDocument/prepareTypeHierarchy", - "result": { - "kind": "or", - "items": [ - { - "kind": "array", - "element": { - "kind": "reference", - "name": "TypeHierarchyItem" - } - }, - { - "kind": "base", - "name": "null" - } - ] - }, - "messageDirection": "clientToServer", - "params": { - "kind": "reference", - "name": "TypeHierarchyPrepareParams" - }, - "registrationOptions": { - "kind": "reference", - "name": "TypeHierarchyRegistrationOptions" - }, - "documentation": "A request to result a `TypeHierarchyItem` in a document at a given position.\nCan be used as an input to a subtypes or supertypes type hierarchy.\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "method": "typeHierarchy/supertypes", - "result": { - "kind": "or", - "items": [ - { - "kind": "array", - "element": { - "kind": "reference", - "name": "TypeHierarchyItem" - } - }, - { - "kind": "base", - "name": "null" - } - ] - }, - "messageDirection": "clientToServer", - "params": { - "kind": "reference", - "name": "TypeHierarchySupertypesParams" - }, - "partialResult": { - "kind": "array", - "element": { - "kind": "reference", - "name": "TypeHierarchyItem" - } - }, - "documentation": "A request to resolve the supertypes for a given `TypeHierarchyItem`.\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "method": "typeHierarchy/subtypes", - "result": { - "kind": "or", - "items": [ - { - "kind": "array", - "element": { - "kind": "reference", - "name": "TypeHierarchyItem" - } - }, - { - "kind": "base", - "name": "null" - } - ] - }, - "messageDirection": "clientToServer", - "params": { - "kind": "reference", - "name": "TypeHierarchySubtypesParams" - }, - "partialResult": { - "kind": "array", - "element": { - "kind": "reference", - "name": "TypeHierarchyItem" - } - }, - "documentation": "A request to resolve the subtypes for a given `TypeHierarchyItem`.\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "method": "textDocument/inlineValue", - "result": { - "kind": "or", - "items": [ - { - "kind": "array", - "element": { - "kind": "reference", - "name": "InlineValue" - } - }, - { - "kind": "base", - "name": "null" - } - ] - }, - "messageDirection": "clientToServer", - "params": { - "kind": "reference", - "name": "InlineValueParams" - }, - "partialResult": { - "kind": "array", - "element": { - "kind": "reference", - "name": "InlineValue" - } - }, - "registrationOptions": { - "kind": "reference", - "name": "InlineValueRegistrationOptions" - }, - "documentation": "A request to provide inline values in a document. The request's parameter is of\ntype [InlineValueParams](#InlineValueParams), the response is of type\n[InlineValue[]](#InlineValue[]) or a Thenable that resolves to such.\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "method": "workspace/inlineValue/refresh", - "result": { - "kind": "base", - "name": "null" - }, - "messageDirection": "clientToServer", - "documentation": "@since 3.17.0", - "since": "3.17.0" - }, - { - "method": "textDocument/inlayHint", - "result": { - "kind": "or", - "items": [ - { - "kind": "array", - "element": { - "kind": "reference", - "name": "InlayHint" - } - }, - { - "kind": "base", - "name": "null" - } - ] - }, - "messageDirection": "clientToServer", - "params": { - "kind": "reference", - "name": "InlayHintParams" - }, - "partialResult": { - "kind": "array", - "element": { - "kind": "reference", - "name": "InlayHint" - } - }, - "registrationOptions": { - "kind": "reference", - "name": "InlayHintRegistrationOptions" - }, - "documentation": "A request to provide inlay hints in a document. The request's parameter is of\ntype [InlayHintsParams](#InlayHintsParams), the response is of type\n[InlayHint[]](#InlayHint[]) or a Thenable that resolves to such.\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "method": "inlayHint/resolve", - "result": { - "kind": "reference", - "name": "InlayHint" - }, - "messageDirection": "clientToServer", - "params": { - "kind": "reference", - "name": "InlayHint" - }, - "documentation": "A request to resolve additional properties for an inlay hint.\nThe request's parameter is of type [InlayHint](#InlayHint), the response is\nof type [InlayHint](#InlayHint) or a Thenable that resolves to such.\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "method": "workspace/inlayHint/refresh", - "result": { - "kind": "base", - "name": "null" - }, - "messageDirection": "clientToServer", - "documentation": "@since 3.17.0", - "since": "3.17.0" - }, - { - "method": "textDocument/diagnostic", - "result": { - "kind": "reference", - "name": "DocumentDiagnosticReport" - }, - "messageDirection": "clientToServer", - "params": { - "kind": "reference", - "name": "DocumentDiagnosticParams" - }, - "partialResult": { - "kind": "reference", - "name": "DocumentDiagnosticReportPartialResult" - }, - "errorData": { - "kind": "reference", - "name": "DiagnosticServerCancellationData" - }, - "registrationOptions": { - "kind": "reference", - "name": "DiagnosticRegistrationOptions" - }, - "documentation": "The document diagnostic request definition.\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "method": "workspace/diagnostic", - "result": { - "kind": "reference", - "name": "WorkspaceDiagnosticReport" - }, - "messageDirection": "clientToServer", - "params": { - "kind": "reference", - "name": "WorkspaceDiagnosticParams" - }, - "partialResult": { - "kind": "reference", - "name": "WorkspaceDiagnosticReportPartialResult" - }, - "errorData": { - "kind": "reference", - "name": "DiagnosticServerCancellationData" - }, - "documentation": "The workspace diagnostic request definition.\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "method": "workspace/diagnostic/refresh", - "result": { - "kind": "base", - "name": "null" - }, - "messageDirection": "clientToServer", - "documentation": "The diagnostic refresh request definition.\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "method": "client/registerCapability", - "result": { - "kind": "base", - "name": "null" - }, - "messageDirection": "serverToClient", - "params": { - "kind": "reference", - "name": "RegistrationParams" - }, - "documentation": "The `client/registerCapability` request is sent from the server to the client to register a new capability\nhandler on the client side." - }, - { - "method": "client/unregisterCapability", - "result": { - "kind": "base", - "name": "null" - }, - "messageDirection": "serverToClient", - "params": { - "kind": "reference", - "name": "UnregistrationParams" - }, - "documentation": "The `client/unregisterCapability` request is sent from the server to the client to unregister a previously registered capability\nhandler on the client side." - }, - { - "method": "initialize", - "result": { - "kind": "reference", - "name": "InitializeResult" - }, - "messageDirection": "clientToServer", - "params": { - "kind": "reference", - "name": "InitializeParams" - }, - "errorData": { - "kind": "reference", - "name": "InitializeError" - }, - "documentation": "The initialize request is sent from the client to the server.\nIt is sent once as the request after starting up the server.\nThe requests parameter is of type [InitializeParams](#InitializeParams)\nthe response if of type [InitializeResult](#InitializeResult) of a Thenable that\nresolves to such." - }, - { - "method": "shutdown", - "result": { - "kind": "base", - "name": "null" - }, - "messageDirection": "clientToServer", - "documentation": "A shutdown request is sent from the client to the server.\nIt is sent once when the client decides to shutdown the\nserver. The only notification that is sent after a shutdown request\nis the exit event." - }, - { - "method": "window/showMessageRequest", - "result": { - "kind": "or", - "items": [ - { - "kind": "reference", - "name": "MessageActionItem" - }, - { - "kind": "base", - "name": "null" - } - ] - }, - "messageDirection": "serverToClient", - "params": { - "kind": "reference", - "name": "ShowMessageRequestParams" - }, - "documentation": "The show message request is sent from the server to the client to show a message\nand a set of options actions to the user." - }, - { - "method": "textDocument/willSaveWaitUntil", - "result": { - "kind": "or", - "items": [ - { - "kind": "array", - "element": { - "kind": "reference", - "name": "TextEdit" - } - }, - { - "kind": "base", - "name": "null" - } - ] - }, - "messageDirection": "clientToServer", - "params": { - "kind": "reference", - "name": "WillSaveTextDocumentParams" - }, - "registrationOptions": { - "kind": "reference", - "name": "TextDocumentRegistrationOptions" - }, - "documentation": "A document will save request is sent from the client to the server before\nthe document is actually saved. The request can return an array of TextEdits\nwhich will be applied to the text document before it is saved. Please note that\nclients might drop results if computing the text edits took too long or if a\nserver constantly fails on this request. This is done to keep the save fast and\nreliable." - }, - { - "method": "textDocument/completion", - "result": { - "kind": "or", - "items": [ - { - "kind": "array", - "element": { - "kind": "reference", - "name": "CompletionItem" - } - }, - { - "kind": "reference", - "name": "CompletionList" - }, - { - "kind": "base", - "name": "null" - } - ] - }, - "messageDirection": "clientToServer", - "params": { - "kind": "reference", - "name": "CompletionParams" - }, - "partialResult": { - "kind": "array", - "element": { - "kind": "reference", - "name": "CompletionItem" - } - }, - "registrationOptions": { - "kind": "reference", - "name": "CompletionRegistrationOptions" - }, - "documentation": "Request to request completion at a given text document position. The request's\nparameter is of type [TextDocumentPosition](#TextDocumentPosition) the response\nis of type [CompletionItem[]](#CompletionItem) or [CompletionList](#CompletionList)\nor a Thenable that resolves to such.\n\nThe request can delay the computation of the [`detail`](#CompletionItem.detail)\nand [`documentation`](#CompletionItem.documentation) properties to the `completionItem/resolve`\nrequest. However, properties that are needed for the initial sorting and filtering, like `sortText`,\n`filterText`, `insertText`, and `textEdit`, must not be changed during resolve." - }, - { - "method": "completionItem/resolve", - "result": { - "kind": "reference", - "name": "CompletionItem" - }, - "messageDirection": "clientToServer", - "params": { - "kind": "reference", - "name": "CompletionItem" - }, - "documentation": "Request to resolve additional information for a given completion item.The request's\nparameter is of type [CompletionItem](#CompletionItem) the response\nis of type [CompletionItem](#CompletionItem) or a Thenable that resolves to such." - }, - { - "method": "textDocument/hover", - "result": { - "kind": "or", - "items": [ - { - "kind": "reference", - "name": "Hover" - }, - { - "kind": "base", - "name": "null" - } - ] - }, - "messageDirection": "clientToServer", - "params": { - "kind": "reference", - "name": "HoverParams" - }, - "registrationOptions": { - "kind": "reference", - "name": "HoverRegistrationOptions" - }, - "documentation": "Request to request hover information at a given text document position. The request's\nparameter is of type [TextDocumentPosition](#TextDocumentPosition) the response is of\ntype [Hover](#Hover) or a Thenable that resolves to such." - }, - { - "method": "textDocument/signatureHelp", - "result": { - "kind": "or", - "items": [ - { - "kind": "reference", - "name": "SignatureHelp" - }, - { - "kind": "base", - "name": "null" - } - ] - }, - "messageDirection": "clientToServer", - "params": { - "kind": "reference", - "name": "SignatureHelpParams" - }, - "registrationOptions": { - "kind": "reference", - "name": "SignatureHelpRegistrationOptions" - } - }, - { - "method": "textDocument/definition", - "result": { - "kind": "or", - "items": [ - { - "kind": "reference", - "name": "Definition" - }, - { - "kind": "array", - "element": { - "kind": "reference", - "name": "DefinitionLink" - } - }, - { - "kind": "base", - "name": "null" - } - ] - }, - "messageDirection": "clientToServer", - "params": { - "kind": "reference", - "name": "DefinitionParams" - }, - "partialResult": { - "kind": "or", - "items": [ - { - "kind": "array", - "element": { - "kind": "reference", - "name": "Location" - } - }, - { - "kind": "array", - "element": { - "kind": "reference", - "name": "DefinitionLink" - } - } - ] - }, - "registrationOptions": { - "kind": "reference", - "name": "DefinitionRegistrationOptions" - }, - "documentation": "A request to resolve the definition location of a symbol at a given text\ndocument position. The request's parameter is of type [TextDocumentPosition]\n(#TextDocumentPosition) the response is of either type [Definition](#Definition)\nor a typed array of [DefinitionLink](#DefinitionLink) or a Thenable that resolves\nto such." - }, - { - "method": "textDocument/references", - "result": { - "kind": "or", - "items": [ - { - "kind": "array", - "element": { - "kind": "reference", - "name": "Location" - } - }, - { - "kind": "base", - "name": "null" - } - ] - }, - "messageDirection": "clientToServer", - "params": { - "kind": "reference", - "name": "ReferenceParams" - }, - "partialResult": { - "kind": "array", - "element": { - "kind": "reference", - "name": "Location" - } - }, - "registrationOptions": { - "kind": "reference", - "name": "ReferenceRegistrationOptions" - }, - "documentation": "A request to resolve project-wide references for the symbol denoted\nby the given text document position. The request's parameter is of\ntype [ReferenceParams](#ReferenceParams) the response is of type\n[Location[]](#Location) or a Thenable that resolves to such." - }, - { - "method": "textDocument/documentHighlight", - "result": { - "kind": "or", - "items": [ - { - "kind": "array", - "element": { - "kind": "reference", - "name": "DocumentHighlight" - } - }, - { - "kind": "base", - "name": "null" - } - ] - }, - "messageDirection": "clientToServer", - "params": { - "kind": "reference", - "name": "DocumentHighlightParams" - }, - "partialResult": { - "kind": "array", - "element": { - "kind": "reference", - "name": "DocumentHighlight" - } - }, - "registrationOptions": { - "kind": "reference", - "name": "DocumentHighlightRegistrationOptions" - }, - "documentation": "Request to resolve a [DocumentHighlight](#DocumentHighlight) for a given\ntext document position. The request's parameter is of type [TextDocumentPosition]\n(#TextDocumentPosition) the request response is of type [DocumentHighlight[]]\n(#DocumentHighlight) or a Thenable that resolves to such." - }, - { - "method": "textDocument/documentSymbol", - "result": { - "kind": "or", - "items": [ - { - "kind": "array", - "element": { - "kind": "reference", - "name": "SymbolInformation" - } - }, - { - "kind": "array", - "element": { - "kind": "reference", - "name": "DocumentSymbol" - } - }, - { - "kind": "base", - "name": "null" - } - ] - }, - "messageDirection": "clientToServer", - "params": { - "kind": "reference", - "name": "DocumentSymbolParams" - }, - "partialResult": { - "kind": "or", - "items": [ - { - "kind": "array", - "element": { - "kind": "reference", - "name": "SymbolInformation" - } - }, - { - "kind": "array", - "element": { - "kind": "reference", - "name": "DocumentSymbol" - } - } - ] - }, - "registrationOptions": { - "kind": "reference", - "name": "DocumentSymbolRegistrationOptions" - }, - "documentation": "A request to list all symbols found in a given text document. The request's\nparameter is of type [TextDocumentIdentifier](#TextDocumentIdentifier) the\nresponse is of type [SymbolInformation[]](#SymbolInformation) or a Thenable\nthat resolves to such." - }, - { - "method": "textDocument/codeAction", - "result": { - "kind": "or", - "items": [ - { - "kind": "array", - "element": { - "kind": "or", - "items": [ - { - "kind": "reference", - "name": "Command" - }, - { - "kind": "reference", - "name": "CodeAction" - } - ] - } - }, - { - "kind": "base", - "name": "null" - } - ] - }, - "messageDirection": "clientToServer", - "params": { - "kind": "reference", - "name": "CodeActionParams" - }, - "partialResult": { - "kind": "array", - "element": { - "kind": "or", - "items": [ - { - "kind": "reference", - "name": "Command" - }, - { - "kind": "reference", - "name": "CodeAction" - } - ] - } - }, - "registrationOptions": { - "kind": "reference", - "name": "CodeActionRegistrationOptions" - }, - "documentation": "A request to provide commands for the given text document and range." - }, - { - "method": "codeAction/resolve", - "result": { - "kind": "reference", - "name": "CodeAction" - }, - "messageDirection": "clientToServer", - "params": { - "kind": "reference", - "name": "CodeAction" - }, - "documentation": "Request to resolve additional information for a given code action.The request's\nparameter is of type [CodeAction](#CodeAction) the response\nis of type [CodeAction](#CodeAction) or a Thenable that resolves to such." - }, - { - "method": "workspace/symbol", - "result": { - "kind": "or", - "items": [ - { - "kind": "array", - "element": { - "kind": "reference", - "name": "SymbolInformation" - } - }, - { - "kind": "array", - "element": { - "kind": "reference", - "name": "WorkspaceSymbol" - } - }, - { - "kind": "base", - "name": "null" - } - ] - }, - "messageDirection": "clientToServer", - "params": { - "kind": "reference", - "name": "WorkspaceSymbolParams" - }, - "partialResult": { - "kind": "or", - "items": [ - { - "kind": "array", - "element": { - "kind": "reference", - "name": "SymbolInformation" - } - }, - { - "kind": "array", - "element": { - "kind": "reference", - "name": "WorkspaceSymbol" - } - } - ] - }, - "registrationOptions": { - "kind": "reference", - "name": "WorkspaceSymbolRegistrationOptions" - }, - "documentation": "A request to list project-wide symbols matching the query string given\nby the [WorkspaceSymbolParams](#WorkspaceSymbolParams). The response is\nof type [SymbolInformation[]](#SymbolInformation) or a Thenable that\nresolves to such.\n\n@since 3.17.0 - support for WorkspaceSymbol in the returned data. Clients\n need to advertise support for WorkspaceSymbols via the client capability\n `workspace.symbol.resolveSupport`.\n", - "since": "3.17.0 - support for WorkspaceSymbol in the returned data. Clients\nneed to advertise support for WorkspaceSymbols via the client capability\n`workspace.symbol.resolveSupport`." - }, - { - "method": "workspaceSymbol/resolve", - "result": { - "kind": "reference", - "name": "WorkspaceSymbol" - }, - "messageDirection": "clientToServer", - "params": { - "kind": "reference", - "name": "WorkspaceSymbol" - }, - "documentation": "A request to resolve the range inside the workspace\nsymbol's location.\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "method": "textDocument/codeLens", - "result": { - "kind": "or", - "items": [ - { - "kind": "array", - "element": { - "kind": "reference", - "name": "CodeLens" - } - }, - { - "kind": "base", - "name": "null" - } - ] - }, - "messageDirection": "clientToServer", - "params": { - "kind": "reference", - "name": "CodeLensParams" - }, - "partialResult": { - "kind": "array", - "element": { - "kind": "reference", - "name": "CodeLens" - } - }, - "registrationOptions": { - "kind": "reference", - "name": "CodeLensRegistrationOptions" - }, - "documentation": "A request to provide code lens for the given text document." - }, - { - "method": "codeLens/resolve", - "result": { - "kind": "reference", - "name": "CodeLens" - }, - "messageDirection": "clientToServer", - "params": { - "kind": "reference", - "name": "CodeLens" - }, - "documentation": "A request to resolve a command for a given code lens." - }, - { - "method": "workspace/codeLens/refresh", - "result": { - "kind": "base", - "name": "null" - }, - "messageDirection": "serverToClient", - "documentation": "A request to refresh all code actions\n\n@since 3.16.0", - "since": "3.16.0" - }, - { - "method": "textDocument/documentLink", - "result": { - "kind": "or", - "items": [ - { - "kind": "array", - "element": { - "kind": "reference", - "name": "DocumentLink" - } - }, - { - "kind": "base", - "name": "null" - } - ] - }, - "messageDirection": "clientToServer", - "params": { - "kind": "reference", - "name": "DocumentLinkParams" - }, - "partialResult": { - "kind": "array", - "element": { - "kind": "reference", - "name": "DocumentLink" - } - }, - "registrationOptions": { - "kind": "reference", - "name": "DocumentLinkRegistrationOptions" - }, - "documentation": "A request to provide document links" - }, - { - "method": "documentLink/resolve", - "result": { - "kind": "reference", - "name": "DocumentLink" - }, - "messageDirection": "clientToServer", - "params": { - "kind": "reference", - "name": "DocumentLink" - }, - "documentation": "Request to resolve additional information for a given document link. The request's\nparameter is of type [DocumentLink](#DocumentLink) the response\nis of type [DocumentLink](#DocumentLink) or a Thenable that resolves to such." - }, - { - "method": "textDocument/formatting", - "result": { - "kind": "or", - "items": [ - { - "kind": "array", - "element": { - "kind": "reference", - "name": "TextEdit" - } - }, - { - "kind": "base", - "name": "null" - } - ] - }, - "messageDirection": "clientToServer", - "params": { - "kind": "reference", - "name": "DocumentFormattingParams" - }, - "registrationOptions": { - "kind": "reference", - "name": "DocumentFormattingRegistrationOptions" - }, - "documentation": "A request to to format a whole document." - }, - { - "method": "textDocument/rangeFormatting", - "result": { - "kind": "or", - "items": [ - { - "kind": "array", - "element": { - "kind": "reference", - "name": "TextEdit" - } - }, - { - "kind": "base", - "name": "null" - } - ] - }, - "messageDirection": "clientToServer", - "params": { - "kind": "reference", - "name": "DocumentRangeFormattingParams" - }, - "registrationOptions": { - "kind": "reference", - "name": "DocumentRangeFormattingRegistrationOptions" - }, - "documentation": "A request to to format a range in a document." - }, - { - "method": "textDocument/onTypeFormatting", - "result": { - "kind": "or", - "items": [ - { - "kind": "array", - "element": { - "kind": "reference", - "name": "TextEdit" - } - }, - { - "kind": "base", - "name": "null" - } - ] - }, - "messageDirection": "clientToServer", - "params": { - "kind": "reference", - "name": "DocumentOnTypeFormattingParams" - }, - "registrationOptions": { - "kind": "reference", - "name": "DocumentOnTypeFormattingRegistrationOptions" - }, - "documentation": "A request to format a document on type." - }, - { - "method": "textDocument/rename", - "result": { - "kind": "or", - "items": [ - { - "kind": "reference", - "name": "WorkspaceEdit" - }, - { - "kind": "base", - "name": "null" - } - ] - }, - "messageDirection": "clientToServer", - "params": { - "kind": "reference", - "name": "RenameParams" - }, - "registrationOptions": { - "kind": "reference", - "name": "RenameRegistrationOptions" - }, - "documentation": "A request to rename a symbol." - }, - { - "method": "textDocument/prepareRename", - "result": { - "kind": "or", - "items": [ - { - "kind": "reference", - "name": "PrepareRenameResult" - }, - { - "kind": "base", - "name": "null" - } - ] - }, - "messageDirection": "clientToServer", - "params": { - "kind": "reference", - "name": "PrepareRenameParams" - }, - "documentation": "A request to test and perform the setup necessary for a rename.\n\n@since 3.16 - support for default behavior", - "since": "3.16 - support for default behavior" - }, - { - "method": "workspace/executeCommand", - "result": { - "kind": "or", - "items": [ - { - "kind": "reference", - "name": "LSPAny" - }, - { - "kind": "base", - "name": "null" - } - ] - }, - "messageDirection": "clientToServer", - "params": { - "kind": "reference", - "name": "ExecuteCommandParams" - }, - "registrationOptions": { - "kind": "reference", - "name": "ExecuteCommandRegistrationOptions" - }, - "documentation": "A request send from the client to the server to execute a command. The request might return\na workspace edit which the client will apply to the workspace." - }, - { - "method": "workspace/applyEdit", - "result": { - "kind": "reference", - "name": "ApplyWorkspaceEditResult" - }, - "messageDirection": "serverToClient", - "params": { - "kind": "reference", - "name": "ApplyWorkspaceEditParams" - }, - "documentation": "A request sent from the server to the client to modified certain resources." - } - ], - "notifications": [ - { - "method": "workspace/didChangeWorkspaceFolders", - "messageDirection": "clientToServer", - "params": { - "kind": "reference", - "name": "DidChangeWorkspaceFoldersParams" - }, - "documentation": "The `workspace/didChangeWorkspaceFolders` notification is sent from the client to the server when the workspace\nfolder configuration changes." - }, - { - "method": "window/workDoneProgress/cancel", - "messageDirection": "clientToServer", - "params": { - "kind": "reference", - "name": "WorkDoneProgressCancelParams" - }, - "documentation": "The `window/workDoneProgress/cancel` notification is sent from the client to the server to cancel a progress\ninitiated on the server side." - }, - { - "method": "workspace/didCreateFiles", - "messageDirection": "clientToServer", - "params": { - "kind": "reference", - "name": "CreateFilesParams" - }, - "registrationOptions": { - "kind": "reference", - "name": "FileOperationRegistrationOptions" - }, - "documentation": "The did create files notification is sent from the client to the server when\nfiles were created from within the client.\n\n@since 3.16.0", - "since": "3.16.0" - }, - { - "method": "workspace/didRenameFiles", - "messageDirection": "clientToServer", - "params": { - "kind": "reference", - "name": "RenameFilesParams" - }, - "registrationOptions": { - "kind": "reference", - "name": "FileOperationRegistrationOptions" - }, - "documentation": "The did rename files notification is sent from the client to the server when\nfiles were renamed from within the client.\n\n@since 3.16.0", - "since": "3.16.0" - }, - { - "method": "workspace/didDeleteFiles", - "messageDirection": "clientToServer", - "params": { - "kind": "reference", - "name": "DeleteFilesParams" - }, - "registrationOptions": { - "kind": "reference", - "name": "FileOperationRegistrationOptions" - }, - "documentation": "The will delete files request is sent from the client to the server before files are actually\ndeleted as long as the deletion is triggered from within the client.\n\n@since 3.16.0", - "since": "3.16.0" - }, - { - "method": "notebookDocument/didOpen", - "messageDirection": "clientToServer", - "params": { - "kind": "reference", - "name": "DidOpenNotebookDocumentParams" - }, - "registrationMethod": "notebookDocument/sync", - "documentation": "A notification sent when a notebook opens.\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "method": "notebookDocument/didChange", - "messageDirection": "clientToServer", - "params": { - "kind": "reference", - "name": "DidChangeNotebookDocumentParams" - }, - "registrationMethod": "notebookDocument/sync" - }, - { - "method": "notebookDocument/didSave", - "messageDirection": "clientToServer", - "params": { - "kind": "reference", - "name": "DidSaveNotebookDocumentParams" - }, - "registrationMethod": "notebookDocument/sync", - "documentation": "A notification sent when a notebook document is saved.\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "method": "notebookDocument/didClose", - "messageDirection": "clientToServer", - "params": { - "kind": "reference", - "name": "DidCloseNotebookDocumentParams" - }, - "registrationMethod": "notebookDocument/sync", - "documentation": "A notification sent when a notebook closes.\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "method": "initialized", - "messageDirection": "clientToServer", - "params": { - "kind": "reference", - "name": "InitializedParams" - }, - "documentation": "The initialized notification is sent from the client to the\nserver after the client is fully initialized and the server\nis allowed to send requests from the server to the client." - }, - { - "method": "exit", - "messageDirection": "clientToServer", - "documentation": "The exit event is sent from the client to the server to\nask the server to exit its process." - }, - { - "method": "workspace/didChangeConfiguration", - "messageDirection": "clientToServer", - "params": { - "kind": "reference", - "name": "DidChangeConfigurationParams" - }, - "registrationOptions": { - "kind": "reference", - "name": "DidChangeConfigurationRegistrationOptions" - }, - "documentation": "The configuration change notification is sent from the client to the server\nwhen the client's configuration has changed. The notification contains\nthe changed configuration as defined by the language client." - }, - { - "method": "window/showMessage", - "messageDirection": "serverToClient", - "params": { - "kind": "reference", - "name": "ShowMessageParams" - }, - "documentation": "The show message notification is sent from a server to a client to ask\nthe client to display a particular message in the user interface." - }, - { - "method": "window/logMessage", - "messageDirection": "serverToClient", - "params": { - "kind": "reference", - "name": "LogMessageParams" - }, - "documentation": "The log message notification is sent from the server to the client to ask\nthe client to log a particular message." - }, - { - "method": "telemetry/event", - "messageDirection": "serverToClient", - "params": { - "kind": "reference", - "name": "LSPAny" - }, - "documentation": "The telemetry event notification is sent from the server to the client to ask\nthe client to log telemetry data." - }, - { - "method": "textDocument/didOpen", - "messageDirection": "clientToServer", - "params": { - "kind": "reference", - "name": "DidOpenTextDocumentParams" - }, - "registrationOptions": { - "kind": "reference", - "name": "TextDocumentRegistrationOptions" - }, - "documentation": "The document open notification is sent from the client to the server to signal\nnewly opened text documents. The document's truth is now managed by the client\nand the server must not try to read the document's truth using the document's\nuri. Open in this sense means it is managed by the client. It doesn't necessarily\nmean that its content is presented in an editor. An open notification must not\nbe sent more than once without a corresponding close notification send before.\nThis means open and close notification must be balanced and the max open count\nis one." - }, - { - "method": "textDocument/didChange", - "messageDirection": "clientToServer", - "params": { - "kind": "reference", - "name": "DidChangeTextDocumentParams" - }, - "registrationOptions": { - "kind": "reference", - "name": "TextDocumentChangeRegistrationOptions" - }, - "documentation": "The document change notification is sent from the client to the server to signal\nchanges to a text document." - }, - { - "method": "textDocument/didClose", - "messageDirection": "clientToServer", - "params": { - "kind": "reference", - "name": "DidCloseTextDocumentParams" - }, - "registrationOptions": { - "kind": "reference", - "name": "TextDocumentRegistrationOptions" - }, - "documentation": "The document close notification is sent from the client to the server when\nthe document got closed in the client. The document's truth now exists where\nthe document's uri points to (e.g. if the document's uri is a file uri the\ntruth now exists on disk). As with the open notification the close notification\nis about managing the document's content. Receiving a close notification\ndoesn't mean that the document was open in an editor before. A close\nnotification requires a previous open notification to be sent." - }, - { - "method": "textDocument/didSave", - "messageDirection": "clientToServer", - "params": { - "kind": "reference", - "name": "DidSaveTextDocumentParams" - }, - "registrationOptions": { - "kind": "reference", - "name": "TextDocumentSaveRegistrationOptions" - }, - "documentation": "The document save notification is sent from the client to the server when\nthe document got saved in the client." - }, - { - "method": "textDocument/willSave", - "messageDirection": "clientToServer", - "params": { - "kind": "reference", - "name": "WillSaveTextDocumentParams" - }, - "registrationOptions": { - "kind": "reference", - "name": "TextDocumentRegistrationOptions" - }, - "documentation": "A document will save notification is sent from the client to the server before\nthe document is actually saved." - }, - { - "method": "workspace/didChangeWatchedFiles", - "messageDirection": "clientToServer", - "params": { - "kind": "reference", - "name": "DidChangeWatchedFilesParams" - }, - "registrationOptions": { - "kind": "reference", - "name": "DidChangeWatchedFilesRegistrationOptions" - }, - "documentation": "The watched files notification is sent from the client to the server when\nthe client detects changes to file watched by the language client." - }, - { - "method": "textDocument/publishDiagnostics", - "messageDirection": "serverToClient", - "params": { - "kind": "reference", - "name": "PublishDiagnosticsParams" - }, - "documentation": "Diagnostics notification are sent from the server to the client to signal\nresults of validation runs." - }, - { - "method": "$/setTrace", - "messageDirection": "clientToServer", - "params": { - "kind": "reference", - "name": "SetTraceParams" - } - }, - { - "method": "$/logTrace", - "messageDirection": "serverToClient", - "params": { - "kind": "reference", - "name": "LogTraceParams" - } - }, - { - "method": "$/cancelRequest", - "messageDirection": "both", - "params": { - "kind": "reference", - "name": "CancelParams" - } - }, - { - "method": "$/progress", - "messageDirection": "both", - "params": { - "kind": "reference", - "name": "ProgressParams" - } - } - ], - "structures": [ - { - "name": "ImplementationParams", - "properties": [], - "extends": [ - { - "kind": "reference", - "name": "TextDocumentPositionParams" - } - ], - "mixins": [ - { - "kind": "reference", - "name": "WorkDoneProgressParams" - }, - { - "kind": "reference", - "name": "PartialResultParams" - } - ] - }, - { - "name": "Location", - "properties": [ - { - "name": "uri", - "type": { - "kind": "base", - "name": "DocumentUri" - } - }, - { - "name": "range", - "type": { - "kind": "reference", - "name": "Range" - } - } - ], - "documentation": "Represents a location inside a resource, such as a line\ninside a text file." - }, - { - "name": "ImplementationRegistrationOptions", - "properties": [], - "extends": [ - { - "kind": "reference", - "name": "TextDocumentRegistrationOptions" - }, - { - "kind": "reference", - "name": "ImplementationOptions" - } - ], - "mixins": [ - { - "kind": "reference", - "name": "StaticRegistrationOptions" - } - ] - }, - { - "name": "TypeDefinitionParams", - "properties": [], - "extends": [ - { - "kind": "reference", - "name": "TextDocumentPositionParams" - } - ], - "mixins": [ - { - "kind": "reference", - "name": "WorkDoneProgressParams" - }, - { - "kind": "reference", - "name": "PartialResultParams" - } - ] - }, - { - "name": "TypeDefinitionRegistrationOptions", - "properties": [], - "extends": [ - { - "kind": "reference", - "name": "TextDocumentRegistrationOptions" - }, - { - "kind": "reference", - "name": "TypeDefinitionOptions" - } - ], - "mixins": [ - { - "kind": "reference", - "name": "StaticRegistrationOptions" - } - ] - }, - { - "name": "WorkspaceFolder", - "properties": [ - { - "name": "uri", - "type": { - "kind": "base", - "name": "URI" - }, - "documentation": "The associated URI for this workspace folder." - }, - { - "name": "name", - "type": { - "kind": "base", - "name": "string" - }, - "documentation": "The name of the workspace folder. Used to refer to this\nworkspace folder in the user interface." - } - ], - "documentation": "A workspace folder inside a client." - }, - { - "name": "DidChangeWorkspaceFoldersParams", - "properties": [ - { - "name": "event", - "type": { - "kind": "reference", - "name": "WorkspaceFoldersChangeEvent" - }, - "documentation": "The actual workspace folder change event." - } - ], - "documentation": "The parameters of a `workspace/didChangeWorkspaceFolders` notification." - }, - { - "name": "ConfigurationParams", - "properties": [ - { - "name": "items", - "type": { - "kind": "array", - "element": { - "kind": "reference", - "name": "ConfigurationItem" - } - } - } - ], - "documentation": "The parameters of a configuration request." - }, - { - "name": "PartialResultParams", - "properties": [ - { - "name": "partialResultToken", - "type": { - "kind": "reference", - "name": "ProgressToken" - }, - "optional": true, - "documentation": "An optional token that a server can use to report partial results (e.g. streaming) to\nthe client." - } - ] - }, - { - "name": "DocumentColorParams", - "properties": [ - { - "name": "textDocument", - "type": { - "kind": "reference", - "name": "TextDocumentIdentifier" - }, - "documentation": "The text document." - } - ], - "mixins": [ - { - "kind": "reference", - "name": "WorkDoneProgressParams" - }, - { - "kind": "reference", - "name": "PartialResultParams" - } - ], - "documentation": "Parameters for a [DocumentColorRequest](#DocumentColorRequest)." - }, - { - "name": "ColorInformation", - "properties": [ - { - "name": "range", - "type": { - "kind": "reference", - "name": "Range" - }, - "documentation": "The range in the document where this color appears." - }, - { - "name": "color", - "type": { - "kind": "reference", - "name": "Color" - }, - "documentation": "The actual color value for this color range." - } - ], - "documentation": "Represents a color range from a document." - }, - { - "name": "DocumentColorRegistrationOptions", - "properties": [], - "extends": [ - { - "kind": "reference", - "name": "TextDocumentRegistrationOptions" - }, - { - "kind": "reference", - "name": "DocumentColorOptions" - } - ], - "mixins": [ - { - "kind": "reference", - "name": "StaticRegistrationOptions" - } - ] - }, - { - "name": "ColorPresentationParams", - "properties": [ - { - "name": "textDocument", - "type": { - "kind": "reference", - "name": "TextDocumentIdentifier" - }, - "documentation": "The text document." - }, - { - "name": "color", - "type": { - "kind": "reference", - "name": "Color" - }, - "documentation": "The color to request presentations for." - }, - { - "name": "range", - "type": { - "kind": "reference", - "name": "Range" - }, - "documentation": "The range where the color would be inserted. Serves as a context." - } - ], - "mixins": [ - { - "kind": "reference", - "name": "WorkDoneProgressParams" - }, - { - "kind": "reference", - "name": "PartialResultParams" - } - ], - "documentation": "Parameters for a [ColorPresentationRequest](#ColorPresentationRequest)." - }, - { - "name": "ColorPresentation", - "properties": [ - { - "name": "label", - "type": { - "kind": "base", - "name": "string" - }, - "documentation": "The label of this color presentation. It will be shown on the color\npicker header. By default this is also the text that is inserted when selecting\nthis color presentation." - }, - { - "name": "textEdit", - "type": { - "kind": "reference", - "name": "TextEdit" - }, - "optional": true, - "documentation": "An [edit](#TextEdit) which is applied to a document when selecting\nthis presentation for the color. When `falsy` the [label](#ColorPresentation.label)\nis used." - }, - { - "name": "additionalTextEdits", - "type": { - "kind": "array", - "element": { - "kind": "reference", - "name": "TextEdit" - } - }, - "optional": true, - "documentation": "An optional array of additional [text edits](#TextEdit) that are applied when\nselecting this color presentation. Edits must not overlap with the main [edit](#ColorPresentation.textEdit) nor with themselves." - } - ] - }, - { - "name": "WorkDoneProgressOptions", - "properties": [ - { - "name": "workDoneProgress", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true - } - ] - }, - { - "name": "TextDocumentRegistrationOptions", - "properties": [ - { - "name": "documentSelector", - "type": { - "kind": "or", - "items": [ - { - "kind": "reference", - "name": "DocumentSelector" - }, - { - "kind": "base", - "name": "null" - } - ] - }, - "documentation": "A document selector to identify the scope of the registration. If set to null\nthe document selector provided on the client side will be used." - } - ], - "documentation": "General text document registration options." - }, - { - "name": "FoldingRangeParams", - "properties": [ - { - "name": "textDocument", - "type": { - "kind": "reference", - "name": "TextDocumentIdentifier" - }, - "documentation": "The text document." - } - ], - "mixins": [ - { - "kind": "reference", - "name": "WorkDoneProgressParams" - }, - { - "kind": "reference", - "name": "PartialResultParams" - } - ], - "documentation": "Parameters for a [FoldingRangeRequest](#FoldingRangeRequest)." - }, - { - "name": "FoldingRange", - "properties": [ - { - "name": "startLine", - "type": { - "kind": "base", - "name": "uinteger" - }, - "documentation": "The zero-based start line of the range to fold. The folded area starts after the line's last character.\nTo be valid, the end must be zero or larger and smaller than the number of lines in the document." - }, - { - "name": "startCharacter", - "type": { - "kind": "base", - "name": "uinteger" - }, - "optional": true, - "documentation": "The zero-based character offset from where the folded range starts. If not defined, defaults to the length of the start line." - }, - { - "name": "endLine", - "type": { - "kind": "base", - "name": "uinteger" - }, - "documentation": "The zero-based end line of the range to fold. The folded area ends with the line's last character.\nTo be valid, the end must be zero or larger and smaller than the number of lines in the document." - }, - { - "name": "endCharacter", - "type": { - "kind": "base", - "name": "uinteger" - }, - "optional": true, - "documentation": "The zero-based character offset before the folded range ends. If not defined, defaults to the length of the end line." - }, - { - "name": "kind", - "type": { - "kind": "reference", - "name": "FoldingRangeKind" - }, - "optional": true, - "documentation": "Describes the kind of the folding range such as `comment' or 'region'. The kind\nis used to categorize folding ranges and used by commands like 'Fold all comments'.\nSee [FoldingRangeKind](#FoldingRangeKind) for an enumeration of standardized kinds." - }, - { - "name": "collapsedText", - "type": { - "kind": "base", - "name": "string" - }, - "optional": true, - "documentation": "The text that the client should show when the specified range is\ncollapsed. If not defined or not supported by the client, a default\nwill be chosen by the client.\n\n@since 3.17.0", - "since": "3.17.0" - } - ], - "documentation": "Represents a folding range. To be valid, start and end line must be bigger than zero and smaller\nthan the number of lines in the document. Clients are free to ignore invalid ranges." - }, - { - "name": "FoldingRangeRegistrationOptions", - "properties": [], - "extends": [ - { - "kind": "reference", - "name": "TextDocumentRegistrationOptions" - }, - { - "kind": "reference", - "name": "FoldingRangeOptions" - } - ], - "mixins": [ - { - "kind": "reference", - "name": "StaticRegistrationOptions" - } - ] - }, - { - "name": "DeclarationParams", - "properties": [], - "extends": [ - { - "kind": "reference", - "name": "TextDocumentPositionParams" - } - ], - "mixins": [ - { - "kind": "reference", - "name": "WorkDoneProgressParams" - }, - { - "kind": "reference", - "name": "PartialResultParams" - } - ] - }, - { - "name": "DeclarationRegistrationOptions", - "properties": [], - "extends": [ - { - "kind": "reference", - "name": "DeclarationOptions" - }, - { - "kind": "reference", - "name": "TextDocumentRegistrationOptions" - } - ], - "mixins": [ - { - "kind": "reference", - "name": "StaticRegistrationOptions" - } - ] - }, - { - "name": "SelectionRangeParams", - "properties": [ - { - "name": "textDocument", - "type": { - "kind": "reference", - "name": "TextDocumentIdentifier" - }, - "documentation": "The text document." - }, - { - "name": "positions", - "type": { - "kind": "array", - "element": { - "kind": "reference", - "name": "Position" - } - }, - "documentation": "The positions inside the text document." - } - ], - "mixins": [ - { - "kind": "reference", - "name": "WorkDoneProgressParams" - }, - { - "kind": "reference", - "name": "PartialResultParams" - } - ], - "documentation": "A parameter literal used in selection range requests." - }, - { - "name": "SelectionRange", - "properties": [ - { - "name": "range", - "type": { - "kind": "reference", - "name": "Range" - }, - "documentation": "The [range](#Range) of this selection range." - }, - { - "name": "parent", - "type": { - "kind": "reference", - "name": "SelectionRange" - }, - "optional": true, - "documentation": "The parent selection range containing this range. Therefore `parent.range` must contain `this.range`." - } - ], - "documentation": "A selection range represents a part of a selection hierarchy. A selection range\nmay have a parent selection range that contains it." - }, - { - "name": "SelectionRangeRegistrationOptions", - "properties": [], - "extends": [ - { - "kind": "reference", - "name": "SelectionRangeOptions" - }, - { - "kind": "reference", - "name": "TextDocumentRegistrationOptions" - } - ], - "mixins": [ - { - "kind": "reference", - "name": "StaticRegistrationOptions" - } - ] - }, - { - "name": "WorkDoneProgressCreateParams", - "properties": [ - { - "name": "token", - "type": { - "kind": "reference", - "name": "ProgressToken" - }, - "documentation": "The token to be used to report progress." - } - ] - }, - { - "name": "WorkDoneProgressCancelParams", - "properties": [ - { - "name": "token", - "type": { - "kind": "reference", - "name": "ProgressToken" - }, - "documentation": "The token to be used to report progress." - } - ] - }, - { - "name": "CallHierarchyPrepareParams", - "properties": [], - "extends": [ - { - "kind": "reference", - "name": "TextDocumentPositionParams" - } - ], - "mixins": [ - { - "kind": "reference", - "name": "WorkDoneProgressParams" - } - ], - "documentation": "The parameter of a `textDocument/prepareCallHierarchy` request.\n\n@since 3.16.0", - "since": "3.16.0" - }, - { - "name": "CallHierarchyItem", - "properties": [ - { - "name": "name", - "type": { - "kind": "base", - "name": "string" - }, - "documentation": "The name of this item." - }, - { - "name": "kind", - "type": { - "kind": "reference", - "name": "SymbolKind" - }, - "documentation": "The kind of this item." - }, - { - "name": "tags", - "type": { - "kind": "array", - "element": { - "kind": "reference", - "name": "SymbolTag" - } - }, - "optional": true, - "documentation": "Tags for this item." - }, - { - "name": "detail", - "type": { - "kind": "base", - "name": "string" - }, - "optional": true, - "documentation": "More detail for this item, e.g. the signature of a function." - }, - { - "name": "uri", - "type": { - "kind": "base", - "name": "DocumentUri" - }, - "documentation": "The resource identifier of this item." - }, - { - "name": "range", - "type": { - "kind": "reference", - "name": "Range" - }, - "documentation": "The range enclosing this symbol not including leading/trailing whitespace but everything else, e.g. comments and code." - }, - { - "name": "selectionRange", - "type": { - "kind": "reference", - "name": "Range" - }, - "documentation": "The range that should be selected and revealed when this symbol is being picked, e.g. the name of a function.\nMust be contained by the [`range`](#CallHierarchyItem.range)." - }, - { - "name": "data", - "type": { - "kind": "reference", - "name": "LSPAny" - }, - "optional": true, - "documentation": "A data entry field that is preserved between a call hierarchy prepare and\nincoming calls or outgoing calls requests." - } - ], - "documentation": "Represents programming constructs like functions or constructors in the context\nof call hierarchy.\n\n@since 3.16.0", - "since": "3.16.0" - }, - { - "name": "CallHierarchyRegistrationOptions", - "properties": [], - "extends": [ - { - "kind": "reference", - "name": "TextDocumentRegistrationOptions" - }, - { - "kind": "reference", - "name": "CallHierarchyOptions" - } - ], - "mixins": [ - { - "kind": "reference", - "name": "StaticRegistrationOptions" - } - ], - "documentation": "Call hierarchy options used during static or dynamic registration.\n\n@since 3.16.0", - "since": "3.16.0" - }, - { - "name": "CallHierarchyIncomingCallsParams", - "properties": [ - { - "name": "item", - "type": { - "kind": "reference", - "name": "CallHierarchyItem" - } - } - ], - "mixins": [ - { - "kind": "reference", - "name": "WorkDoneProgressParams" - }, - { - "kind": "reference", - "name": "PartialResultParams" - } - ], - "documentation": "The parameter of a `callHierarchy/incomingCalls` request.\n\n@since 3.16.0", - "since": "3.16.0" - }, - { - "name": "CallHierarchyIncomingCall", - "properties": [ - { - "name": "from", - "type": { - "kind": "reference", - "name": "CallHierarchyItem" - }, - "documentation": "The item that makes the call." - }, - { - "name": "fromRanges", - "type": { - "kind": "array", - "element": { - "kind": "reference", - "name": "Range" - } - }, - "documentation": "The ranges at which the calls appear. This is relative to the caller\ndenoted by [`this.from`](#CallHierarchyIncomingCall.from)." - } - ], - "documentation": "Represents an incoming call, e.g. a caller of a method or constructor.\n\n@since 3.16.0", - "since": "3.16.0" - }, - { - "name": "CallHierarchyOutgoingCallsParams", - "properties": [ - { - "name": "item", - "type": { - "kind": "reference", - "name": "CallHierarchyItem" - } - } - ], - "mixins": [ - { - "kind": "reference", - "name": "WorkDoneProgressParams" - }, - { - "kind": "reference", - "name": "PartialResultParams" - } - ], - "documentation": "The parameter of a `callHierarchy/outgoingCalls` request.\n\n@since 3.16.0", - "since": "3.16.0" - }, - { - "name": "CallHierarchyOutgoingCall", - "properties": [ - { - "name": "to", - "type": { - "kind": "reference", - "name": "CallHierarchyItem" - }, - "documentation": "The item that is called." - }, - { - "name": "fromRanges", - "type": { - "kind": "array", - "element": { - "kind": "reference", - "name": "Range" - } - }, - "documentation": "The range at which this item is called. This is the range relative to the caller, e.g the item\npassed to [`provideCallHierarchyOutgoingCalls`](#CallHierarchyItemProvider.provideCallHierarchyOutgoingCalls)\nand not [`this.to`](#CallHierarchyOutgoingCall.to)." - } - ], - "documentation": "Represents an outgoing call, e.g. calling a getter from a method or a method from a constructor etc.\n\n@since 3.16.0", - "since": "3.16.0" - }, - { - "name": "SemanticTokensParams", - "properties": [ - { - "name": "textDocument", - "type": { - "kind": "reference", - "name": "TextDocumentIdentifier" - }, - "documentation": "The text document." - } - ], - "mixins": [ - { - "kind": "reference", - "name": "WorkDoneProgressParams" - }, - { - "kind": "reference", - "name": "PartialResultParams" - } - ], - "documentation": "@since 3.16.0", - "since": "3.16.0" - }, - { - "name": "SemanticTokens", - "properties": [ - { - "name": "resultId", - "type": { - "kind": "base", - "name": "string" - }, - "optional": true, - "documentation": "An optional result id. If provided and clients support delta updating\nthe client will include the result id in the next semantic token request.\nA server can then instead of computing all semantic tokens again simply\nsend a delta." - }, - { - "name": "data", - "type": { - "kind": "array", - "element": { - "kind": "base", - "name": "uinteger" - } - }, - "documentation": "The actual tokens." - } - ], - "documentation": "@since 3.16.0", - "since": "3.16.0" - }, - { - "name": "SemanticTokensPartialResult", - "properties": [ - { - "name": "data", - "type": { - "kind": "array", - "element": { - "kind": "base", - "name": "uinteger" - } - } - } - ], - "documentation": "@since 3.16.0", - "since": "3.16.0" - }, - { - "name": "SemanticTokensRegistrationOptions", - "properties": [], - "extends": [ - { - "kind": "reference", - "name": "TextDocumentRegistrationOptions" - }, - { - "kind": "reference", - "name": "SemanticTokensOptions" - } - ], - "mixins": [ - { - "kind": "reference", - "name": "StaticRegistrationOptions" - } - ], - "documentation": "@since 3.16.0", - "since": "3.16.0" - }, - { - "name": "SemanticTokensDeltaParams", - "properties": [ - { - "name": "textDocument", - "type": { - "kind": "reference", - "name": "TextDocumentIdentifier" - }, - "documentation": "The text document." - }, - { - "name": "previousResultId", - "type": { - "kind": "base", - "name": "string" - }, - "documentation": "The result id of a previous response. The result Id can either point to a full response\nor a delta response depending on what was received last." - } - ], - "mixins": [ - { - "kind": "reference", - "name": "WorkDoneProgressParams" - }, - { - "kind": "reference", - "name": "PartialResultParams" - } - ], - "documentation": "@since 3.16.0", - "since": "3.16.0" - }, - { - "name": "SemanticTokensDelta", - "properties": [ - { - "name": "resultId", - "type": { - "kind": "base", - "name": "string" - }, - "optional": true - }, - { - "name": "edits", - "type": { - "kind": "array", - "element": { - "kind": "reference", - "name": "SemanticTokensEdit" - } - }, - "documentation": "The semantic token edits to transform a previous result into a new result." - } - ], - "documentation": "@since 3.16.0", - "since": "3.16.0" - }, - { - "name": "SemanticTokensDeltaPartialResult", - "properties": [ - { - "name": "edits", - "type": { - "kind": "array", - "element": { - "kind": "reference", - "name": "SemanticTokensEdit" - } - } - } - ], - "documentation": "@since 3.16.0", - "since": "3.16.0" - }, - { - "name": "SemanticTokensRangeParams", - "properties": [ - { - "name": "textDocument", - "type": { - "kind": "reference", - "name": "TextDocumentIdentifier" - }, - "documentation": "The text document." - }, - { - "name": "range", - "type": { - "kind": "reference", - "name": "Range" - }, - "documentation": "The range the semantic tokens are requested for." - } - ], - "mixins": [ - { - "kind": "reference", - "name": "WorkDoneProgressParams" - }, - { - "kind": "reference", - "name": "PartialResultParams" - } - ], - "documentation": "@since 3.16.0", - "since": "3.16.0" - }, - { - "name": "ShowDocumentParams", - "properties": [ - { - "name": "uri", - "type": { - "kind": "base", - "name": "URI" - }, - "documentation": "The document uri to show." - }, - { - "name": "external", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "Indicates to show the resource in an external program.\nTo show for example `https://code.visualstudio.com/`\nin the default WEB browser set `external` to `true`." - }, - { - "name": "takeFocus", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "An optional property to indicate whether the editor\nshowing the document should take focus or not.\nClients might ignore this property if an external\nprogram is started." - }, - { - "name": "selection", - "type": { - "kind": "reference", - "name": "Range" - }, - "optional": true, - "documentation": "An optional selection range if the document is a text\ndocument. Clients might ignore the property if an\nexternal program is started or the file is not a text\nfile." - } - ], - "documentation": "Params to show a document.\n\n@since 3.16.0", - "since": "3.16.0" - }, - { - "name": "ShowDocumentResult", - "properties": [ - { - "name": "success", - "type": { - "kind": "base", - "name": "boolean" - }, - "documentation": "A boolean indicating if the show was successful." - } - ], - "documentation": "The result of a showDocument request.\n\n@since 3.16.0", - "since": "3.16.0" - }, - { - "name": "LinkedEditingRangeParams", - "properties": [], - "extends": [ - { - "kind": "reference", - "name": "TextDocumentPositionParams" - } - ], - "mixins": [ - { - "kind": "reference", - "name": "WorkDoneProgressParams" - } - ] - }, - { - "name": "LinkedEditingRanges", - "properties": [ - { - "name": "ranges", - "type": { - "kind": "array", - "element": { - "kind": "reference", - "name": "Range" - } - }, - "documentation": "A list of ranges that can be edited together. The ranges must have\nidentical length and contain identical text content. The ranges cannot overlap." - }, - { - "name": "wordPattern", - "type": { - "kind": "base", - "name": "string" - }, - "optional": true, - "documentation": "An optional word pattern (regular expression) that describes valid contents for\nthe given ranges. If no pattern is provided, the client configuration's word\npattern will be used." - } - ], - "documentation": "The result of a linked editing range request.\n\n@since 3.16.0", - "since": "3.16.0" - }, - { - "name": "LinkedEditingRangeRegistrationOptions", - "properties": [], - "extends": [ - { - "kind": "reference", - "name": "TextDocumentRegistrationOptions" - }, - { - "kind": "reference", - "name": "LinkedEditingRangeOptions" - } - ], - "mixins": [ - { - "kind": "reference", - "name": "StaticRegistrationOptions" - } - ] - }, - { - "name": "CreateFilesParams", - "properties": [ - { - "name": "files", - "type": { - "kind": "array", - "element": { - "kind": "reference", - "name": "FileCreate" - } - }, - "documentation": "An array of all files/folders created in this operation." - } - ], - "documentation": "The parameters sent in notifications/requests for user-initiated creation of\nfiles.\n\n@since 3.16.0", - "since": "3.16.0" - }, - { - "name": "WorkspaceEdit", - "properties": [ - { - "name": "changes", - "type": { - "kind": "map", - "key": { - "kind": "base", - "name": "DocumentUri" - }, - "value": { - "kind": "array", - "element": { - "kind": "reference", - "name": "TextEdit" - } - } - }, - "optional": true, - "documentation": "Holds changes to existing resources." - }, - { - "name": "documentChanges", - "type": { - "kind": "array", - "element": { - "kind": "or", - "items": [ - { - "kind": "reference", - "name": "TextDocumentEdit" - }, - { - "kind": "reference", - "name": "CreateFile" - }, - { - "kind": "reference", - "name": "RenameFile" - }, - { - "kind": "reference", - "name": "DeleteFile" - } - ] - } - }, - "optional": true, - "documentation": "Depending on the client capability `workspace.workspaceEdit.resourceOperations` document changes\nare either an array of `TextDocumentEdit`s to express changes to n different text documents\nwhere each text document edit addresses a specific version of a text document. Or it can contain\nabove `TextDocumentEdit`s mixed with create, rename and delete file / folder operations.\n\nWhether a client supports versioned document edits is expressed via\n`workspace.workspaceEdit.documentChanges` client capability.\n\nIf a client neither supports `documentChanges` nor `workspace.workspaceEdit.resourceOperations` then\nonly plain `TextEdit`s using the `changes` property are supported." - }, - { - "name": "changeAnnotations", - "type": { - "kind": "map", - "key": { - "kind": "reference", - "name": "ChangeAnnotationIdentifier" - }, - "value": { - "kind": "reference", - "name": "ChangeAnnotation" - } - }, - "optional": true, - "documentation": "A map of change annotations that can be referenced in `AnnotatedTextEdit`s or create, rename and\ndelete file / folder operations.\n\nWhether clients honor this property depends on the client capability `workspace.changeAnnotationSupport`.\n\n@since 3.16.0", - "since": "3.16.0" - } - ], - "documentation": "A workspace edit represents changes to many resources managed in the workspace. The edit\nshould either provide `changes` or `documentChanges`. If documentChanges are present\nthey are preferred over `changes` if the client can handle versioned document edits.\n\nSince version 3.13.0 a workspace edit can contain resource operations as well. If resource\noperations are present clients need to execute the operations in the order in which they\nare provided. So a workspace edit for example can consist of the following two changes:\n(1) a create file a.txt and (2) a text document edit which insert text into file a.txt.\n\nAn invalid sequence (e.g. (1) delete file a.txt and (2) insert text into file a.txt) will\ncause failure of the operation. How the client recovers from the failure is described by\nthe client capability: `workspace.workspaceEdit.failureHandling`" - }, - { - "name": "FileOperationRegistrationOptions", - "properties": [ - { - "name": "filters", - "type": { - "kind": "array", - "element": { - "kind": "reference", - "name": "FileOperationFilter" - } - }, - "documentation": "The actual filters." - } - ], - "documentation": "The options to register for file operations.\n\n@since 3.16.0", - "since": "3.16.0" - }, - { - "name": "RenameFilesParams", - "properties": [ - { - "name": "files", - "type": { - "kind": "array", - "element": { - "kind": "reference", - "name": "FileRename" - } - }, - "documentation": "An array of all files/folders renamed in this operation. When a folder is renamed, only\nthe folder will be included, and not its children." - } - ], - "documentation": "The parameters sent in notifications/requests for user-initiated renames of\nfiles.\n\n@since 3.16.0", - "since": "3.16.0" - }, - { - "name": "DeleteFilesParams", - "properties": [ - { - "name": "files", - "type": { - "kind": "array", - "element": { - "kind": "reference", - "name": "FileDelete" - } - }, - "documentation": "An array of all files/folders deleted in this operation." - } - ], - "documentation": "The parameters sent in notifications/requests for user-initiated deletes of\nfiles.\n\n@since 3.16.0", - "since": "3.16.0" - }, - { - "name": "MonikerParams", - "properties": [], - "extends": [ - { - "kind": "reference", - "name": "TextDocumentPositionParams" - } - ], - "mixins": [ - { - "kind": "reference", - "name": "WorkDoneProgressParams" - }, - { - "kind": "reference", - "name": "PartialResultParams" - } - ] - }, - { - "name": "Moniker", - "properties": [ - { - "name": "scheme", - "type": { - "kind": "base", - "name": "string" - }, - "documentation": "The scheme of the moniker. For example tsc or .Net" - }, - { - "name": "identifier", - "type": { - "kind": "base", - "name": "string" - }, - "documentation": "The identifier of the moniker. The value is opaque in LSIF however\nschema owners are allowed to define the structure if they want." - }, - { - "name": "unique", - "type": { - "kind": "reference", - "name": "UniquenessLevel" - }, - "documentation": "The scope in which the moniker is unique" - }, - { - "name": "kind", - "type": { - "kind": "reference", - "name": "MonikerKind" - }, - "optional": true, - "documentation": "The moniker kind if known." - } - ], - "documentation": "Moniker definition to match LSIF 0.5 moniker definition.\n\n@since 3.16.0", - "since": "3.16.0" - }, - { - "name": "MonikerRegistrationOptions", - "properties": [], - "extends": [ - { - "kind": "reference", - "name": "TextDocumentRegistrationOptions" - }, - { - "kind": "reference", - "name": "MonikerOptions" - } - ] - }, - { - "name": "TypeHierarchyPrepareParams", - "properties": [], - "extends": [ - { - "kind": "reference", - "name": "TextDocumentPositionParams" - } - ], - "mixins": [ - { - "kind": "reference", - "name": "WorkDoneProgressParams" - } - ], - "documentation": "The parameter of a `textDocument/prepareTypeHierarchy` request.\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "name": "TypeHierarchyItem", - "properties": [ - { - "name": "name", - "type": { - "kind": "base", - "name": "string" - }, - "documentation": "The name of this item." - }, - { - "name": "kind", - "type": { - "kind": "reference", - "name": "SymbolKind" - }, - "documentation": "The kind of this item." - }, - { - "name": "tags", - "type": { - "kind": "array", - "element": { - "kind": "reference", - "name": "SymbolTag" - } - }, - "optional": true, - "documentation": "Tags for this item." - }, - { - "name": "detail", - "type": { - "kind": "base", - "name": "string" - }, - "optional": true, - "documentation": "More detail for this item, e.g. the signature of a function." - }, - { - "name": "uri", - "type": { - "kind": "base", - "name": "DocumentUri" - }, - "documentation": "The resource identifier of this item." - }, - { - "name": "range", - "type": { - "kind": "reference", - "name": "Range" - }, - "documentation": "The range enclosing this symbol not including leading/trailing whitespace\nbut everything else, e.g. comments and code." - }, - { - "name": "selectionRange", - "type": { - "kind": "reference", - "name": "Range" - }, - "documentation": "The range that should be selected and revealed when this symbol is being\npicked, e.g. the name of a function. Must be contained by the\n[`range`](#TypeHierarchyItem.range)." - }, - { - "name": "data", - "type": { - "kind": "reference", - "name": "LSPAny" - }, - "optional": true, - "documentation": "A data entry field that is preserved between a type hierarchy prepare and\nsupertypes or subtypes requests. It could also be used to identify the\ntype hierarchy in the server, helping improve the performance on\nresolving supertypes and subtypes." - } - ], - "documentation": "@since 3.17.0", - "since": "3.17.0" - }, - { - "name": "TypeHierarchyRegistrationOptions", - "properties": [], - "extends": [ - { - "kind": "reference", - "name": "TextDocumentRegistrationOptions" - }, - { - "kind": "reference", - "name": "TypeHierarchyOptions" - } - ], - "mixins": [ - { - "kind": "reference", - "name": "StaticRegistrationOptions" - } - ], - "documentation": "Type hierarchy options used during static or dynamic registration.\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "name": "TypeHierarchySupertypesParams", - "properties": [ - { - "name": "item", - "type": { - "kind": "reference", - "name": "TypeHierarchyItem" - } - } - ], - "mixins": [ - { - "kind": "reference", - "name": "WorkDoneProgressParams" - }, - { - "kind": "reference", - "name": "PartialResultParams" - } - ], - "documentation": "The parameter of a `typeHierarchy/supertypes` request.\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "name": "TypeHierarchySubtypesParams", - "properties": [ - { - "name": "item", - "type": { - "kind": "reference", - "name": "TypeHierarchyItem" - } - } - ], - "mixins": [ - { - "kind": "reference", - "name": "WorkDoneProgressParams" - }, - { - "kind": "reference", - "name": "PartialResultParams" - } - ], - "documentation": "The parameter of a `typeHierarchy/subtypes` request.\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "name": "InlineValueParams", - "properties": [ - { - "name": "textDocument", - "type": { - "kind": "reference", - "name": "TextDocumentIdentifier" - }, - "documentation": "The text document." - }, - { - "name": "range", - "type": { - "kind": "reference", - "name": "Range" - }, - "documentation": "The document range for which inline values should be computed." - }, - { - "name": "context", - "type": { - "kind": "reference", - "name": "InlineValueContext" - }, - "documentation": "Additional information about the context in which inline values were\nrequested." - } - ], - "mixins": [ - { - "kind": "reference", - "name": "WorkDoneProgressParams" - } - ], - "documentation": "A parameter literal used in inline value requests.\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "name": "InlineValueRegistrationOptions", - "properties": [], - "extends": [ - { - "kind": "reference", - "name": "InlineValueOptions" - }, - { - "kind": "reference", - "name": "TextDocumentRegistrationOptions" - } - ], - "mixins": [ - { - "kind": "reference", - "name": "StaticRegistrationOptions" - } - ], - "documentation": "Inline value options used during static or dynamic registration.\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "name": "InlayHintParams", - "properties": [ - { - "name": "textDocument", - "type": { - "kind": "reference", - "name": "TextDocumentIdentifier" - }, - "documentation": "The text document." - }, - { - "name": "range", - "type": { - "kind": "reference", - "name": "Range" - }, - "documentation": "The document range for which inlay hints should be computed." - } - ], - "mixins": [ - { - "kind": "reference", - "name": "WorkDoneProgressParams" - } - ], - "documentation": "A parameter literal used in inlay hint requests.\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "name": "InlayHint", - "properties": [ - { - "name": "position", - "type": { - "kind": "reference", - "name": "Position" - }, - "documentation": "The position of this hint." - }, - { - "name": "label", - "type": { - "kind": "or", - "items": [ - { - "kind": "base", - "name": "string" - }, - { - "kind": "array", - "element": { - "kind": "reference", - "name": "InlayHintLabelPart" - } - } - ] - }, - "documentation": "The label of this hint. A human readable string or an array of\nInlayHintLabelPart label parts.\n\n*Note* that neither the string nor the label part can be empty." - }, - { - "name": "kind", - "type": { - "kind": "reference", - "name": "InlayHintKind" - }, - "optional": true, - "documentation": "The kind of this hint. Can be omitted in which case the client\nshould fall back to a reasonable default." - }, - { - "name": "textEdits", - "type": { - "kind": "array", - "element": { - "kind": "reference", - "name": "TextEdit" - } - }, - "optional": true, - "documentation": "Optional text edits that are performed when accepting this inlay hint.\n\n*Note* that edits are expected to change the document so that the inlay\nhint (or its nearest variant) is now part of the document and the inlay\nhint itself is now obsolete." - }, - { - "name": "tooltip", - "type": { - "kind": "or", - "items": [ - { - "kind": "base", - "name": "string" - }, - { - "kind": "reference", - "name": "MarkupContent" - } - ] - }, - "optional": true, - "documentation": "The tooltip text when you hover over this item." - }, - { - "name": "paddingLeft", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "Render padding before the hint.\n\nNote: Padding should use the editor's background color, not the\nbackground color of the hint itself. That means padding can be used\nto visually align/separate an inlay hint." - }, - { - "name": "paddingRight", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "Render padding after the hint.\n\nNote: Padding should use the editor's background color, not the\nbackground color of the hint itself. That means padding can be used\nto visually align/separate an inlay hint." - }, - { - "name": "data", - "type": { - "kind": "reference", - "name": "LSPAny" - }, - "optional": true, - "documentation": "A data entry field that is preserved on an inlay hint between\na `textDocument/inlayHint` and a `inlayHint/resolve` request." - } - ], - "documentation": "Inlay hint information.\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "name": "InlayHintRegistrationOptions", - "properties": [], - "extends": [ - { - "kind": "reference", - "name": "InlayHintOptions" - }, - { - "kind": "reference", - "name": "TextDocumentRegistrationOptions" - } - ], - "mixins": [ - { - "kind": "reference", - "name": "StaticRegistrationOptions" - } - ], - "documentation": "Inlay hint options used during static or dynamic registration.\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "name": "DocumentDiagnosticParams", - "properties": [ - { - "name": "textDocument", - "type": { - "kind": "reference", - "name": "TextDocumentIdentifier" - }, - "documentation": "The text document." - }, - { - "name": "identifier", - "type": { - "kind": "base", - "name": "string" - }, - "optional": true, - "documentation": "The additional identifier provided during registration." - }, - { - "name": "previousResultId", - "type": { - "kind": "base", - "name": "string" - }, - "optional": true, - "documentation": "The result id of a previous response if provided." - } - ], - "mixins": [ - { - "kind": "reference", - "name": "WorkDoneProgressParams" - }, - { - "kind": "reference", - "name": "PartialResultParams" - } - ], - "documentation": "Parameters of the document diagnostic request.\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "name": "DocumentDiagnosticReportPartialResult", - "properties": [ - { - "name": "relatedDocuments", - "type": { - "kind": "map", - "key": { - "kind": "base", - "name": "DocumentUri" - }, - "value": { - "kind": "or", - "items": [ - { - "kind": "reference", - "name": "FullDocumentDiagnosticReport" - }, - { - "kind": "reference", - "name": "UnchangedDocumentDiagnosticReport" - } - ] - } - } - } - ], - "documentation": "A partial result for a document diagnostic report.\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "name": "DiagnosticServerCancellationData", - "properties": [ - { - "name": "retriggerRequest", - "type": { - "kind": "base", - "name": "boolean" - } - } - ], - "documentation": "Cancellation data returned from a diagnostic request.\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "name": "DiagnosticRegistrationOptions", - "properties": [], - "extends": [ - { - "kind": "reference", - "name": "TextDocumentRegistrationOptions" - }, - { - "kind": "reference", - "name": "DiagnosticOptions" - } - ], - "mixins": [ - { - "kind": "reference", - "name": "StaticRegistrationOptions" - } - ], - "documentation": "Diagnostic registration options.\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "name": "WorkspaceDiagnosticParams", - "properties": [ - { - "name": "identifier", - "type": { - "kind": "base", - "name": "string" - }, - "optional": true, - "documentation": "The additional identifier provided during registration." - }, - { - "name": "previousResultIds", - "type": { - "kind": "array", - "element": { - "kind": "reference", - "name": "PreviousResultId" - } - }, - "documentation": "The currently known diagnostic reports with their\nprevious result ids." - } - ], - "mixins": [ - { - "kind": "reference", - "name": "WorkDoneProgressParams" - }, - { - "kind": "reference", - "name": "PartialResultParams" - } - ], - "documentation": "Parameters of the workspace diagnostic request.\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "name": "WorkspaceDiagnosticReport", - "properties": [ - { - "name": "items", - "type": { - "kind": "array", - "element": { - "kind": "reference", - "name": "WorkspaceDocumentDiagnosticReport" - } - } - } - ], - "documentation": "A workspace diagnostic report.\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "name": "WorkspaceDiagnosticReportPartialResult", - "properties": [ - { - "name": "items", - "type": { - "kind": "array", - "element": { - "kind": "reference", - "name": "WorkspaceDocumentDiagnosticReport" - } - } - } - ], - "documentation": "A partial result for a workspace diagnostic report.\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "name": "DidOpenNotebookDocumentParams", - "properties": [ - { - "name": "notebookDocument", - "type": { - "kind": "reference", - "name": "NotebookDocument" - }, - "documentation": "The notebook document that got opened." - }, - { - "name": "cellTextDocuments", - "type": { - "kind": "array", - "element": { - "kind": "reference", - "name": "TextDocumentItem" - } - }, - "documentation": "The text documents that represent the content\nof a notebook cell." - } - ], - "documentation": "The params sent in an open notebook document notification.\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "name": "DidChangeNotebookDocumentParams", - "properties": [ - { - "name": "notebookDocument", - "type": { - "kind": "reference", - "name": "VersionedNotebookDocumentIdentifier" - }, - "documentation": "The notebook document that did change. The version number points\nto the version after all provided changes have been applied. If\nonly the text document content of a cell changes the notebook version\ndoesn't necessarily have to change." - }, - { - "name": "change", - "type": { - "kind": "reference", - "name": "NotebookDocumentChangeEvent" - }, - "documentation": "The actual changes to the notebook document.\n\nThe changes describe single state changes to the notebook document.\nSo if there are two changes c1 (at array index 0) and c2 (at array\nindex 1) for a notebook in state S then c1 moves the notebook from\nS to S' and c2 from S' to S''. So c1 is computed on the state S and\nc2 is computed on the state S'.\n\nTo mirror the content of a notebook using change events use the following approach:\n- start with the same initial content\n- apply the 'notebookDocument/didChange' notifications in the order you receive them.\n- apply the `NotebookChangeEvent`s in a single notification in the order\n you receive them." - } - ], - "documentation": "The params sent in a change notebook document notification.\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "name": "DidSaveNotebookDocumentParams", - "properties": [ - { - "name": "notebookDocument", - "type": { - "kind": "reference", - "name": "NotebookDocumentIdentifier" - }, - "documentation": "The notebook document that got saved." - } - ], - "documentation": "The params sent in a save notebook document notification.\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "name": "DidCloseNotebookDocumentParams", - "properties": [ - { - "name": "notebookDocument", - "type": { - "kind": "reference", - "name": "NotebookDocumentIdentifier" - }, - "documentation": "The notebook document that got closed." - }, - { - "name": "cellTextDocuments", - "type": { - "kind": "array", - "element": { - "kind": "reference", - "name": "TextDocumentIdentifier" - } - }, - "documentation": "The text documents that represent the content\nof a notebook cell that got closed." - } - ], - "documentation": "The params sent in a close notebook document notification.\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "name": "RegistrationParams", - "properties": [ - { - "name": "registrations", - "type": { - "kind": "array", - "element": { - "kind": "reference", - "name": "Registration" - } - } - } - ] - }, - { - "name": "UnregistrationParams", - "properties": [ - { - "name": "unregisterations", - "type": { - "kind": "array", - "element": { - "kind": "reference", - "name": "Unregistration" - } - } - } - ] - }, - { - "name": "InitializeParams", - "properties": [], - "extends": [ - { - "kind": "reference", - "name": "_InitializeParams" - }, - { - "kind": "reference", - "name": "WorkspaceFoldersInitializeParams" - } - ] - }, - { - "name": "InitializeResult", - "properties": [ - { - "name": "capabilities", - "type": { - "kind": "reference", - "name": "ServerCapabilities" - }, - "documentation": "The capabilities the language server provides." - }, - { - "name": "serverInfo", - "type": { - "kind": "literal", - "value": { - "properties": [ - { - "name": "name", - "type": { - "kind": "base", - "name": "string" - }, - "documentation": "The name of the server as defined by the server." - }, - { - "name": "version", - "type": { - "kind": "base", - "name": "string" - }, - "optional": true, - "documentation": "The server's version as defined by the server." - } - ] - } - }, - "optional": true, - "documentation": "Information about the server.\n\n@since 3.15.0", - "since": "3.15.0" - } - ], - "documentation": "The result returned from an initialize request." - }, - { - "name": "InitializeError", - "properties": [ - { - "name": "retry", - "type": { - "kind": "base", - "name": "boolean" - }, - "documentation": "Indicates whether the client execute the following retry logic:\n(1) show the message provided by the ResponseError to the user\n(2) user selects retry or cancel\n(3) if user selected retry the initialize method is sent again." - } - ], - "documentation": "The data type of the ResponseError if the\ninitialize request fails." - }, - { - "name": "InitializedParams", - "properties": [] - }, - { - "name": "DidChangeConfigurationParams", - "properties": [ - { - "name": "settings", - "type": { - "kind": "reference", - "name": "LSPAny" - }, - "documentation": "The actual changed settings" - } - ], - "documentation": "The parameters of a change configuration notification." - }, - { - "name": "DidChangeConfigurationRegistrationOptions", - "properties": [ - { - "name": "section", - "type": { - "kind": "or", - "items": [ - { - "kind": "base", - "name": "string" - }, - { - "kind": "array", - "element": { - "kind": "base", - "name": "string" - } - } - ] - }, - "optional": true - } - ] - }, - { - "name": "ShowMessageParams", - "properties": [ - { - "name": "type", - "type": { - "kind": "reference", - "name": "MessageType" - }, - "documentation": "The message type. See {@link MessageType}" - }, - { - "name": "message", - "type": { - "kind": "base", - "name": "string" - }, - "documentation": "The actual message." - } - ], - "documentation": "The parameters of a notification message." - }, - { - "name": "ShowMessageRequestParams", - "properties": [ - { - "name": "type", - "type": { - "kind": "reference", - "name": "MessageType" - }, - "documentation": "The message type. See {@link MessageType}" - }, - { - "name": "message", - "type": { - "kind": "base", - "name": "string" - }, - "documentation": "The actual message." - }, - { - "name": "actions", - "type": { - "kind": "array", - "element": { - "kind": "reference", - "name": "MessageActionItem" - } - }, - "optional": true, - "documentation": "The message action items to present." - } - ] - }, - { - "name": "MessageActionItem", - "properties": [ - { - "name": "title", - "type": { - "kind": "base", - "name": "string" - }, - "documentation": "A short title like 'Retry', 'Open Log' etc." - } - ] - }, - { - "name": "LogMessageParams", - "properties": [ - { - "name": "type", - "type": { - "kind": "reference", - "name": "MessageType" - }, - "documentation": "The message type. See {@link MessageType}" - }, - { - "name": "message", - "type": { - "kind": "base", - "name": "string" - }, - "documentation": "The actual message." - } - ], - "documentation": "The log message parameters." - }, - { - "name": "DidOpenTextDocumentParams", - "properties": [ - { - "name": "textDocument", - "type": { - "kind": "reference", - "name": "TextDocumentItem" - }, - "documentation": "The document that was opened." - } - ], - "documentation": "The parameters sent in an open text document notification" - }, - { - "name": "DidChangeTextDocumentParams", - "properties": [ - { - "name": "textDocument", - "type": { - "kind": "reference", - "name": "VersionedTextDocumentIdentifier" - }, - "documentation": "The document that did change. The version number points\nto the version after all provided content changes have\nbeen applied." - }, - { - "name": "contentChanges", - "type": { - "kind": "array", - "element": { - "kind": "reference", - "name": "TextDocumentContentChangeEvent" - } - }, - "documentation": "The actual content changes. The content changes describe single state changes\nto the document. So if there are two content changes c1 (at array index 0) and\nc2 (at array index 1) for a document in state S then c1 moves the document from\nS to S' and c2 from S' to S''. So c1 is computed on the state S and c2 is computed\non the state S'.\n\nTo mirror the content of a document using change events use the following approach:\n- start with the same initial content\n- apply the 'textDocument/didChange' notifications in the order you receive them.\n- apply the `TextDocumentContentChangeEvent`s in a single notification in the order\n you receive them." - } - ], - "documentation": "The change text document notification's parameters." - }, - { - "name": "TextDocumentChangeRegistrationOptions", - "properties": [ - { - "name": "syncKind", - "type": { - "kind": "reference", - "name": "TextDocumentSyncKind" - }, - "documentation": "How documents are synced to the server." - } - ], - "extends": [ - { - "kind": "reference", - "name": "TextDocumentRegistrationOptions" - } - ], - "documentation": "Describe options to be used when registered for text document change events." - }, - { - "name": "DidCloseTextDocumentParams", - "properties": [ - { - "name": "textDocument", - "type": { - "kind": "reference", - "name": "TextDocumentIdentifier" - }, - "documentation": "The document that was closed." - } - ], - "documentation": "The parameters sent in a close text document notification" - }, - { - "name": "DidSaveTextDocumentParams", - "properties": [ - { - "name": "textDocument", - "type": { - "kind": "reference", - "name": "TextDocumentIdentifier" - }, - "documentation": "The document that was saved." - }, - { - "name": "text", - "type": { - "kind": "base", - "name": "string" - }, - "optional": true, - "documentation": "Optional the content when saved. Depends on the includeText value\nwhen the save notification was requested." - } - ], - "documentation": "The parameters sent in a save text document notification" - }, - { - "name": "TextDocumentSaveRegistrationOptions", - "properties": [], - "extends": [ - { - "kind": "reference", - "name": "TextDocumentRegistrationOptions" - }, - { - "kind": "reference", - "name": "SaveOptions" - } - ], - "documentation": "Save registration options." - }, - { - "name": "WillSaveTextDocumentParams", - "properties": [ - { - "name": "textDocument", - "type": { - "kind": "reference", - "name": "TextDocumentIdentifier" - }, - "documentation": "The document that will be saved." - }, - { - "name": "reason", - "type": { - "kind": "reference", - "name": "TextDocumentSaveReason" - }, - "documentation": "The 'TextDocumentSaveReason'." - } - ], - "documentation": "The parameters sent in a will save text document notification." - }, - { - "name": "TextEdit", - "properties": [ - { - "name": "range", - "type": { - "kind": "reference", - "name": "Range" - }, - "documentation": "The range of the text document to be manipulated. To insert\ntext into a document create a range where start === end." - }, - { - "name": "newText", - "type": { - "kind": "base", - "name": "string" - }, - "documentation": "The string to be inserted. For delete operations use an\nempty string." - } - ], - "documentation": "A text edit applicable to a text document." - }, - { - "name": "DidChangeWatchedFilesParams", - "properties": [ - { - "name": "changes", - "type": { - "kind": "array", - "element": { - "kind": "reference", - "name": "FileEvent" - } - }, - "documentation": "The actual file events." - } - ], - "documentation": "The watched files change notification's parameters." - }, - { - "name": "DidChangeWatchedFilesRegistrationOptions", - "properties": [ - { - "name": "watchers", - "type": { - "kind": "array", - "element": { - "kind": "reference", - "name": "FileSystemWatcher" - } - }, - "documentation": "The watchers to register." - } - ], - "documentation": "Describe options to be used when registered for text document change events." - }, - { - "name": "PublishDiagnosticsParams", - "properties": [ - { - "name": "uri", - "type": { - "kind": "base", - "name": "DocumentUri" - }, - "documentation": "The URI for which diagnostic information is reported." - }, - { - "name": "version", - "type": { - "kind": "base", - "name": "integer" - }, - "optional": true, - "documentation": "Optional the version number of the document the diagnostics are published for.\n\n@since 3.15.0", - "since": "3.15.0" - }, - { - "name": "diagnostics", - "type": { - "kind": "array", - "element": { - "kind": "reference", - "name": "Diagnostic" - } - }, - "documentation": "An array of diagnostic information items." - } - ], - "documentation": "The publish diagnostic notification's parameters." - }, - { - "name": "CompletionParams", - "properties": [ - { - "name": "context", - "type": { - "kind": "reference", - "name": "CompletionContext" - }, - "optional": true, - "documentation": "The completion context. This is only available it the client specifies\nto send this using the client capability `textDocument.completion.contextSupport === true`" - } - ], - "extends": [ - { - "kind": "reference", - "name": "TextDocumentPositionParams" - } - ], - "mixins": [ - { - "kind": "reference", - "name": "WorkDoneProgressParams" - }, - { - "kind": "reference", - "name": "PartialResultParams" - } - ], - "documentation": "Completion parameters" - }, - { - "name": "CompletionItem", - "properties": [ - { - "name": "label", - "type": { - "kind": "base", - "name": "string" - }, - "documentation": "The label of this completion item.\n\nThe label property is also by default the text that\nis inserted when selecting this completion.\n\nIf label details are provided the label itself should\nbe an unqualified name of the completion item." - }, - { - "name": "labelDetails", - "type": { - "kind": "reference", - "name": "CompletionItemLabelDetails" - }, - "optional": true, - "documentation": "Additional details for the label\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "name": "kind", - "type": { - "kind": "reference", - "name": "CompletionItemKind" - }, - "optional": true, - "documentation": "The kind of this completion item. Based of the kind\nan icon is chosen by the editor." - }, - { - "name": "tags", - "type": { - "kind": "array", - "element": { - "kind": "reference", - "name": "CompletionItemTag" - } - }, - "optional": true, - "documentation": "Tags for this completion item.\n\n@since 3.15.0", - "since": "3.15.0" - }, - { - "name": "detail", - "type": { - "kind": "base", - "name": "string" - }, - "optional": true, - "documentation": "A human-readable string with additional information\nabout this item, like type or symbol information." - }, - { - "name": "documentation", - "type": { - "kind": "or", - "items": [ - { - "kind": "base", - "name": "string" - }, - { - "kind": "reference", - "name": "MarkupContent" - } - ] - }, - "optional": true, - "documentation": "A human-readable string that represents a doc-comment." - }, - { - "name": "deprecated", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "Indicates if this item is deprecated.\n@deprecated Use `tags` instead." - }, - { - "name": "preselect", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "Select this item when showing.\n\n*Note* that only one completion item can be selected and that the\ntool / client decides which item that is. The rule is that the *first*\nitem of those that match best is selected." - }, - { - "name": "sortText", - "type": { - "kind": "base", - "name": "string" - }, - "optional": true, - "documentation": "A string that should be used when comparing this item\nwith other items. When `falsy` the [label](#CompletionItem.label)\nis used." - }, - { - "name": "filterText", - "type": { - "kind": "base", - "name": "string" - }, - "optional": true, - "documentation": "A string that should be used when filtering a set of\ncompletion items. When `falsy` the [label](#CompletionItem.label)\nis used." - }, - { - "name": "insertText", - "type": { - "kind": "base", - "name": "string" - }, - "optional": true, - "documentation": "A string that should be inserted into a document when selecting\nthis completion. When `falsy` the [label](#CompletionItem.label)\nis used.\n\nThe `insertText` is subject to interpretation by the client side.\nSome tools might not take the string literally. For example\nVS Code when code complete is requested in this example\n`con` and a completion item with an `insertText` of\n`console` is provided it will only insert `sole`. Therefore it is\nrecommended to use `textEdit` instead since it avoids additional client\nside interpretation." - }, - { - "name": "insertTextFormat", - "type": { - "kind": "reference", - "name": "InsertTextFormat" - }, - "optional": true, - "documentation": "The format of the insert text. The format applies to both the\n`insertText` property and the `newText` property of a provided\n`textEdit`. If omitted defaults to `InsertTextFormat.PlainText`.\n\nPlease note that the insertTextFormat doesn't apply to\n`additionalTextEdits`." - }, - { - "name": "insertTextMode", - "type": { - "kind": "reference", - "name": "InsertTextMode" - }, - "optional": true, - "documentation": "How whitespace and indentation is handled during completion\nitem insertion. If not provided the clients default value depends on\nthe `textDocument.completion.insertTextMode` client capability.\n\n@since 3.16.0", - "since": "3.16.0" - }, - { - "name": "textEdit", - "type": { - "kind": "or", - "items": [ - { - "kind": "reference", - "name": "TextEdit" - }, - { - "kind": "reference", - "name": "InsertReplaceEdit" - } - ] - }, - "optional": true, - "documentation": "An [edit](#TextEdit) which is applied to a document when selecting\nthis completion. When an edit is provided the value of\n[insertText](#CompletionItem.insertText) is ignored.\n\nMost editors support two different operations when accepting a completion\nitem. One is to insert a completion text and the other is to replace an\nexisting text with a completion text. Since this can usually not be\npredetermined by a server it can report both ranges. Clients need to\nsignal support for `InsertReplaceEdits` via the\n`textDocument.completion.insertReplaceSupport` client capability\nproperty.\n\n*Note 1:* The text edit's range as well as both ranges from an insert\nreplace edit must be a [single line] and they must contain the position\nat which completion has been requested.\n*Note 2:* If an `InsertReplaceEdit` is returned the edit's insert range\nmust be a prefix of the edit's replace range, that means it must be\ncontained and starting at the same position.\n\n@since 3.16.0 additional type `InsertReplaceEdit`", - "since": "3.16.0 additional type `InsertReplaceEdit`" - }, - { - "name": "textEditText", - "type": { - "kind": "base", - "name": "string" - }, - "optional": true, - "documentation": "The edit text used if the completion item is part of a CompletionList and\nCompletionList defines an item default for the text edit range.\n\nClients will only honor this property if they opt into completion list\nitem defaults using the capability `completionList.itemDefaults`.\n\nIf not provided and a list's default range is provided the label\nproperty is used as a text.\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "name": "additionalTextEdits", - "type": { - "kind": "array", - "element": { - "kind": "reference", - "name": "TextEdit" - } - }, - "optional": true, - "documentation": "An optional array of additional [text edits](#TextEdit) that are applied when\nselecting this completion. Edits must not overlap (including the same insert position)\nwith the main [edit](#CompletionItem.textEdit) nor with themselves.\n\nAdditional text edits should be used to change text unrelated to the current cursor position\n(for example adding an import statement at the top of the file if the completion item will\ninsert an unqualified type)." - }, - { - "name": "commitCharacters", - "type": { - "kind": "array", - "element": { - "kind": "base", - "name": "string" - } - }, - "optional": true, - "documentation": "An optional set of characters that when pressed while this completion is active will accept it first and\nthen type that character. *Note* that all commit characters should have `length=1` and that superfluous\ncharacters will be ignored." - }, - { - "name": "command", - "type": { - "kind": "reference", - "name": "Command" - }, - "optional": true, - "documentation": "An optional [command](#Command) that is executed *after* inserting this completion. *Note* that\nadditional modifications to the current document should be described with the\n[additionalTextEdits](#CompletionItem.additionalTextEdits)-property." - }, - { - "name": "data", - "type": { - "kind": "reference", - "name": "LSPAny" - }, - "optional": true, - "documentation": "A data entry field that is preserved on a completion item between a\n[CompletionRequest](#CompletionRequest) and a [CompletionResolveRequest](#CompletionResolveRequest)." - } - ], - "documentation": "A completion item represents a text snippet that is\nproposed to complete text that is being typed." - }, - { - "name": "CompletionList", - "properties": [ - { - "name": "isIncomplete", - "type": { - "kind": "base", - "name": "boolean" - }, - "documentation": "This list it not complete. Further typing results in recomputing this list.\n\nRecomputed lists have all their items replaced (not appended) in the\nincomplete completion sessions." - }, - { - "name": "itemDefaults", - "type": { - "kind": "literal", - "value": { - "properties": [ - { - "name": "commitCharacters", - "type": { - "kind": "array", - "element": { - "kind": "base", - "name": "string" - } - }, - "optional": true, - "documentation": "A default commit character set.\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "name": "editRange", - "type": { - "kind": "or", - "items": [ - { - "kind": "reference", - "name": "Range" - }, - { - "kind": "literal", - "value": { - "properties": [ - { - "name": "insert", - "type": { - "kind": "reference", - "name": "Range" - } - }, - { - "name": "replace", - "type": { - "kind": "reference", - "name": "Range" - } - } - ] - } - } - ] - }, - "optional": true, - "documentation": "A default edit range.\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "name": "insertTextFormat", - "type": { - "kind": "reference", - "name": "InsertTextFormat" - }, - "optional": true, - "documentation": "A default insert text format.\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "name": "insertTextMode", - "type": { - "kind": "reference", - "name": "InsertTextMode" - }, - "optional": true, - "documentation": "A default insert text mode.\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "name": "data", - "type": { - "kind": "reference", - "name": "LSPAny" - }, - "optional": true, - "documentation": "A default data value.\n\n@since 3.17.0", - "since": "3.17.0" - } - ] - } - }, - "optional": true, - "documentation": "In many cases the items of an actual completion result share the same\nvalue for properties like `commitCharacters` or the range of a text\nedit. A completion list can therefore define item defaults which will\nbe used if a completion item itself doesn't specify the value.\n\nIf a completion list specifies a default value and a completion item\nalso specifies a corresponding value the one from the item is used.\n\nServers are only allowed to return default values if the client\nsignals support for this via the `completionList.itemDefaults`\ncapability.\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "name": "items", - "type": { - "kind": "array", - "element": { - "kind": "reference", - "name": "CompletionItem" - } - }, - "documentation": "The completion items." - } - ], - "documentation": "Represents a collection of [completion items](#CompletionItem) to be presented\nin the editor." - }, - { - "name": "CompletionRegistrationOptions", - "properties": [], - "extends": [ - { - "kind": "reference", - "name": "TextDocumentRegistrationOptions" - }, - { - "kind": "reference", - "name": "CompletionOptions" - } - ], - "documentation": "Registration options for a [CompletionRequest](#CompletionRequest)." - }, - { - "name": "HoverParams", - "properties": [], - "extends": [ - { - "kind": "reference", - "name": "TextDocumentPositionParams" - } - ], - "mixins": [ - { - "kind": "reference", - "name": "WorkDoneProgressParams" - } - ], - "documentation": "Parameters for a [HoverRequest](#HoverRequest)." - }, - { - "name": "Hover", - "properties": [ - { - "name": "contents", - "type": { - "kind": "or", - "items": [ - { - "kind": "reference", - "name": "MarkupContent" - }, - { - "kind": "reference", - "name": "MarkedString" - }, - { - "kind": "array", - "element": { - "kind": "reference", - "name": "MarkedString" - } - } - ] - }, - "documentation": "The hover's content" - }, - { - "name": "range", - "type": { - "kind": "reference", - "name": "Range" - }, - "optional": true, - "documentation": "An optional range inside the text document that is used to\nvisualize the hover, e.g. by changing the background color." - } - ], - "documentation": "The result of a hover request." - }, - { - "name": "HoverRegistrationOptions", - "properties": [], - "extends": [ - { - "kind": "reference", - "name": "TextDocumentRegistrationOptions" - }, - { - "kind": "reference", - "name": "HoverOptions" - } - ], - "documentation": "Registration options for a [HoverRequest](#HoverRequest)." - }, - { - "name": "SignatureHelpParams", - "properties": [ - { - "name": "context", - "type": { - "kind": "reference", - "name": "SignatureHelpContext" - }, - "optional": true, - "documentation": "The signature help context. This is only available if the client specifies\nto send this using the client capability `textDocument.signatureHelp.contextSupport === true`\n\n@since 3.15.0", - "since": "3.15.0" - } - ], - "extends": [ - { - "kind": "reference", - "name": "TextDocumentPositionParams" - } - ], - "mixins": [ - { - "kind": "reference", - "name": "WorkDoneProgressParams" - } - ], - "documentation": "Parameters for a [SignatureHelpRequest](#SignatureHelpRequest)." - }, - { - "name": "SignatureHelp", - "properties": [ - { - "name": "signatures", - "type": { - "kind": "array", - "element": { - "kind": "reference", - "name": "SignatureInformation" - } - }, - "documentation": "One or more signatures." - }, - { - "name": "activeSignature", - "type": { - "kind": "base", - "name": "uinteger" - }, - "optional": true, - "documentation": "The active signature. If omitted or the value lies outside the\nrange of `signatures` the value defaults to zero or is ignored if\nthe `SignatureHelp` has no signatures.\n\nWhenever possible implementors should make an active decision about\nthe active signature and shouldn't rely on a default value.\n\nIn future version of the protocol this property might become\nmandatory to better express this." - }, - { - "name": "activeParameter", - "type": { - "kind": "base", - "name": "uinteger" - }, - "optional": true, - "documentation": "The active parameter of the active signature. If omitted or the value\nlies outside the range of `signatures[activeSignature].parameters`\ndefaults to 0 if the active signature has parameters. If\nthe active signature has no parameters it is ignored.\nIn future version of the protocol this property might become\nmandatory to better express the active parameter if the\nactive signature does have any." - } - ], - "documentation": "Signature help represents the signature of something\ncallable. There can be multiple signature but only one\nactive and only one active parameter." - }, - { - "name": "SignatureHelpRegistrationOptions", - "properties": [], - "extends": [ - { - "kind": "reference", - "name": "TextDocumentRegistrationOptions" - }, - { - "kind": "reference", - "name": "SignatureHelpOptions" - } - ], - "documentation": "Registration options for a [SignatureHelpRequest](#SignatureHelpRequest)." - }, - { - "name": "DefinitionParams", - "properties": [], - "extends": [ - { - "kind": "reference", - "name": "TextDocumentPositionParams" - } - ], - "mixins": [ - { - "kind": "reference", - "name": "WorkDoneProgressParams" - }, - { - "kind": "reference", - "name": "PartialResultParams" - } - ], - "documentation": "Parameters for a [DefinitionRequest](#DefinitionRequest)." - }, - { - "name": "DefinitionRegistrationOptions", - "properties": [], - "extends": [ - { - "kind": "reference", - "name": "TextDocumentRegistrationOptions" - }, - { - "kind": "reference", - "name": "DefinitionOptions" - } - ], - "documentation": "Registration options for a [DefinitionRequest](#DefinitionRequest)." - }, - { - "name": "ReferenceParams", - "properties": [ - { - "name": "context", - "type": { - "kind": "reference", - "name": "ReferenceContext" - } - } - ], - "extends": [ - { - "kind": "reference", - "name": "TextDocumentPositionParams" - } - ], - "mixins": [ - { - "kind": "reference", - "name": "WorkDoneProgressParams" - }, - { - "kind": "reference", - "name": "PartialResultParams" - } - ], - "documentation": "Parameters for a [ReferencesRequest](#ReferencesRequest)." - }, - { - "name": "ReferenceRegistrationOptions", - "properties": [], - "extends": [ - { - "kind": "reference", - "name": "TextDocumentRegistrationOptions" - }, - { - "kind": "reference", - "name": "ReferenceOptions" - } - ], - "documentation": "Registration options for a [ReferencesRequest](#ReferencesRequest)." - }, - { - "name": "DocumentHighlightParams", - "properties": [], - "extends": [ - { - "kind": "reference", - "name": "TextDocumentPositionParams" - } - ], - "mixins": [ - { - "kind": "reference", - "name": "WorkDoneProgressParams" - }, - { - "kind": "reference", - "name": "PartialResultParams" - } - ], - "documentation": "Parameters for a [DocumentHighlightRequest](#DocumentHighlightRequest)." - }, - { - "name": "DocumentHighlight", - "properties": [ - { - "name": "range", - "type": { - "kind": "reference", - "name": "Range" - }, - "documentation": "The range this highlight applies to." - }, - { - "name": "kind", - "type": { - "kind": "reference", - "name": "DocumentHighlightKind" - }, - "optional": true, - "documentation": "The highlight kind, default is [text](#DocumentHighlightKind.Text)." - } - ], - "documentation": "A document highlight is a range inside a text document which deserves\nspecial attention. Usually a document highlight is visualized by changing\nthe background color of its range." - }, - { - "name": "DocumentHighlightRegistrationOptions", - "properties": [], - "extends": [ - { - "kind": "reference", - "name": "TextDocumentRegistrationOptions" - }, - { - "kind": "reference", - "name": "DocumentHighlightOptions" - } - ], - "documentation": "Registration options for a [DocumentHighlightRequest](#DocumentHighlightRequest)." - }, - { - "name": "DocumentSymbolParams", - "properties": [ - { - "name": "textDocument", - "type": { - "kind": "reference", - "name": "TextDocumentIdentifier" - }, - "documentation": "The text document." - } - ], - "mixins": [ - { - "kind": "reference", - "name": "WorkDoneProgressParams" - }, - { - "kind": "reference", - "name": "PartialResultParams" - } - ], - "documentation": "Parameters for a [DocumentSymbolRequest](#DocumentSymbolRequest)." - }, - { - "name": "SymbolInformation", - "properties": [ - { - "name": "deprecated", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "Indicates if this symbol is deprecated.\n\n@deprecated Use tags instead" - }, - { - "name": "location", - "type": { - "kind": "reference", - "name": "Location" - }, - "documentation": "The location of this symbol. The location's range is used by a tool\nto reveal the location in the editor. If the symbol is selected in the\ntool the range's start information is used to position the cursor. So\nthe range usually spans more than the actual symbol's name and does\nnormally include things like visibility modifiers.\n\nThe range doesn't have to denote a node range in the sense of an abstract\nsyntax tree. It can therefore not be used to re-construct a hierarchy of\nthe symbols." - } - ], - "extends": [ - { - "kind": "reference", - "name": "BaseSymbolInformation" - } - ], - "documentation": "Represents information about programming constructs like variables, classes,\ninterfaces etc." - }, - { - "name": "DocumentSymbol", - "properties": [ - { - "name": "name", - "type": { - "kind": "base", - "name": "string" - }, - "documentation": "The name of this symbol. Will be displayed in the user interface and therefore must not be\nan empty string or a string only consisting of white spaces." - }, - { - "name": "detail", - "type": { - "kind": "base", - "name": "string" - }, - "optional": true, - "documentation": "More detail for this symbol, e.g the signature of a function." - }, - { - "name": "kind", - "type": { - "kind": "reference", - "name": "SymbolKind" - }, - "documentation": "The kind of this symbol." - }, - { - "name": "tags", - "type": { - "kind": "array", - "element": { - "kind": "reference", - "name": "SymbolTag" - } - }, - "optional": true, - "documentation": "Tags for this document symbol.\n\n@since 3.16.0", - "since": "3.16.0" - }, - { - "name": "deprecated", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "Indicates if this symbol is deprecated.\n\n@deprecated Use tags instead" - }, - { - "name": "range", - "type": { - "kind": "reference", - "name": "Range" - }, - "documentation": "The range enclosing this symbol not including leading/trailing whitespace but everything else\nlike comments. This information is typically used to determine if the clients cursor is\ninside the symbol to reveal in the symbol in the UI." - }, - { - "name": "selectionRange", - "type": { - "kind": "reference", - "name": "Range" - }, - "documentation": "The range that should be selected and revealed when this symbol is being picked, e.g the name of a function.\nMust be contained by the `range`." - }, - { - "name": "children", - "type": { - "kind": "array", - "element": { - "kind": "reference", - "name": "DocumentSymbol" - } - }, - "optional": true, - "documentation": "Children of this symbol, e.g. properties of a class." - } - ], - "documentation": "Represents programming constructs like variables, classes, interfaces etc.\nthat appear in a document. Document symbols can be hierarchical and they\nhave two ranges: one that encloses its definition and one that points to\nits most interesting range, e.g. the range of an identifier." - }, - { - "name": "DocumentSymbolRegistrationOptions", - "properties": [], - "extends": [ - { - "kind": "reference", - "name": "TextDocumentRegistrationOptions" - }, - { - "kind": "reference", - "name": "DocumentSymbolOptions" - } - ], - "documentation": "Registration options for a [DocumentSymbolRequest](#DocumentSymbolRequest)." - }, - { - "name": "CodeActionParams", - "properties": [ - { - "name": "textDocument", - "type": { - "kind": "reference", - "name": "TextDocumentIdentifier" - }, - "documentation": "The document in which the command was invoked." - }, - { - "name": "range", - "type": { - "kind": "reference", - "name": "Range" - }, - "documentation": "The range for which the command was invoked." - }, - { - "name": "context", - "type": { - "kind": "reference", - "name": "CodeActionContext" - }, - "documentation": "Context carrying additional information." - } - ], - "mixins": [ - { - "kind": "reference", - "name": "WorkDoneProgressParams" - }, - { - "kind": "reference", - "name": "PartialResultParams" - } - ], - "documentation": "The parameters of a [CodeActionRequest](#CodeActionRequest)." - }, - { - "name": "Command", - "properties": [ - { - "name": "title", - "type": { - "kind": "base", - "name": "string" - }, - "documentation": "Title of the command, like `save`." - }, - { - "name": "command", - "type": { - "kind": "base", - "name": "string" - }, - "documentation": "The identifier of the actual command handler." - }, - { - "name": "arguments", - "type": { - "kind": "array", - "element": { - "kind": "reference", - "name": "LSPAny" - } - }, - "optional": true, - "documentation": "Arguments that the command handler should be\ninvoked with." - } - ], - "documentation": "Represents a reference to a command. Provides a title which\nwill be used to represent a command in the UI and, optionally,\nan array of arguments which will be passed to the command handler\nfunction when invoked." - }, - { - "name": "CodeAction", - "properties": [ - { - "name": "title", - "type": { - "kind": "base", - "name": "string" - }, - "documentation": "A short, human-readable, title for this code action." - }, - { - "name": "kind", - "type": { - "kind": "reference", - "name": "CodeActionKind" - }, - "optional": true, - "documentation": "The kind of the code action.\n\nUsed to filter code actions." - }, - { - "name": "diagnostics", - "type": { - "kind": "array", - "element": { - "kind": "reference", - "name": "Diagnostic" - } - }, - "optional": true, - "documentation": "The diagnostics that this code action resolves." - }, - { - "name": "isPreferred", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "Marks this as a preferred action. Preferred actions are used by the `auto fix` command and can be targeted\nby keybindings.\n\nA quick fix should be marked preferred if it properly addresses the underlying error.\nA refactoring should be marked preferred if it is the most reasonable choice of actions to take.\n\n@since 3.15.0", - "since": "3.15.0" - }, - { - "name": "disabled", - "type": { - "kind": "literal", - "value": { - "properties": [ - { - "name": "reason", - "type": { - "kind": "base", - "name": "string" - }, - "documentation": "Human readable description of why the code action is currently disabled.\n\nThis is displayed in the code actions UI." - } - ] - } - }, - "optional": true, - "documentation": "Marks that the code action cannot currently be applied.\n\nClients should follow the following guidelines regarding disabled code actions:\n\n - Disabled code actions are not shown in automatic [lightbulbs](https://code.visualstudio.com/docs/editor/editingevolved#_code-action)\n code action menus.\n\n - Disabled actions are shown as faded out in the code action menu when the user requests a more specific type\n of code action, such as refactorings.\n\n - If the user has a [keybinding](https://code.visualstudio.com/docs/editor/refactoring#_keybindings-for-code-actions)\n that auto applies a code action and only disabled code actions are returned, the client should show the user an\n error message with `reason` in the editor.\n\n@since 3.16.0", - "since": "3.16.0" - }, - { - "name": "edit", - "type": { - "kind": "reference", - "name": "WorkspaceEdit" - }, - "optional": true, - "documentation": "The workspace edit this code action performs." - }, - { - "name": "command", - "type": { - "kind": "reference", - "name": "Command" - }, - "optional": true, - "documentation": "A command this code action executes. If a code action\nprovides an edit and a command, first the edit is\nexecuted and then the command." - }, - { - "name": "data", - "type": { - "kind": "reference", - "name": "LSPAny" - }, - "optional": true, - "documentation": "A data entry field that is preserved on a code action between\na `textDocument/codeAction` and a `codeAction/resolve` request.\n\n@since 3.16.0", - "since": "3.16.0" - } - ], - "documentation": "A code action represents a change that can be performed in code, e.g. to fix a problem or\nto refactor code.\n\nA CodeAction must set either `edit` and/or a `command`. If both are supplied, the `edit` is applied first, then the `command` is executed." - }, - { - "name": "CodeActionRegistrationOptions", - "properties": [], - "extends": [ - { - "kind": "reference", - "name": "TextDocumentRegistrationOptions" - }, - { - "kind": "reference", - "name": "CodeActionOptions" - } - ], - "documentation": "Registration options for a [CodeActionRequest](#CodeActionRequest)." - }, - { - "name": "WorkspaceSymbolParams", - "properties": [ - { - "name": "query", - "type": { - "kind": "base", - "name": "string" - }, - "documentation": "A query string to filter symbols by. Clients may send an empty\nstring here to request all symbols." - } - ], - "mixins": [ - { - "kind": "reference", - "name": "WorkDoneProgressParams" - }, - { - "kind": "reference", - "name": "PartialResultParams" - } - ], - "documentation": "The parameters of a [WorkspaceSymbolRequest](#WorkspaceSymbolRequest)." - }, - { - "name": "WorkspaceSymbol", - "properties": [ - { - "name": "location", - "type": { - "kind": "or", - "items": [ - { - "kind": "reference", - "name": "Location" - }, - { - "kind": "literal", - "value": { - "properties": [ - { - "name": "uri", - "type": { - "kind": "base", - "name": "DocumentUri" - } - } - ] - } - } - ] - }, - "documentation": "The location of the symbol. Whether a server is allowed to\nreturn a location without a range depends on the client\ncapability `workspace.symbol.resolveSupport`.\n\nSee SymbolInformation#location for more details." - }, - { - "name": "data", - "type": { - "kind": "reference", - "name": "LSPAny" - }, - "optional": true, - "documentation": "A data entry field that is preserved on a workspace symbol between a\nworkspace symbol request and a workspace symbol resolve request." - } - ], - "extends": [ - { - "kind": "reference", - "name": "BaseSymbolInformation" - } - ], - "documentation": "A special workspace symbol that supports locations without a range.\n\nSee also SymbolInformation.\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "name": "WorkspaceSymbolRegistrationOptions", - "properties": [], - "extends": [ - { - "kind": "reference", - "name": "WorkspaceSymbolOptions" - } - ], - "documentation": "Registration options for a [WorkspaceSymbolRequest](#WorkspaceSymbolRequest)." - }, - { - "name": "CodeLensParams", - "properties": [ - { - "name": "textDocument", - "type": { - "kind": "reference", - "name": "TextDocumentIdentifier" - }, - "documentation": "The document to request code lens for." - } - ], - "mixins": [ - { - "kind": "reference", - "name": "WorkDoneProgressParams" - }, - { - "kind": "reference", - "name": "PartialResultParams" - } - ], - "documentation": "The parameters of a [CodeLensRequest](#CodeLensRequest)." - }, - { - "name": "CodeLens", - "properties": [ - { - "name": "range", - "type": { - "kind": "reference", - "name": "Range" - }, - "documentation": "The range in which this code lens is valid. Should only span a single line." - }, - { - "name": "command", - "type": { - "kind": "reference", - "name": "Command" - }, - "optional": true, - "documentation": "The command this code lens represents." - }, - { - "name": "data", - "type": { - "kind": "reference", - "name": "LSPAny" - }, - "optional": true, - "documentation": "A data entry field that is preserved on a code lens item between\na [CodeLensRequest](#CodeLensRequest) and a [CodeLensResolveRequest]\n(#CodeLensResolveRequest)" - } - ], - "documentation": "A code lens represents a [command](#Command) that should be shown along with\nsource text, like the number of references, a way to run tests, etc.\n\nA code lens is _unresolved_ when no command is associated to it. For performance\nreasons the creation of a code lens and resolving should be done in two stages." - }, - { - "name": "CodeLensRegistrationOptions", - "properties": [], - "extends": [ - { - "kind": "reference", - "name": "TextDocumentRegistrationOptions" - }, - { - "kind": "reference", - "name": "CodeLensOptions" - } - ], - "documentation": "Registration options for a [CodeLensRequest](#CodeLensRequest)." - }, - { - "name": "DocumentLinkParams", - "properties": [ - { - "name": "textDocument", - "type": { - "kind": "reference", - "name": "TextDocumentIdentifier" - }, - "documentation": "The document to provide document links for." - } - ], - "mixins": [ - { - "kind": "reference", - "name": "WorkDoneProgressParams" - }, - { - "kind": "reference", - "name": "PartialResultParams" - } - ], - "documentation": "The parameters of a [DocumentLinkRequest](#DocumentLinkRequest)." - }, - { - "name": "DocumentLink", - "properties": [ - { - "name": "range", - "type": { - "kind": "reference", - "name": "Range" - }, - "documentation": "The range this link applies to." - }, - { - "name": "target", - "type": { - "kind": "base", - "name": "string" - }, - "optional": true, - "documentation": "The uri this link points to. If missing a resolve request is sent later." - }, - { - "name": "tooltip", - "type": { - "kind": "base", - "name": "string" - }, - "optional": true, - "documentation": "The tooltip text when you hover over this link.\n\nIf a tooltip is provided, is will be displayed in a string that includes instructions on how to\ntrigger the link, such as `{0} (ctrl + click)`. The specific instructions vary depending on OS,\nuser settings, and localization.\n\n@since 3.15.0", - "since": "3.15.0" - }, - { - "name": "data", - "type": { - "kind": "reference", - "name": "LSPAny" - }, - "optional": true, - "documentation": "A data entry field that is preserved on a document link between a\nDocumentLinkRequest and a DocumentLinkResolveRequest." - } - ], - "documentation": "A document link is a range in a text document that links to an internal or external resource, like another\ntext document or a web site." - }, - { - "name": "DocumentLinkRegistrationOptions", - "properties": [], - "extends": [ - { - "kind": "reference", - "name": "TextDocumentRegistrationOptions" - }, - { - "kind": "reference", - "name": "DocumentLinkOptions" - } - ], - "documentation": "Registration options for a [DocumentLinkRequest](#DocumentLinkRequest)." - }, - { - "name": "DocumentFormattingParams", - "properties": [ - { - "name": "textDocument", - "type": { - "kind": "reference", - "name": "TextDocumentIdentifier" - }, - "documentation": "The document to format." - }, - { - "name": "options", - "type": { - "kind": "reference", - "name": "FormattingOptions" - }, - "documentation": "The format options." - } - ], - "mixins": [ - { - "kind": "reference", - "name": "WorkDoneProgressParams" - } - ], - "documentation": "The parameters of a [DocumentFormattingRequest](#DocumentFormattingRequest)." - }, - { - "name": "DocumentFormattingRegistrationOptions", - "properties": [], - "extends": [ - { - "kind": "reference", - "name": "TextDocumentRegistrationOptions" - }, - { - "kind": "reference", - "name": "DocumentFormattingOptions" - } - ], - "documentation": "Registration options for a [DocumentFormattingRequest](#DocumentFormattingRequest)." - }, - { - "name": "DocumentRangeFormattingParams", - "properties": [ - { - "name": "textDocument", - "type": { - "kind": "reference", - "name": "TextDocumentIdentifier" - }, - "documentation": "The document to format." - }, - { - "name": "range", - "type": { - "kind": "reference", - "name": "Range" - }, - "documentation": "The range to format" - }, - { - "name": "options", - "type": { - "kind": "reference", - "name": "FormattingOptions" - }, - "documentation": "The format options" - } - ], - "mixins": [ - { - "kind": "reference", - "name": "WorkDoneProgressParams" - } - ], - "documentation": "The parameters of a [DocumentRangeFormattingRequest](#DocumentRangeFormattingRequest)." - }, - { - "name": "DocumentRangeFormattingRegistrationOptions", - "properties": [], - "extends": [ - { - "kind": "reference", - "name": "TextDocumentRegistrationOptions" - }, - { - "kind": "reference", - "name": "DocumentRangeFormattingOptions" - } - ], - "documentation": "Registration options for a [DocumentRangeFormattingRequest](#DocumentRangeFormattingRequest)." - }, - { - "name": "DocumentOnTypeFormattingParams", - "properties": [ - { - "name": "textDocument", - "type": { - "kind": "reference", - "name": "TextDocumentIdentifier" - }, - "documentation": "The document to format." - }, - { - "name": "position", - "type": { - "kind": "reference", - "name": "Position" - }, - "documentation": "The position around which the on type formatting should happen.\nThis is not necessarily the exact position where the character denoted\nby the property `ch` got typed." - }, - { - "name": "ch", - "type": { - "kind": "base", - "name": "string" - }, - "documentation": "The character that has been typed that triggered the formatting\non type request. That is not necessarily the last character that\ngot inserted into the document since the client could auto insert\ncharacters as well (e.g. like automatic brace completion)." - }, - { - "name": "options", - "type": { - "kind": "reference", - "name": "FormattingOptions" - }, - "documentation": "The formatting options." - } - ], - "documentation": "The parameters of a [DocumentOnTypeFormattingRequest](#DocumentOnTypeFormattingRequest)." - }, - { - "name": "DocumentOnTypeFormattingRegistrationOptions", - "properties": [], - "extends": [ - { - "kind": "reference", - "name": "TextDocumentRegistrationOptions" - }, - { - "kind": "reference", - "name": "DocumentOnTypeFormattingOptions" - } - ], - "documentation": "Registration options for a [DocumentOnTypeFormattingRequest](#DocumentOnTypeFormattingRequest)." - }, - { - "name": "RenameParams", - "properties": [ - { - "name": "textDocument", - "type": { - "kind": "reference", - "name": "TextDocumentIdentifier" - }, - "documentation": "The document to rename." - }, - { - "name": "position", - "type": { - "kind": "reference", - "name": "Position" - }, - "documentation": "The position at which this request was sent." - }, - { - "name": "newName", - "type": { - "kind": "base", - "name": "string" - }, - "documentation": "The new name of the symbol. If the given name is not valid the\nrequest must return a [ResponseError](#ResponseError) with an\nappropriate message set." - } - ], - "mixins": [ - { - "kind": "reference", - "name": "WorkDoneProgressParams" - } - ], - "documentation": "The parameters of a [RenameRequest](#RenameRequest)." - }, - { - "name": "RenameRegistrationOptions", - "properties": [], - "extends": [ - { - "kind": "reference", - "name": "TextDocumentRegistrationOptions" - }, - { - "kind": "reference", - "name": "RenameOptions" - } - ], - "documentation": "Registration options for a [RenameRequest](#RenameRequest)." - }, - { - "name": "PrepareRenameParams", - "properties": [], - "extends": [ - { - "kind": "reference", - "name": "TextDocumentPositionParams" - } - ], - "mixins": [ - { - "kind": "reference", - "name": "WorkDoneProgressParams" - } - ] - }, - { - "name": "ExecuteCommandParams", - "properties": [ - { - "name": "command", - "type": { - "kind": "base", - "name": "string" - }, - "documentation": "The identifier of the actual command handler." - }, - { - "name": "arguments", - "type": { - "kind": "array", - "element": { - "kind": "reference", - "name": "LSPAny" - } - }, - "optional": true, - "documentation": "Arguments that the command should be invoked with." - } - ], - "mixins": [ - { - "kind": "reference", - "name": "WorkDoneProgressParams" - } - ], - "documentation": "The parameters of a [ExecuteCommandRequest](#ExecuteCommandRequest)." - }, - { - "name": "ExecuteCommandRegistrationOptions", - "properties": [], - "extends": [ - { - "kind": "reference", - "name": "ExecuteCommandOptions" - } - ], - "documentation": "Registration options for a [ExecuteCommandRequest](#ExecuteCommandRequest)." - }, - { - "name": "ApplyWorkspaceEditParams", - "properties": [ - { - "name": "label", - "type": { - "kind": "base", - "name": "string" - }, - "optional": true, - "documentation": "An optional label of the workspace edit. This label is\npresented in the user interface for example on an undo\nstack to undo the workspace edit." - }, - { - "name": "edit", - "type": { - "kind": "reference", - "name": "WorkspaceEdit" - }, - "documentation": "The edits to apply." - } - ], - "documentation": "The parameters passed via a apply workspace edit request." - }, - { - "name": "ApplyWorkspaceEditResult", - "properties": [ - { - "name": "applied", - "type": { - "kind": "base", - "name": "boolean" - }, - "documentation": "Indicates whether the edit was applied or not." - }, - { - "name": "failureReason", - "type": { - "kind": "base", - "name": "string" - }, - "optional": true, - "documentation": "An optional textual description for why the edit was not applied.\nThis may be used by the server for diagnostic logging or to provide\na suitable error for a request that triggered the edit." - }, - { - "name": "failedChange", - "type": { - "kind": "base", - "name": "uinteger" - }, - "optional": true, - "documentation": "Depending on the client's failure handling strategy `failedChange` might\ncontain the index of the change that failed. This property is only available\nif the client signals a `failureHandlingStrategy` in its client capabilities." - } - ], - "documentation": "The result returned from the apply workspace edit request.\n\n@since 3.17 renamed from ApplyWorkspaceEditResponse", - "since": "3.17 renamed from ApplyWorkspaceEditResponse" - }, - { - "name": "WorkDoneProgressBegin", - "properties": [ - { - "name": "kind", - "type": { - "kind": "stringLiteral", - "value": "begin" - } - }, - { - "name": "title", - "type": { - "kind": "base", - "name": "string" - }, - "documentation": "Mandatory title of the progress operation. Used to briefly inform about\nthe kind of operation being performed.\n\nExamples: \"Indexing\" or \"Linking dependencies\"." - }, - { - "name": "cancellable", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "Controls if a cancel button should show to allow the user to cancel the\nlong running operation. Clients that don't support cancellation are allowed\nto ignore the setting." - }, - { - "name": "message", - "type": { - "kind": "base", - "name": "string" - }, - "optional": true, - "documentation": "Optional, more detailed associated progress message. Contains\ncomplementary information to the `title`.\n\nExamples: \"3/25 files\", \"project/src/module2\", \"node_modules/some_dep\".\nIf unset, the previous progress message (if any) is still valid." - }, - { - "name": "percentage", - "type": { - "kind": "base", - "name": "uinteger" - }, - "optional": true, - "documentation": "Optional progress percentage to display (value 100 is considered 100%).\nIf not provided infinite progress is assumed and clients are allowed\nto ignore the `percentage` value in subsequent in report notifications.\n\nThe value should be steadily rising. Clients are free to ignore values\nthat are not following this rule. The value range is [0, 100]." - } - ] - }, - { - "name": "WorkDoneProgressReport", - "properties": [ - { - "name": "kind", - "type": { - "kind": "stringLiteral", - "value": "report" - } - }, - { - "name": "cancellable", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "Controls enablement state of a cancel button.\n\nClients that don't support cancellation or don't support controlling the button's\nenablement state are allowed to ignore the property." - }, - { - "name": "message", - "type": { - "kind": "base", - "name": "string" - }, - "optional": true, - "documentation": "Optional, more detailed associated progress message. Contains\ncomplementary information to the `title`.\n\nExamples: \"3/25 files\", \"project/src/module2\", \"node_modules/some_dep\".\nIf unset, the previous progress message (if any) is still valid." - }, - { - "name": "percentage", - "type": { - "kind": "base", - "name": "uinteger" - }, - "optional": true, - "documentation": "Optional progress percentage to display (value 100 is considered 100%).\nIf not provided infinite progress is assumed and clients are allowed\nto ignore the `percentage` value in subsequent in report notifications.\n\nThe value should be steadily rising. Clients are free to ignore values\nthat are not following this rule. The value range is [0, 100]" - } - ] - }, - { - "name": "WorkDoneProgressEnd", - "properties": [ - { - "name": "kind", - "type": { - "kind": "stringLiteral", - "value": "end" - } - }, - { - "name": "message", - "type": { - "kind": "base", - "name": "string" - }, - "optional": true, - "documentation": "Optional, a final message indicating to for example indicate the outcome\nof the operation." - } - ] - }, - { - "name": "SetTraceParams", - "properties": [ - { - "name": "value", - "type": { - "kind": "reference", - "name": "TraceValues" - } - } - ] - }, - { - "name": "LogTraceParams", - "properties": [ - { - "name": "message", - "type": { - "kind": "base", - "name": "string" - } - }, - { - "name": "verbose", - "type": { - "kind": "base", - "name": "string" - }, - "optional": true - } - ] - }, - { - "name": "CancelParams", - "properties": [ - { - "name": "id", - "type": { - "kind": "or", - "items": [ - { - "kind": "base", - "name": "integer" - }, - { - "kind": "base", - "name": "string" - } - ] - }, - "documentation": "The request id to cancel." - } - ] - }, - { - "name": "ProgressParams", - "properties": [ - { - "name": "token", - "type": { - "kind": "reference", - "name": "ProgressToken" - }, - "documentation": "The progress token provided by the client or server." - }, - { - "name": "value", - "type": { - "kind": "reference", - "name": "LSPAny" - }, - "documentation": "The progress data." - } - ] - }, - { - "name": "TextDocumentPositionParams", - "properties": [ - { - "name": "textDocument", - "type": { - "kind": "reference", - "name": "TextDocumentIdentifier" - }, - "documentation": "The text document." - }, - { - "name": "position", - "type": { - "kind": "reference", - "name": "Position" - }, - "documentation": "The position inside the text document." - } - ], - "documentation": "A parameter literal used in requests to pass a text document and a position inside that\ndocument." - }, - { - "name": "WorkDoneProgressParams", - "properties": [ - { - "name": "workDoneToken", - "type": { - "kind": "reference", - "name": "ProgressToken" - }, - "optional": true, - "documentation": "An optional token that a server can use to report work done progress." - } - ] - }, - { - "name": "LocationLink", - "properties": [ - { - "name": "originSelectionRange", - "type": { - "kind": "reference", - "name": "Range" - }, - "optional": true, - "documentation": "Span of the origin of this link.\n\nUsed as the underlined span for mouse interaction. Defaults to the word range at\nthe definition position." - }, - { - "name": "targetUri", - "type": { - "kind": "base", - "name": "DocumentUri" - }, - "documentation": "The target resource identifier of this link." - }, - { - "name": "targetRange", - "type": { - "kind": "reference", - "name": "Range" - }, - "documentation": "The full target range of this link. If the target for example is a symbol then target range is the\nrange enclosing this symbol not including leading/trailing whitespace but everything else\nlike comments. This information is typically used to highlight the range in the editor." - }, - { - "name": "targetSelectionRange", - "type": { - "kind": "reference", - "name": "Range" - }, - "documentation": "The range that should be selected and revealed when this link is being followed, e.g the name of a function.\nMust be contained by the `targetRange`. See also `DocumentSymbol#range`" - } - ], - "documentation": "Represents the connection of two locations. Provides additional metadata over normal [locations](#Location),\nincluding an origin range." - }, - { - "name": "Range", - "properties": [ - { - "name": "start", - "type": { - "kind": "reference", - "name": "Position" - }, - "documentation": "The range's start position." - }, - { - "name": "end", - "type": { - "kind": "reference", - "name": "Position" - }, - "documentation": "The range's end position." - } - ], - "documentation": "A range in a text document expressed as (zero-based) start and end positions.\n\nIf you want to specify a range that contains a line including the line ending\ncharacter(s) then use an end position denoting the start of the next line.\nFor example:\n```ts\n{\n start: { line: 5, character: 23 }\n end : { line 6, character : 0 }\n}\n```" - }, - { - "name": "ImplementationOptions", - "properties": [], - "mixins": [ - { - "kind": "reference", - "name": "WorkDoneProgressOptions" - } - ] - }, - { - "name": "StaticRegistrationOptions", - "properties": [ - { - "name": "id", - "type": { - "kind": "base", - "name": "string" - }, - "optional": true, - "documentation": "The id used to register the request. The id can be used to deregister\nthe request again. See also Registration#id." - } - ], - "documentation": "Static registration options to be returned in the initialize\nrequest." - }, - { - "name": "TypeDefinitionOptions", - "properties": [], - "mixins": [ - { - "kind": "reference", - "name": "WorkDoneProgressOptions" - } - ] - }, - { - "name": "WorkspaceFoldersChangeEvent", - "properties": [ - { - "name": "added", - "type": { - "kind": "array", - "element": { - "kind": "reference", - "name": "WorkspaceFolder" - } - }, - "documentation": "The array of added workspace folders" - }, - { - "name": "removed", - "type": { - "kind": "array", - "element": { - "kind": "reference", - "name": "WorkspaceFolder" - } - }, - "documentation": "The array of the removed workspace folders" - } - ], - "documentation": "The workspace folder change event." - }, - { - "name": "ConfigurationItem", - "properties": [ - { - "name": "scopeUri", - "type": { - "kind": "base", - "name": "string" - }, - "optional": true, - "documentation": "The scope to get the configuration section for." - }, - { - "name": "section", - "type": { - "kind": "base", - "name": "string" - }, - "optional": true, - "documentation": "The configuration section asked for." - } - ] - }, - { - "name": "TextDocumentIdentifier", - "properties": [ - { - "name": "uri", - "type": { - "kind": "base", - "name": "DocumentUri" - }, - "documentation": "The text document's uri." - } - ], - "documentation": "A literal to identify a text document in the client." - }, - { - "name": "Color", - "properties": [ - { - "name": "red", - "type": { - "kind": "base", - "name": "decimal" - }, - "documentation": "The red component of this color in the range [0-1]." - }, - { - "name": "green", - "type": { - "kind": "base", - "name": "decimal" - }, - "documentation": "The green component of this color in the range [0-1]." - }, - { - "name": "blue", - "type": { - "kind": "base", - "name": "decimal" - }, - "documentation": "The blue component of this color in the range [0-1]." - }, - { - "name": "alpha", - "type": { - "kind": "base", - "name": "decimal" - }, - "documentation": "The alpha component of this color in the range [0-1]." - } - ], - "documentation": "Represents a color in RGBA space." - }, - { - "name": "DocumentColorOptions", - "properties": [], - "mixins": [ - { - "kind": "reference", - "name": "WorkDoneProgressOptions" - } - ] - }, - { - "name": "FoldingRangeOptions", - "properties": [], - "mixins": [ - { - "kind": "reference", - "name": "WorkDoneProgressOptions" - } - ] - }, - { - "name": "DeclarationOptions", - "properties": [], - "mixins": [ - { - "kind": "reference", - "name": "WorkDoneProgressOptions" - } - ] - }, - { - "name": "Position", - "properties": [ - { - "name": "line", - "type": { - "kind": "base", - "name": "uinteger" - }, - "documentation": "Line position in a document (zero-based).\n\nIf a line number is greater than the number of lines in a document, it defaults back to the number of lines in the document.\nIf a line number is negative, it defaults to 0." - }, - { - "name": "character", - "type": { - "kind": "base", - "name": "uinteger" - }, - "documentation": "Character offset on a line in a document (zero-based).\n\nThe meaning of this offset is determined by the negotiated\n`PositionEncodingKind`.\n\nIf the character value is greater than the line length it defaults back to the\nline length." - } - ], - "documentation": "Position in a text document expressed as zero-based line and character\noffset. Prior to 3.17 the offsets were always based on a UTF-16 string\nrepresentation. So a string of the form `a𐐀b` the character offset of the\ncharacter `a` is 0, the character offset of `𐐀` is 1 and the character\noffset of b is 3 since `𐐀` is represented using two code units in UTF-16.\nSince 3.17 clients and servers can agree on a different string encoding\nrepresentation (e.g. UTF-8). The client announces it's supported encoding\nvia the client capability [`general.positionEncodings`](#clientCapabilities).\nThe value is an array of position encodings the client supports, with\ndecreasing preference (e.g. the encoding at index `0` is the most preferred\none). To stay backwards compatible the only mandatory encoding is UTF-16\nrepresented via the string `utf-16`. The server can pick one of the\nencodings offered by the client and signals that encoding back to the\nclient via the initialize result's property\n[`capabilities.positionEncoding`](#serverCapabilities). If the string value\n`utf-16` is missing from the client's capability `general.positionEncodings`\nservers can safely assume that the client supports UTF-16. If the server\nomits the position encoding in its initialize result the encoding defaults\nto the string value `utf-16`. Implementation considerations: since the\nconversion from one encoding into another requires the content of the\nfile / line the conversion is best done where the file is read which is\nusually on the server side.\n\nPositions are line end character agnostic. So you can not specify a position\nthat denotes `\\r|\\n` or `\\n|` where `|` represents the character offset.\n\n@since 3.17.0 - support for negotiated position encoding.", - "since": "3.17.0 - support for negotiated position encoding." - }, - { - "name": "SelectionRangeOptions", - "properties": [], - "mixins": [ - { - "kind": "reference", - "name": "WorkDoneProgressOptions" - } - ] - }, - { - "name": "CallHierarchyOptions", - "properties": [], - "mixins": [ - { - "kind": "reference", - "name": "WorkDoneProgressOptions" - } - ], - "documentation": "Call hierarchy options used during static registration.\n\n@since 3.16.0", - "since": "3.16.0" - }, - { - "name": "SemanticTokensOptions", - "properties": [ - { - "name": "legend", - "type": { - "kind": "reference", - "name": "SemanticTokensLegend" - }, - "documentation": "The legend used by the server" - }, - { - "name": "range", - "type": { - "kind": "or", - "items": [ - { - "kind": "base", - "name": "boolean" - }, - { - "kind": "literal", - "value": { - "properties": [] - } - } - ] - }, - "optional": true, - "documentation": "Server supports providing semantic tokens for a specific range\nof a document." - }, - { - "name": "full", - "type": { - "kind": "or", - "items": [ - { - "kind": "base", - "name": "boolean" - }, - { - "kind": "literal", - "value": { - "properties": [ - { - "name": "delta", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "The server supports deltas for full documents." - } - ] - } - } - ] - }, - "optional": true, - "documentation": "Server supports providing semantic tokens for a full document." - } - ], - "mixins": [ - { - "kind": "reference", - "name": "WorkDoneProgressOptions" - } - ], - "documentation": "@since 3.16.0", - "since": "3.16.0" - }, - { - "name": "SemanticTokensEdit", - "properties": [ - { - "name": "start", - "type": { - "kind": "base", - "name": "uinteger" - }, - "documentation": "The start offset of the edit." - }, - { - "name": "deleteCount", - "type": { - "kind": "base", - "name": "uinteger" - }, - "documentation": "The count of elements to remove." - }, - { - "name": "data", - "type": { - "kind": "array", - "element": { - "kind": "base", - "name": "uinteger" - } - }, - "optional": true, - "documentation": "The elements to insert." - } - ], - "documentation": "@since 3.16.0", - "since": "3.16.0" - }, - { - "name": "LinkedEditingRangeOptions", - "properties": [], - "mixins": [ - { - "kind": "reference", - "name": "WorkDoneProgressOptions" - } - ] - }, - { - "name": "FileCreate", - "properties": [ - { - "name": "uri", - "type": { - "kind": "base", - "name": "string" - }, - "documentation": "A file:// URI for the location of the file/folder being created." - } - ], - "documentation": "Represents information on a file/folder create.\n\n@since 3.16.0", - "since": "3.16.0" - }, - { - "name": "TextDocumentEdit", - "properties": [ - { - "name": "textDocument", - "type": { - "kind": "reference", - "name": "OptionalVersionedTextDocumentIdentifier" - }, - "documentation": "The text document to change." - }, - { - "name": "edits", - "type": { - "kind": "array", - "element": { - "kind": "or", - "items": [ - { - "kind": "reference", - "name": "TextEdit" - }, - { - "kind": "reference", - "name": "AnnotatedTextEdit" - } - ] - } - }, - "documentation": "The edits to be applied.\n\n@since 3.16.0 - support for AnnotatedTextEdit. This is guarded using a\nclient capability.", - "since": "3.16.0 - support for AnnotatedTextEdit. This is guarded using a\nclient capability." - } - ], - "documentation": "Describes textual changes on a text document. A TextDocumentEdit describes all changes\non a document version Si and after they are applied move the document to version Si+1.\nSo the creator of a TextDocumentEdit doesn't need to sort the array of edits or do any\nkind of ordering. However the edits must be non overlapping." - }, - { - "name": "CreateFile", - "properties": [ - { - "name": "kind", - "type": { - "kind": "stringLiteral", - "value": "create" - }, - "documentation": "A create" - }, - { - "name": "uri", - "type": { - "kind": "base", - "name": "DocumentUri" - }, - "documentation": "The resource to create." - }, - { - "name": "options", - "type": { - "kind": "reference", - "name": "CreateFileOptions" - }, - "optional": true, - "documentation": "Additional options" - } - ], - "extends": [ - { - "kind": "reference", - "name": "ResourceOperation" - } - ], - "documentation": "Create file operation." - }, - { - "name": "RenameFile", - "properties": [ - { - "name": "kind", - "type": { - "kind": "stringLiteral", - "value": "rename" - }, - "documentation": "A rename" - }, - { - "name": "oldUri", - "type": { - "kind": "base", - "name": "DocumentUri" - }, - "documentation": "The old (existing) location." - }, - { - "name": "newUri", - "type": { - "kind": "base", - "name": "DocumentUri" - }, - "documentation": "The new location." - }, - { - "name": "options", - "type": { - "kind": "reference", - "name": "RenameFileOptions" - }, - "optional": true, - "documentation": "Rename options." - } - ], - "extends": [ - { - "kind": "reference", - "name": "ResourceOperation" - } - ], - "documentation": "Rename file operation" - }, - { - "name": "DeleteFile", - "properties": [ - { - "name": "kind", - "type": { - "kind": "stringLiteral", - "value": "delete" - }, - "documentation": "A delete" - }, - { - "name": "uri", - "type": { - "kind": "base", - "name": "DocumentUri" - }, - "documentation": "The file to delete." - }, - { - "name": "options", - "type": { - "kind": "reference", - "name": "DeleteFileOptions" - }, - "optional": true, - "documentation": "Delete options." - } - ], - "extends": [ - { - "kind": "reference", - "name": "ResourceOperation" - } - ], - "documentation": "Delete file operation" - }, - { - "name": "ChangeAnnotation", - "properties": [ - { - "name": "label", - "type": { - "kind": "base", - "name": "string" - }, - "documentation": "A human-readable string describing the actual change. The string\nis rendered prominent in the user interface." - }, - { - "name": "needsConfirmation", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "A flag which indicates that user confirmation is needed\nbefore applying the change." - }, - { - "name": "description", - "type": { - "kind": "base", - "name": "string" - }, - "optional": true, - "documentation": "A human-readable string which is rendered less prominent in\nthe user interface." - } - ], - "documentation": "Additional information that describes document changes.\n\n@since 3.16.0", - "since": "3.16.0" - }, - { - "name": "FileOperationFilter", - "properties": [ - { - "name": "scheme", - "type": { - "kind": "base", - "name": "string" - }, - "optional": true, - "documentation": "A Uri scheme like `file` or `untitled`." - }, - { - "name": "pattern", - "type": { - "kind": "reference", - "name": "FileOperationPattern" - }, - "documentation": "The actual file operation pattern." - } - ], - "documentation": "A filter to describe in which file operation requests or notifications\nthe server is interested in receiving.\n\n@since 3.16.0", - "since": "3.16.0" - }, - { - "name": "FileRename", - "properties": [ - { - "name": "oldUri", - "type": { - "kind": "base", - "name": "string" - }, - "documentation": "A file:// URI for the original location of the file/folder being renamed." - }, - { - "name": "newUri", - "type": { - "kind": "base", - "name": "string" - }, - "documentation": "A file:// URI for the new location of the file/folder being renamed." - } - ], - "documentation": "Represents information on a file/folder rename.\n\n@since 3.16.0", - "since": "3.16.0" - }, - { - "name": "FileDelete", - "properties": [ - { - "name": "uri", - "type": { - "kind": "base", - "name": "string" - }, - "documentation": "A file:// URI for the location of the file/folder being deleted." - } - ], - "documentation": "Represents information on a file/folder delete.\n\n@since 3.16.0", - "since": "3.16.0" - }, - { - "name": "MonikerOptions", - "properties": [], - "mixins": [ - { - "kind": "reference", - "name": "WorkDoneProgressOptions" - } - ] - }, - { - "name": "TypeHierarchyOptions", - "mixins": [ - { - "kind": "reference", - "name": "WorkDoneProgressOptions" - } - ], - "properties": [], - "documentation": "Type hierarchy options used during static registration.\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "name": "InlineValueContext", - "properties": [ - { - "name": "frameId", - "type": { - "kind": "base", - "name": "integer" - }, - "documentation": "The stack frame (as a DAP Id) where the execution has stopped." - }, - { - "name": "stoppedLocation", - "type": { - "kind": "reference", - "name": "Range" - }, - "documentation": "The document range where execution has stopped.\nTypically the end position of the range denotes the line where the inline values are shown." - } - ], - "documentation": "@since 3.17.0", - "since": "3.17.0" - }, - { - "name": "InlineValueText", - "properties": [ - { - "name": "range", - "type": { - "kind": "reference", - "name": "Range" - }, - "documentation": "The document range for which the inline value applies." - }, - { - "name": "text", - "type": { - "kind": "base", - "name": "string" - }, - "documentation": "The text of the inline value." - } - ], - "documentation": "Provide inline value as text.\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "name": "InlineValueVariableLookup", - "properties": [ - { - "name": "range", - "type": { - "kind": "reference", - "name": "Range" - }, - "documentation": "The document range for which the inline value applies.\nThe range is used to extract the variable name from the underlying document." - }, - { - "name": "variableName", - "type": { - "kind": "base", - "name": "string" - }, - "optional": true, - "documentation": "If specified the name of the variable to look up." - }, - { - "name": "caseSensitiveLookup", - "type": { - "kind": "base", - "name": "boolean" - }, - "documentation": "How to perform the lookup." - } - ], - "documentation": "Provide inline value through a variable lookup.\nIf only a range is specified, the variable name will be extracted from the underlying document.\nAn optional variable name can be used to override the extracted name.\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "name": "InlineValueEvaluatableExpression", - "properties": [ - { - "name": "range", - "type": { - "kind": "reference", - "name": "Range" - }, - "documentation": "The document range for which the inline value applies.\nThe range is used to extract the evaluatable expression from the underlying document." - }, - { - "name": "expression", - "type": { - "kind": "base", - "name": "string" - }, - "optional": true, - "documentation": "If specified the expression overrides the extracted expression." - } - ], - "documentation": "Provide an inline value through an expression evaluation.\nIf only a range is specified, the expression will be extracted from the underlying document.\nAn optional expression can be used to override the extracted expression.\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "name": "InlineValueOptions", - "mixins": [ - { - "kind": "reference", - "name": "WorkDoneProgressOptions" - } - ], - "properties": [], - "documentation": "Inline value options used during static registration.\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "name": "InlayHintLabelPart", - "properties": [ - { - "name": "value", - "type": { - "kind": "base", - "name": "string" - }, - "documentation": "The value of this label part." - }, - { - "name": "tooltip", - "type": { - "kind": "or", - "items": [ - { - "kind": "base", - "name": "string" - }, - { - "kind": "reference", - "name": "MarkupContent" - } - ] - }, - "optional": true, - "documentation": "The tooltip text when you hover over this label part. Depending on\nthe client capability `inlayHint.resolveSupport` clients might resolve\nthis property late using the resolve request." - }, - { - "name": "location", - "type": { - "kind": "reference", - "name": "Location" - }, - "optional": true, - "documentation": "An optional source code location that represents this\nlabel part.\n\nThe editor will use this location for the hover and for code navigation\nfeatures: This part will become a clickable link that resolves to the\ndefinition of the symbol at the given location (not necessarily the\nlocation itself), it shows the hover that shows at the given location,\nand it shows a context menu with further code navigation commands.\n\nDepending on the client capability `inlayHint.resolveSupport` clients\nmight resolve this property late using the resolve request." - }, - { - "name": "command", - "type": { - "kind": "reference", - "name": "Command" - }, - "optional": true, - "documentation": "An optional command for this label part.\n\nDepending on the client capability `inlayHint.resolveSupport` clients\nmight resolve this property late using the resolve request." - } - ], - "documentation": "An inlay hint label part allows for interactive and composite labels\nof inlay hints.\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "name": "MarkupContent", - "properties": [ - { - "name": "kind", - "type": { - "kind": "reference", - "name": "MarkupKind" - }, - "documentation": "The type of the Markup" - }, - { - "name": "value", - "type": { - "kind": "base", - "name": "string" - }, - "documentation": "The content itself" - } - ], - "documentation": "A `MarkupContent` literal represents a string value which content is interpreted base on its\nkind flag. Currently the protocol supports `plaintext` and `markdown` as markup kinds.\n\nIf the kind is `markdown` then the value can contain fenced code blocks like in GitHub issues.\nSee https://help.github.com/articles/creating-and-highlighting-code-blocks/#syntax-highlighting\n\nHere is an example how such a string can be constructed using JavaScript / TypeScript:\n```ts\nlet markdown: MarkdownContent = {\n kind: MarkupKind.Markdown,\n value: [\n '# Header',\n 'Some text',\n '```typescript',\n 'someCode();',\n '```'\n ].join('\\n')\n};\n```\n\n*Please Note* that clients might sanitize the return markdown. A client could decide to\nremove HTML from the markdown to avoid script execution." - }, - { - "name": "InlayHintOptions", - "properties": [ - { - "name": "resolveProvider", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "The server provides support to resolve additional\ninformation for an inlay hint item." - } - ], - "mixins": [ - { - "kind": "reference", - "name": "WorkDoneProgressOptions" - } - ], - "documentation": "Inlay hint options used during static registration.\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "name": "RelatedFullDocumentDiagnosticReport", - "properties": [ - { - "name": "relatedDocuments", - "type": { - "kind": "map", - "key": { - "kind": "base", - "name": "DocumentUri" - }, - "value": { - "kind": "or", - "items": [ - { - "kind": "reference", - "name": "FullDocumentDiagnosticReport" - }, - { - "kind": "reference", - "name": "UnchangedDocumentDiagnosticReport" - } - ] - } - }, - "optional": true, - "documentation": "Diagnostics of related documents. This information is useful\nin programming languages where code in a file A can generate\ndiagnostics in a file B which A depends on. An example of\nsuch a language is C/C++ where marco definitions in a file\na.cpp and result in errors in a header file b.hpp.\n\n@since 3.17.0", - "since": "3.17.0" - } - ], - "extends": [ - { - "kind": "reference", - "name": "FullDocumentDiagnosticReport" - } - ], - "documentation": "A full diagnostic report with a set of related documents.\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "name": "RelatedUnchangedDocumentDiagnosticReport", - "properties": [ - { - "name": "relatedDocuments", - "type": { - "kind": "map", - "key": { - "kind": "base", - "name": "DocumentUri" - }, - "value": { - "kind": "or", - "items": [ - { - "kind": "reference", - "name": "FullDocumentDiagnosticReport" - }, - { - "kind": "reference", - "name": "UnchangedDocumentDiagnosticReport" - } - ] - } - }, - "optional": true, - "documentation": "Diagnostics of related documents. This information is useful\nin programming languages where code in a file A can generate\ndiagnostics in a file B which A depends on. An example of\nsuch a language is C/C++ where marco definitions in a file\na.cpp and result in errors in a header file b.hpp.\n\n@since 3.17.0", - "since": "3.17.0" - } - ], - "extends": [ - { - "kind": "reference", - "name": "UnchangedDocumentDiagnosticReport" - } - ], - "documentation": "An unchanged diagnostic report with a set of related documents.\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "name": "FullDocumentDiagnosticReport", - "properties": [ - { - "name": "kind", - "type": { - "kind": "stringLiteral", - "value": "full" - }, - "documentation": "A full document diagnostic report." - }, - { - "name": "resultId", - "type": { - "kind": "base", - "name": "string" - }, - "optional": true, - "documentation": "An optional result id. If provided it will\nbe sent on the next diagnostic request for the\nsame document." - }, - { - "name": "items", - "type": { - "kind": "array", - "element": { - "kind": "reference", - "name": "Diagnostic" - } - }, - "documentation": "The actual items." - } - ], - "documentation": "A diagnostic report with a full set of problems.\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "name": "UnchangedDocumentDiagnosticReport", - "properties": [ - { - "name": "kind", - "type": { - "kind": "stringLiteral", - "value": "unchanged" - }, - "documentation": "A document diagnostic report indicating\nno changes to the last result. A server can\nonly return `unchanged` if result ids are\nprovided." - }, - { - "name": "resultId", - "type": { - "kind": "base", - "name": "string" - }, - "documentation": "A result id which will be sent on the next\ndiagnostic request for the same document." - } - ], - "documentation": "A diagnostic report indicating that the last returned\nreport is still accurate.\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "name": "DiagnosticOptions", - "properties": [ - { - "name": "identifier", - "type": { - "kind": "base", - "name": "string" - }, - "optional": true, - "documentation": "An optional identifier under which the diagnostics are\nmanaged by the client." - }, - { - "name": "interFileDependencies", - "type": { - "kind": "base", - "name": "boolean" - }, - "documentation": "Whether the language has inter file dependencies meaning that\nediting code in one file can result in a different diagnostic\nset in another file. Inter file dependencies are common for\nmost programming languages and typically uncommon for linters." - }, - { - "name": "workspaceDiagnostics", - "type": { - "kind": "base", - "name": "boolean" - }, - "documentation": "The server provides support for workspace diagnostics as well." - } - ], - "mixins": [ - { - "kind": "reference", - "name": "WorkDoneProgressOptions" - } - ], - "documentation": "Diagnostic options.\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "name": "PreviousResultId", - "properties": [ - { - "name": "uri", - "type": { - "kind": "base", - "name": "DocumentUri" - }, - "documentation": "The URI for which the client knowns a\nresult id." - }, - { - "name": "value", - "type": { - "kind": "base", - "name": "string" - }, - "documentation": "The value of the previous result id." - } - ], - "documentation": "A previous result id in a workspace pull request.\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "name": "NotebookDocument", - "properties": [ - { - "name": "uri", - "type": { - "kind": "base", - "name": "URI" - }, - "documentation": "The notebook document's uri." - }, - { - "name": "notebookType", - "type": { - "kind": "base", - "name": "string" - }, - "documentation": "The type of the notebook." - }, - { - "name": "version", - "type": { - "kind": "base", - "name": "integer" - }, - "documentation": "The version number of this document (it will increase after each\nchange, including undo/redo)." - }, - { - "name": "metadata", - "type": { - "kind": "reference", - "name": "LSPObject" - }, - "optional": true, - "documentation": "Additional metadata stored with the notebook\ndocument.\n\nNote: should always be an object literal (e.g. LSPObject)" - }, - { - "name": "cells", - "type": { - "kind": "array", - "element": { - "kind": "reference", - "name": "NotebookCell" - } - }, - "documentation": "The cells of a notebook." - } - ], - "documentation": "A notebook document.\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "name": "TextDocumentItem", - "properties": [ - { - "name": "uri", - "type": { - "kind": "base", - "name": "DocumentUri" - }, - "documentation": "The text document's uri." - }, - { - "name": "languageId", - "type": { - "kind": "base", - "name": "string" - }, - "documentation": "The text document's language identifier." - }, - { - "name": "version", - "type": { - "kind": "base", - "name": "integer" - }, - "documentation": "The version number of this document (it will increase after each\nchange, including undo/redo)." - }, - { - "name": "text", - "type": { - "kind": "base", - "name": "string" - }, - "documentation": "The content of the opened text document." - } - ], - "documentation": "An item to transfer a text document from the client to the\nserver." - }, - { - "name": "VersionedNotebookDocumentIdentifier", - "properties": [ - { - "name": "version", - "type": { - "kind": "base", - "name": "integer" - }, - "documentation": "The version number of this notebook document." - }, - { - "name": "uri", - "type": { - "kind": "base", - "name": "URI" - }, - "documentation": "The notebook document's uri." - } - ], - "documentation": "A versioned notebook document identifier.\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "name": "NotebookDocumentChangeEvent", - "properties": [ - { - "name": "metadata", - "type": { - "kind": "reference", - "name": "LSPObject" - }, - "optional": true, - "documentation": "The changed meta data if any.\n\nNote: should always be an object literal (e.g. LSPObject)" - }, - { - "name": "cells", - "type": { - "kind": "literal", - "value": { - "properties": [ - { - "name": "structure", - "type": { - "kind": "literal", - "value": { - "properties": [ - { - "name": "array", - "type": { - "kind": "reference", - "name": "NotebookCellArrayChange" - }, - "documentation": "The change to the cell array." - }, - { - "name": "didOpen", - "type": { - "kind": "array", - "element": { - "kind": "reference", - "name": "TextDocumentItem" - } - }, - "optional": true, - "documentation": "Additional opened cell text documents." - }, - { - "name": "didClose", - "type": { - "kind": "array", - "element": { - "kind": "reference", - "name": "TextDocumentIdentifier" - } - }, - "optional": true, - "documentation": "Additional closed cell text documents." - } - ] - } - }, - "optional": true, - "documentation": "Changes to the cell structure to add or\nremove cells." - }, - { - "name": "data", - "type": { - "kind": "array", - "element": { - "kind": "reference", - "name": "NotebookCell" - } - }, - "optional": true, - "documentation": "Changes to notebook cells properties like its\nkind, execution summary or metadata." - }, - { - "name": "textContent", - "type": { - "kind": "array", - "element": { - "kind": "literal", - "value": { - "properties": [ - { - "name": "document", - "type": { - "kind": "reference", - "name": "VersionedTextDocumentIdentifier" - } - }, - { - "name": "changes", - "type": { - "kind": "array", - "element": { - "kind": "reference", - "name": "TextDocumentContentChangeEvent" - } - } - } - ] - } - } - }, - "optional": true, - "documentation": "Changes to the text content of notebook cells." - } - ] - } - }, - "optional": true, - "documentation": "Changes to cells" - } - ], - "documentation": "A change event for a notebook document.\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "name": "NotebookDocumentIdentifier", - "properties": [ - { - "name": "uri", - "type": { - "kind": "base", - "name": "URI" - }, - "documentation": "The notebook document's uri." - } - ], - "documentation": "A literal to identify a notebook document in the client.\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "name": "Registration", - "properties": [ - { - "name": "id", - "type": { - "kind": "base", - "name": "string" - }, - "documentation": "The id used to register the request. The id can be used to deregister\nthe request again." - }, - { - "name": "method", - "type": { - "kind": "base", - "name": "string" - }, - "documentation": "The method / capability to register for." - }, - { - "name": "registerOptions", - "type": { - "kind": "reference", - "name": "LSPAny" - }, - "optional": true, - "documentation": "Options necessary for the registration." - } - ], - "documentation": "General parameters to to register for an notification or to register a provider." - }, - { - "name": "Unregistration", - "properties": [ - { - "name": "id", - "type": { - "kind": "base", - "name": "string" - }, - "documentation": "The id used to unregister the request or notification. Usually an id\nprovided during the register request." - }, - { - "name": "method", - "type": { - "kind": "base", - "name": "string" - }, - "documentation": "The method to unregister for." - } - ], - "documentation": "General parameters to unregister a request or notification." - }, - { - "name": "_InitializeParams", - "properties": [ - { - "name": "processId", - "type": { - "kind": "or", - "items": [ - { - "kind": "base", - "name": "integer" - }, - { - "kind": "base", - "name": "null" - } - ] - }, - "documentation": "The process Id of the parent process that started\nthe server.\n\nIs `null` if the process has not been started by another process.\nIf the parent process is not alive then the server should exit." - }, - { - "name": "clientInfo", - "type": { - "kind": "literal", - "value": { - "properties": [ - { - "name": "name", - "type": { - "kind": "base", - "name": "string" - }, - "documentation": "The name of the client as defined by the client." - }, - { - "name": "version", - "type": { - "kind": "base", - "name": "string" - }, - "optional": true, - "documentation": "The client's version as defined by the client." - } - ] - } - }, - "optional": true, - "documentation": "Information about the client\n\n@since 3.15.0", - "since": "3.15.0" - }, - { - "name": "locale", - "type": { - "kind": "base", - "name": "string" - }, - "optional": true, - "documentation": "The locale the client is currently showing the user interface\nin. This must not necessarily be the locale of the operating\nsystem.\n\nUses IETF language tags as the value's syntax\n(See https://en.wikipedia.org/wiki/IETF_language_tag)\n\n@since 3.16.0", - "since": "3.16.0" - }, - { - "name": "rootPath", - "type": { - "kind": "or", - "items": [ - { - "kind": "base", - "name": "string" - }, - { - "kind": "base", - "name": "null" - } - ] - }, - "optional": true, - "documentation": "The rootPath of the workspace. Is null\nif no folder is open.\n\n@deprecated in favour of rootUri." - }, - { - "name": "rootUri", - "type": { - "kind": "or", - "items": [ - { - "kind": "base", - "name": "DocumentUri" - }, - { - "kind": "base", - "name": "null" - } - ] - }, - "documentation": "The rootUri of the workspace. Is null if no\nfolder is open. If both `rootPath` and `rootUri` are set\n`rootUri` wins.\n\n@deprecated in favour of workspaceFolders." - }, - { - "name": "capabilities", - "type": { - "kind": "reference", - "name": "ClientCapabilities" - }, - "documentation": "The capabilities provided by the client (editor or tool)" - }, - { - "name": "initializationOptions", - "type": { - "kind": "reference", - "name": "LSPAny" - }, - "optional": true, - "documentation": "User provided initialization options." - }, - { - "name": "trace", - "type": { - "kind": "or", - "items": [ - { - "kind": "stringLiteral", - "value": "off" - }, - { - "kind": "stringLiteral", - "value": "messages" - }, - { - "kind": "stringLiteral", - "value": "compact" - }, - { - "kind": "stringLiteral", - "value": "verbose" - } - ] - }, - "optional": true, - "documentation": "The initial trace setting. If omitted trace is disabled ('off')." - } - ], - "mixins": [ - { - "kind": "reference", - "name": "WorkDoneProgressParams" - } - ], - "documentation": "The initialize parameters" - }, - { - "name": "WorkspaceFoldersInitializeParams", - "properties": [ - { - "name": "workspaceFolders", - "type": { - "kind": "or", - "items": [ - { - "kind": "array", - "element": { - "kind": "reference", - "name": "WorkspaceFolder" - } - }, - { - "kind": "base", - "name": "null" - } - ] - }, - "optional": true, - "documentation": "The workspace folders configured in the client when the server starts.\n\nThis property is only available if the client supports workspace folders.\nIt can be `null` if the client supports workspace folders but none are\nconfigured.\n\n@since 3.6.0", - "since": "3.6.0" - } - ] - }, - { - "name": "ServerCapabilities", - "properties": [ - { - "name": "positionEncoding", - "type": { - "kind": "reference", - "name": "PositionEncodingKind" - }, - "optional": true, - "documentation": "The position encoding the server picked from the encodings offered\nby the client via the client capability `general.positionEncodings`.\n\nIf the client didn't provide any position encodings the only valid\nvalue that a server can return is 'utf-16'.\n\nIf omitted it defaults to 'utf-16'.\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "name": "textDocumentSync", - "type": { - "kind": "or", - "items": [ - { - "kind": "reference", - "name": "TextDocumentSyncOptions" - }, - { - "kind": "reference", - "name": "TextDocumentSyncKind" - } - ] - }, - "optional": true, - "documentation": "Defines how text documents are synced. Is either a detailed structure\ndefining each notification or for backwards compatibility the\nTextDocumentSyncKind number." - }, - { - "name": "notebookDocumentSync", - "type": { - "kind": "or", - "items": [ - { - "kind": "reference", - "name": "NotebookDocumentSyncOptions" - }, - { - "kind": "reference", - "name": "NotebookDocumentSyncRegistrationOptions" - } - ] - }, - "optional": true, - "documentation": "Defines how notebook documents are synced.\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "name": "completionProvider", - "type": { - "kind": "reference", - "name": "CompletionOptions" - }, - "optional": true, - "documentation": "The server provides completion support." - }, - { - "name": "hoverProvider", - "type": { - "kind": "or", - "items": [ - { - "kind": "base", - "name": "boolean" - }, - { - "kind": "reference", - "name": "HoverOptions" - } - ] - }, - "optional": true, - "documentation": "The server provides hover support." - }, - { - "name": "signatureHelpProvider", - "type": { - "kind": "reference", - "name": "SignatureHelpOptions" - }, - "optional": true, - "documentation": "The server provides signature help support." - }, - { - "name": "declarationProvider", - "type": { - "kind": "or", - "items": [ - { - "kind": "base", - "name": "boolean" - }, - { - "kind": "reference", - "name": "DeclarationOptions" - }, - { - "kind": "reference", - "name": "DeclarationRegistrationOptions" - } - ] - }, - "optional": true, - "documentation": "The server provides Goto Declaration support." - }, - { - "name": "definitionProvider", - "type": { - "kind": "or", - "items": [ - { - "kind": "base", - "name": "boolean" - }, - { - "kind": "reference", - "name": "DefinitionOptions" - } - ] - }, - "optional": true, - "documentation": "The server provides goto definition support." - }, - { - "name": "typeDefinitionProvider", - "type": { - "kind": "or", - "items": [ - { - "kind": "base", - "name": "boolean" - }, - { - "kind": "reference", - "name": "TypeDefinitionOptions" - }, - { - "kind": "reference", - "name": "TypeDefinitionRegistrationOptions" - } - ] - }, - "optional": true, - "documentation": "The server provides Goto Type Definition support." - }, - { - "name": "implementationProvider", - "type": { - "kind": "or", - "items": [ - { - "kind": "base", - "name": "boolean" - }, - { - "kind": "reference", - "name": "ImplementationOptions" - }, - { - "kind": "reference", - "name": "ImplementationRegistrationOptions" - } - ] - }, - "optional": true, - "documentation": "The server provides Goto Implementation support." - }, - { - "name": "referencesProvider", - "type": { - "kind": "or", - "items": [ - { - "kind": "base", - "name": "boolean" - }, - { - "kind": "reference", - "name": "ReferenceOptions" - } - ] - }, - "optional": true, - "documentation": "The server provides find references support." - }, - { - "name": "documentHighlightProvider", - "type": { - "kind": "or", - "items": [ - { - "kind": "base", - "name": "boolean" - }, - { - "kind": "reference", - "name": "DocumentHighlightOptions" - } - ] - }, - "optional": true, - "documentation": "The server provides document highlight support." - }, - { - "name": "documentSymbolProvider", - "type": { - "kind": "or", - "items": [ - { - "kind": "base", - "name": "boolean" - }, - { - "kind": "reference", - "name": "DocumentSymbolOptions" - } - ] - }, - "optional": true, - "documentation": "The server provides document symbol support." - }, - { - "name": "codeActionProvider", - "type": { - "kind": "or", - "items": [ - { - "kind": "base", - "name": "boolean" - }, - { - "kind": "reference", - "name": "CodeActionOptions" - } - ] - }, - "optional": true, - "documentation": "The server provides code actions. CodeActionOptions may only be\nspecified if the client states that it supports\n`codeActionLiteralSupport` in its initial `initialize` request." - }, - { - "name": "codeLensProvider", - "type": { - "kind": "reference", - "name": "CodeLensOptions" - }, - "optional": true, - "documentation": "The server provides code lens." - }, - { - "name": "documentLinkProvider", - "type": { - "kind": "reference", - "name": "DocumentLinkOptions" - }, - "optional": true, - "documentation": "The server provides document link support." - }, - { - "name": "colorProvider", - "type": { - "kind": "or", - "items": [ - { - "kind": "base", - "name": "boolean" - }, - { - "kind": "reference", - "name": "DocumentColorOptions" - }, - { - "kind": "reference", - "name": "DocumentColorRegistrationOptions" - } - ] - }, - "optional": true, - "documentation": "The server provides color provider support." - }, - { - "name": "workspaceSymbolProvider", - "type": { - "kind": "or", - "items": [ - { - "kind": "base", - "name": "boolean" - }, - { - "kind": "reference", - "name": "WorkspaceSymbolOptions" - } - ] - }, - "optional": true, - "documentation": "The server provides workspace symbol support." - }, - { - "name": "documentFormattingProvider", - "type": { - "kind": "or", - "items": [ - { - "kind": "base", - "name": "boolean" - }, - { - "kind": "reference", - "name": "DocumentFormattingOptions" - } - ] - }, - "optional": true, - "documentation": "The server provides document formatting." - }, - { - "name": "documentRangeFormattingProvider", - "type": { - "kind": "or", - "items": [ - { - "kind": "base", - "name": "boolean" - }, - { - "kind": "reference", - "name": "DocumentRangeFormattingOptions" - } - ] - }, - "optional": true, - "documentation": "The server provides document range formatting." - }, - { - "name": "documentOnTypeFormattingProvider", - "type": { - "kind": "reference", - "name": "DocumentOnTypeFormattingOptions" - }, - "optional": true, - "documentation": "The server provides document formatting on typing." - }, - { - "name": "renameProvider", - "type": { - "kind": "or", - "items": [ - { - "kind": "base", - "name": "boolean" - }, - { - "kind": "reference", - "name": "RenameOptions" - } - ] - }, - "optional": true, - "documentation": "The server provides rename support. RenameOptions may only be\nspecified if the client states that it supports\n`prepareSupport` in its initial `initialize` request." - }, - { - "name": "foldingRangeProvider", - "type": { - "kind": "or", - "items": [ - { - "kind": "base", - "name": "boolean" - }, - { - "kind": "reference", - "name": "FoldingRangeOptions" - }, - { - "kind": "reference", - "name": "FoldingRangeRegistrationOptions" - } - ] - }, - "optional": true, - "documentation": "The server provides folding provider support." - }, - { - "name": "selectionRangeProvider", - "type": { - "kind": "or", - "items": [ - { - "kind": "base", - "name": "boolean" - }, - { - "kind": "reference", - "name": "SelectionRangeOptions" - }, - { - "kind": "reference", - "name": "SelectionRangeRegistrationOptions" - } - ] - }, - "optional": true, - "documentation": "The server provides selection range support." - }, - { - "name": "executeCommandProvider", - "type": { - "kind": "reference", - "name": "ExecuteCommandOptions" - }, - "optional": true, - "documentation": "The server provides execute command support." - }, - { - "name": "callHierarchyProvider", - "type": { - "kind": "or", - "items": [ - { - "kind": "base", - "name": "boolean" - }, - { - "kind": "reference", - "name": "CallHierarchyOptions" - }, - { - "kind": "reference", - "name": "CallHierarchyRegistrationOptions" - } - ] - }, - "optional": true, - "documentation": "The server provides call hierarchy support.\n\n@since 3.16.0", - "since": "3.16.0" - }, - { - "name": "linkedEditingRangeProvider", - "type": { - "kind": "or", - "items": [ - { - "kind": "base", - "name": "boolean" - }, - { - "kind": "reference", - "name": "LinkedEditingRangeOptions" - }, - { - "kind": "reference", - "name": "LinkedEditingRangeRegistrationOptions" - } - ] - }, - "optional": true, - "documentation": "The server provides linked editing range support.\n\n@since 3.16.0", - "since": "3.16.0" - }, - { - "name": "semanticTokensProvider", - "type": { - "kind": "or", - "items": [ - { - "kind": "reference", - "name": "SemanticTokensOptions" - }, - { - "kind": "reference", - "name": "SemanticTokensRegistrationOptions" - } - ] - }, - "optional": true, - "documentation": "The server provides semantic tokens support.\n\n@since 3.16.0", - "since": "3.16.0" - }, - { - "name": "monikerProvider", - "type": { - "kind": "or", - "items": [ - { - "kind": "base", - "name": "boolean" - }, - { - "kind": "reference", - "name": "MonikerOptions" - }, - { - "kind": "reference", - "name": "MonikerRegistrationOptions" - } - ] - }, - "optional": true, - "documentation": "The server provides moniker support.\n\n@since 3.16.0", - "since": "3.16.0" - }, - { - "name": "typeHierarchyProvider", - "type": { - "kind": "or", - "items": [ - { - "kind": "base", - "name": "boolean" - }, - { - "kind": "reference", - "name": "TypeHierarchyOptions" - }, - { - "kind": "reference", - "name": "TypeHierarchyRegistrationOptions" - } - ] - }, - "optional": true, - "documentation": "The server provides type hierarchy support.\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "name": "inlineValueProvider", - "type": { - "kind": "or", - "items": [ - { - "kind": "base", - "name": "boolean" - }, - { - "kind": "reference", - "name": "InlineValueOptions" - }, - { - "kind": "reference", - "name": "InlineValueRegistrationOptions" - } - ] - }, - "optional": true, - "documentation": "The server provides inline values.\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "name": "inlayHintProvider", - "type": { - "kind": "or", - "items": [ - { - "kind": "base", - "name": "boolean" - }, - { - "kind": "reference", - "name": "InlayHintOptions" - }, - { - "kind": "reference", - "name": "InlayHintRegistrationOptions" - } - ] - }, - "optional": true, - "documentation": "The server provides inlay hints.\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "name": "diagnosticProvider", - "type": { - "kind": "or", - "items": [ - { - "kind": "reference", - "name": "DiagnosticOptions" - }, - { - "kind": "reference", - "name": "DiagnosticRegistrationOptions" - } - ] - }, - "optional": true, - "documentation": "The server has support for pull model diagnostics.\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "name": "workspace", - "type": { - "kind": "literal", - "value": { - "properties": [ - { - "name": "workspaceFolders", - "type": { - "kind": "reference", - "name": "WorkspaceFoldersServerCapabilities" - }, - "optional": true, - "documentation": "The server supports workspace folder.\n\n@since 3.6.0", - "since": "3.6.0" - }, - { - "name": "fileOperations", - "type": { - "kind": "reference", - "name": "FileOperationOptions" - }, - "optional": true, - "documentation": "The server is interested in notifications/requests for operations on files.\n\n@since 3.16.0", - "since": "3.16.0" - } - ] - } - }, - "optional": true, - "documentation": "Workspace specific server capabilities." - }, - { - "name": "experimental", - "type": { - "kind": "reference", - "name": "LSPAny" - }, - "optional": true, - "documentation": "Experimental server capabilities." - } - ], - "documentation": "Defines the capabilities provided by a language\nserver." - }, - { - "name": "VersionedTextDocumentIdentifier", - "properties": [ - { - "name": "version", - "type": { - "kind": "base", - "name": "integer" - }, - "documentation": "The version number of this document." - } - ], - "extends": [ - { - "kind": "reference", - "name": "TextDocumentIdentifier" - } - ], - "documentation": "A text document identifier to denote a specific version of a text document." - }, - { - "name": "SaveOptions", - "properties": [ - { - "name": "includeText", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "The client is supposed to include the content on save." - } - ], - "documentation": "Save options." - }, - { - "name": "FileEvent", - "properties": [ - { - "name": "uri", - "type": { - "kind": "base", - "name": "DocumentUri" - }, - "documentation": "The file's uri." - }, - { - "name": "type", - "type": { - "kind": "reference", - "name": "FileChangeType" - }, - "documentation": "The change type." - } - ], - "documentation": "An event describing a file change." - }, - { - "name": "FileSystemWatcher", - "properties": [ - { - "name": "globPattern", - "type": { - "kind": "reference", - "name": "GlobPattern" - }, - "documentation": "The glob pattern to watch. See {@link GlobPattern glob pattern} for more detail.\n\n@since 3.17.0 support for relative patterns.", - "since": "3.17.0 support for relative patterns." - }, - { - "name": "kind", - "type": { - "kind": "reference", - "name": "WatchKind" - }, - "optional": true, - "documentation": "The kind of events of interest. If omitted it defaults\nto WatchKind.Create | WatchKind.Change | WatchKind.Delete\nwhich is 7." - } - ] - }, - { - "name": "Diagnostic", - "properties": [ - { - "name": "range", - "type": { - "kind": "reference", - "name": "Range" - }, - "documentation": "The range at which the message applies" - }, - { - "name": "severity", - "type": { - "kind": "reference", - "name": "DiagnosticSeverity" - }, - "optional": true, - "documentation": "The diagnostic's severity. Can be omitted. If omitted it is up to the\nclient to interpret diagnostics as error, warning, info or hint." - }, - { - "name": "code", - "type": { - "kind": "or", - "items": [ - { - "kind": "base", - "name": "integer" - }, - { - "kind": "base", - "name": "string" - } - ] - }, - "optional": true, - "documentation": "The diagnostic's code, which usually appear in the user interface." - }, - { - "name": "codeDescription", - "type": { - "kind": "reference", - "name": "CodeDescription" - }, - "optional": true, - "documentation": "An optional property to describe the error code.\nRequires the code field (above) to be present/not null.\n\n@since 3.16.0", - "since": "3.16.0" - }, - { - "name": "source", - "type": { - "kind": "base", - "name": "string" - }, - "optional": true, - "documentation": "A human-readable string describing the source of this\ndiagnostic, e.g. 'typescript' or 'super lint'. It usually\nappears in the user interface." - }, - { - "name": "message", - "type": { - "kind": "base", - "name": "string" - }, - "documentation": "The diagnostic's message. It usually appears in the user interface" - }, - { - "name": "tags", - "type": { - "kind": "array", - "element": { - "kind": "reference", - "name": "DiagnosticTag" - } - }, - "optional": true, - "documentation": "Additional metadata about the diagnostic.\n\n@since 3.15.0", - "since": "3.15.0" - }, - { - "name": "relatedInformation", - "type": { - "kind": "array", - "element": { - "kind": "reference", - "name": "DiagnosticRelatedInformation" - } - }, - "optional": true, - "documentation": "An array of related diagnostic information, e.g. when symbol-names within\na scope collide all definitions can be marked via this property." - }, - { - "name": "data", - "type": { - "kind": "reference", - "name": "LSPAny" - }, - "optional": true, - "documentation": "A data entry field that is preserved between a `textDocument/publishDiagnostics`\nnotification and `textDocument/codeAction` request.\n\n@since 3.16.0", - "since": "3.16.0" - } - ], - "documentation": "Represents a diagnostic, such as a compiler error or warning. Diagnostic objects\nare only valid in the scope of a resource." - }, - { - "name": "CompletionContext", - "properties": [ - { - "name": "triggerKind", - "type": { - "kind": "reference", - "name": "CompletionTriggerKind" - }, - "documentation": "How the completion was triggered." - }, - { - "name": "triggerCharacter", - "type": { - "kind": "base", - "name": "string" - }, - "optional": true, - "documentation": "The trigger character (a single character) that has trigger code complete.\nIs undefined if `triggerKind !== CompletionTriggerKind.TriggerCharacter`" - } - ], - "documentation": "Contains additional information about the context in which a completion request is triggered." - }, - { - "name": "CompletionItemLabelDetails", - "properties": [ - { - "name": "detail", - "type": { - "kind": "base", - "name": "string" - }, - "optional": true, - "documentation": "An optional string which is rendered less prominently directly after {@link CompletionItem.label label},\nwithout any spacing. Should be used for function signatures and type annotations." - }, - { - "name": "description", - "type": { - "kind": "base", - "name": "string" - }, - "optional": true, - "documentation": "An optional string which is rendered less prominently after {@link CompletionItem.detail}. Should be used\nfor fully qualified names and file paths." - } - ], - "documentation": "Additional details for a completion item label.\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "name": "InsertReplaceEdit", - "properties": [ - { - "name": "newText", - "type": { - "kind": "base", - "name": "string" - }, - "documentation": "The string to be inserted." - }, - { - "name": "insert", - "type": { - "kind": "reference", - "name": "Range" - }, - "documentation": "The range if the insert is requested" - }, - { - "name": "replace", - "type": { - "kind": "reference", - "name": "Range" - }, - "documentation": "The range if the replace is requested." - } - ], - "documentation": "A special text edit to provide an insert and a replace operation.\n\n@since 3.16.0", - "since": "3.16.0" - }, - { - "name": "CompletionOptions", - "properties": [ - { - "name": "triggerCharacters", - "type": { - "kind": "array", - "element": { - "kind": "base", - "name": "string" - } - }, - "optional": true, - "documentation": "Most tools trigger completion request automatically without explicitly requesting\nit using a keyboard shortcut (e.g. Ctrl+Space). Typically they do so when the user\nstarts to type an identifier. For example if the user types `c` in a JavaScript file\ncode complete will automatically pop up present `console` besides others as a\ncompletion item. Characters that make up identifiers don't need to be listed here.\n\nIf code complete should automatically be trigger on characters not being valid inside\nan identifier (for example `.` in JavaScript) list them in `triggerCharacters`." - }, - { - "name": "allCommitCharacters", - "type": { - "kind": "array", - "element": { - "kind": "base", - "name": "string" - } - }, - "optional": true, - "documentation": "The list of all possible characters that commit a completion. This field can be used\nif clients don't support individual commit characters per completion item. See\n`ClientCapabilities.textDocument.completion.completionItem.commitCharactersSupport`\n\nIf a server provides both `allCommitCharacters` and commit characters on an individual\ncompletion item the ones on the completion item win.\n\n@since 3.2.0", - "since": "3.2.0" - }, - { - "name": "resolveProvider", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "The server provides support to resolve additional\ninformation for a completion item." - }, - { - "name": "completionItem", - "type": { - "kind": "literal", - "value": { - "properties": [ - { - "name": "labelDetailsSupport", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "The server has support for completion item label\ndetails (see also `CompletionItemLabelDetails`) when\nreceiving a completion item in a resolve call.\n\n@since 3.17.0", - "since": "3.17.0" - } - ] - } - }, - "optional": true, - "documentation": "The server supports the following `CompletionItem` specific\ncapabilities.\n\n@since 3.17.0", - "since": "3.17.0" - } - ], - "mixins": [ - { - "kind": "reference", - "name": "WorkDoneProgressOptions" - } - ], - "documentation": "Completion options." - }, - { - "name": "HoverOptions", - "properties": [], - "mixins": [ - { - "kind": "reference", - "name": "WorkDoneProgressOptions" - } - ], - "documentation": "Hover options." - }, - { - "name": "SignatureHelpContext", - "properties": [ - { - "name": "triggerKind", - "type": { - "kind": "reference", - "name": "SignatureHelpTriggerKind" - }, - "documentation": "Action that caused signature help to be triggered." - }, - { - "name": "triggerCharacter", - "type": { - "kind": "base", - "name": "string" - }, - "optional": true, - "documentation": "Character that caused signature help to be triggered.\n\nThis is undefined when `triggerKind !== SignatureHelpTriggerKind.TriggerCharacter`" - }, - { - "name": "isRetrigger", - "type": { - "kind": "base", - "name": "boolean" - }, - "documentation": "`true` if signature help was already showing when it was triggered.\n\nRetriggers occurs when the signature help is already active and can be caused by actions such as\ntyping a trigger character, a cursor move, or document content changes." - }, - { - "name": "activeSignatureHelp", - "type": { - "kind": "reference", - "name": "SignatureHelp" - }, - "optional": true, - "documentation": "The currently active `SignatureHelp`.\n\nThe `activeSignatureHelp` has its `SignatureHelp.activeSignature` field updated based on\nthe user navigating through available signatures." - } - ], - "documentation": "Additional information about the context in which a signature help request was triggered.\n\n@since 3.15.0", - "since": "3.15.0" - }, - { - "name": "SignatureInformation", - "properties": [ - { - "name": "label", - "type": { - "kind": "base", - "name": "string" - }, - "documentation": "The label of this signature. Will be shown in\nthe UI." - }, - { - "name": "documentation", - "type": { - "kind": "or", - "items": [ - { - "kind": "base", - "name": "string" - }, - { - "kind": "reference", - "name": "MarkupContent" - } - ] - }, - "optional": true, - "documentation": "The human-readable doc-comment of this signature. Will be shown\nin the UI but can be omitted." - }, - { - "name": "parameters", - "type": { - "kind": "array", - "element": { - "kind": "reference", - "name": "ParameterInformation" - } - }, - "optional": true, - "documentation": "The parameters of this signature." - }, - { - "name": "activeParameter", - "type": { - "kind": "base", - "name": "uinteger" - }, - "optional": true, - "documentation": "The index of the active parameter.\n\nIf provided, this is used in place of `SignatureHelp.activeParameter`.\n\n@since 3.16.0", - "since": "3.16.0" - } - ], - "documentation": "Represents the signature of something callable. A signature\ncan have a label, like a function-name, a doc-comment, and\na set of parameters." - }, - { - "name": "SignatureHelpOptions", - "properties": [ - { - "name": "triggerCharacters", - "type": { - "kind": "array", - "element": { - "kind": "base", - "name": "string" - } - }, - "optional": true, - "documentation": "List of characters that trigger signature help automatically." - }, - { - "name": "retriggerCharacters", - "type": { - "kind": "array", - "element": { - "kind": "base", - "name": "string" - } - }, - "optional": true, - "documentation": "List of characters that re-trigger signature help.\n\nThese trigger characters are only active when signature help is already showing. All trigger characters\nare also counted as re-trigger characters.\n\n@since 3.15.0", - "since": "3.15.0" - } - ], - "mixins": [ - { - "kind": "reference", - "name": "WorkDoneProgressOptions" - } - ], - "documentation": "Server Capabilities for a [SignatureHelpRequest](#SignatureHelpRequest)." - }, - { - "name": "DefinitionOptions", - "properties": [], - "mixins": [ - { - "kind": "reference", - "name": "WorkDoneProgressOptions" - } - ], - "documentation": "Server Capabilities for a [DefinitionRequest](#DefinitionRequest)." - }, - { - "name": "ReferenceContext", - "properties": [ - { - "name": "includeDeclaration", - "type": { - "kind": "base", - "name": "boolean" - }, - "documentation": "Include the declaration of the current symbol." - } - ], - "documentation": "Value-object that contains additional information when\nrequesting references." - }, - { - "name": "ReferenceOptions", - "properties": [], - "mixins": [ - { - "kind": "reference", - "name": "WorkDoneProgressOptions" - } - ], - "documentation": "Reference options." - }, - { - "name": "DocumentHighlightOptions", - "properties": [], - "mixins": [ - { - "kind": "reference", - "name": "WorkDoneProgressOptions" - } - ], - "documentation": "Provider options for a [DocumentHighlightRequest](#DocumentHighlightRequest)." - }, - { - "name": "BaseSymbolInformation", - "properties": [ - { - "name": "name", - "type": { - "kind": "base", - "name": "string" - }, - "documentation": "The name of this symbol." - }, - { - "name": "kind", - "type": { - "kind": "reference", - "name": "SymbolKind" - }, - "documentation": "The kind of this symbol." - }, - { - "name": "tags", - "type": { - "kind": "array", - "element": { - "kind": "reference", - "name": "SymbolTag" - } - }, - "optional": true, - "documentation": "Tags for this symbol.\n\n@since 3.16.0", - "since": "3.16.0" - }, - { - "name": "containerName", - "type": { - "kind": "base", - "name": "string" - }, - "optional": true, - "documentation": "The name of the symbol containing this symbol. This information is for\nuser interface purposes (e.g. to render a qualifier in the user interface\nif necessary). It can't be used to re-infer a hierarchy for the document\nsymbols." - } - ], - "documentation": "A base for all symbol information." - }, - { - "name": "DocumentSymbolOptions", - "properties": [ - { - "name": "label", - "type": { - "kind": "base", - "name": "string" - }, - "optional": true, - "documentation": "A human-readable string that is shown when multiple outlines trees\nare shown for the same document.\n\n@since 3.16.0", - "since": "3.16.0" - } - ], - "mixins": [ - { - "kind": "reference", - "name": "WorkDoneProgressOptions" - } - ], - "documentation": "Provider options for a [DocumentSymbolRequest](#DocumentSymbolRequest)." - }, - { - "name": "CodeActionContext", - "properties": [ - { - "name": "diagnostics", - "type": { - "kind": "array", - "element": { - "kind": "reference", - "name": "Diagnostic" - } - }, - "documentation": "An array of diagnostics known on the client side overlapping the range provided to the\n`textDocument/codeAction` request. They are provided so that the server knows which\nerrors are currently presented to the user for the given range. There is no guarantee\nthat these accurately reflect the error state of the resource. The primary parameter\nto compute code actions is the provided range." - }, - { - "name": "only", - "type": { - "kind": "array", - "element": { - "kind": "reference", - "name": "CodeActionKind" - } - }, - "optional": true, - "documentation": "Requested kind of actions to return.\n\nActions not of this kind are filtered out by the client before being shown. So servers\ncan omit computing them." - }, - { - "name": "triggerKind", - "type": { - "kind": "reference", - "name": "CodeActionTriggerKind" - }, - "optional": true, - "documentation": "The reason why code actions were requested.\n\n@since 3.17.0", - "since": "3.17.0" - } - ], - "documentation": "Contains additional diagnostic information about the context in which\na [code action](#CodeActionProvider.provideCodeActions) is run." - }, - { - "name": "CodeActionOptions", - "properties": [ - { - "name": "codeActionKinds", - "type": { - "kind": "array", - "element": { - "kind": "reference", - "name": "CodeActionKind" - } - }, - "optional": true, - "documentation": "CodeActionKinds that this server may return.\n\nThe list of kinds may be generic, such as `CodeActionKind.Refactor`, or the server\nmay list out every specific kind they provide." - }, - { - "name": "resolveProvider", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "The server provides support to resolve additional\ninformation for a code action.\n\n@since 3.16.0", - "since": "3.16.0" - } - ], - "mixins": [ - { - "kind": "reference", - "name": "WorkDoneProgressOptions" - } - ], - "documentation": "Provider options for a [CodeActionRequest](#CodeActionRequest)." - }, - { - "name": "WorkspaceSymbolOptions", - "properties": [ - { - "name": "resolveProvider", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "The server provides support to resolve additional\ninformation for a workspace symbol.\n\n@since 3.17.0", - "since": "3.17.0" - } - ], - "mixins": [ - { - "kind": "reference", - "name": "WorkDoneProgressOptions" - } - ], - "documentation": "Server capabilities for a [WorkspaceSymbolRequest](#WorkspaceSymbolRequest)." - }, - { - "name": "CodeLensOptions", - "properties": [ - { - "name": "resolveProvider", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "Code lens has a resolve provider as well." - } - ], - "mixins": [ - { - "kind": "reference", - "name": "WorkDoneProgressOptions" - } - ], - "documentation": "Code Lens provider options of a [CodeLensRequest](#CodeLensRequest)." - }, - { - "name": "DocumentLinkOptions", - "properties": [ - { - "name": "resolveProvider", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "Document links have a resolve provider as well." - } - ], - "mixins": [ - { - "kind": "reference", - "name": "WorkDoneProgressOptions" - } - ], - "documentation": "Provider options for a [DocumentLinkRequest](#DocumentLinkRequest)." - }, - { - "name": "FormattingOptions", - "properties": [ - { - "name": "tabSize", - "type": { - "kind": "base", - "name": "uinteger" - }, - "documentation": "Size of a tab in spaces." - }, - { - "name": "insertSpaces", - "type": { - "kind": "base", - "name": "boolean" - }, - "documentation": "Prefer spaces over tabs." - }, - { - "name": "trimTrailingWhitespace", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "Trim trailing whitespace on a line.\n\n@since 3.15.0", - "since": "3.15.0" - }, - { - "name": "insertFinalNewline", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "Insert a newline character at the end of the file if one does not exist.\n\n@since 3.15.0", - "since": "3.15.0" - }, - { - "name": "trimFinalNewlines", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "Trim all newlines after the final newline at the end of the file.\n\n@since 3.15.0", - "since": "3.15.0" - } - ], - "documentation": "Value-object describing what options formatting should use." - }, - { - "name": "DocumentFormattingOptions", - "properties": [], - "mixins": [ - { - "kind": "reference", - "name": "WorkDoneProgressOptions" - } - ], - "documentation": "Provider options for a [DocumentFormattingRequest](#DocumentFormattingRequest)." - }, - { - "name": "DocumentRangeFormattingOptions", - "properties": [], - "mixins": [ - { - "kind": "reference", - "name": "WorkDoneProgressOptions" - } - ], - "documentation": "Provider options for a [DocumentRangeFormattingRequest](#DocumentRangeFormattingRequest)." - }, - { - "name": "DocumentOnTypeFormattingOptions", - "properties": [ - { - "name": "firstTriggerCharacter", - "type": { - "kind": "base", - "name": "string" - }, - "documentation": "A character on which formatting should be triggered, like `{`." - }, - { - "name": "moreTriggerCharacter", - "type": { - "kind": "array", - "element": { - "kind": "base", - "name": "string" - } - }, - "optional": true, - "documentation": "More trigger characters." - } - ], - "documentation": "Provider options for a [DocumentOnTypeFormattingRequest](#DocumentOnTypeFormattingRequest)." - }, - { - "name": "RenameOptions", - "properties": [ - { - "name": "prepareProvider", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "Renames should be checked and tested before being executed.\n\n@since version 3.12.0", - "since": "version 3.12.0" - } - ], - "mixins": [ - { - "kind": "reference", - "name": "WorkDoneProgressOptions" - } - ], - "documentation": "Provider options for a [RenameRequest](#RenameRequest)." - }, - { - "name": "ExecuteCommandOptions", - "properties": [ - { - "name": "commands", - "type": { - "kind": "array", - "element": { - "kind": "base", - "name": "string" - } - }, - "documentation": "The commands to be executed on the server" - } - ], - "mixins": [ - { - "kind": "reference", - "name": "WorkDoneProgressOptions" - } - ], - "documentation": "The server capabilities of a [ExecuteCommandRequest](#ExecuteCommandRequest)." - }, - { - "name": "SemanticTokensLegend", - "properties": [ - { - "name": "tokenTypes", - "type": { - "kind": "array", - "element": { - "kind": "base", - "name": "string" - } - }, - "documentation": "The token types a server uses." - }, - { - "name": "tokenModifiers", - "type": { - "kind": "array", - "element": { - "kind": "base", - "name": "string" - } - }, - "documentation": "The token modifiers a server uses." - } - ], - "documentation": "@since 3.16.0", - "since": "3.16.0" - }, - { - "name": "OptionalVersionedTextDocumentIdentifier", - "properties": [ - { - "name": "version", - "type": { - "kind": "or", - "items": [ - { - "kind": "base", - "name": "integer" - }, - { - "kind": "base", - "name": "null" - } - ] - }, - "documentation": "The version number of this document. If a versioned text document identifier\nis sent from the server to the client and the file is not open in the editor\n(the server has not received an open notification before) the server can send\n`null` to indicate that the version is unknown and the content on disk is the\ntruth (as specified with document content ownership)." - } - ], - "extends": [ - { - "kind": "reference", - "name": "TextDocumentIdentifier" - } - ], - "documentation": "A text document identifier to optionally denote a specific version of a text document." - }, - { - "name": "AnnotatedTextEdit", - "properties": [ - { - "name": "annotationId", - "type": { - "kind": "reference", - "name": "ChangeAnnotationIdentifier" - }, - "documentation": "The actual identifier of the change annotation" - } - ], - "extends": [ - { - "kind": "reference", - "name": "TextEdit" - } - ], - "documentation": "A special text edit with an additional change annotation.\n\n@since 3.16.0.", - "since": "3.16.0." - }, - { - "name": "ResourceOperation", - "properties": [ - { - "name": "kind", - "type": { - "kind": "base", - "name": "string" - }, - "documentation": "The resource operation kind." - }, - { - "name": "annotationId", - "type": { - "kind": "reference", - "name": "ChangeAnnotationIdentifier" - }, - "optional": true, - "documentation": "An optional annotation identifier describing the operation.\n\n@since 3.16.0", - "since": "3.16.0" - } - ], - "documentation": "A generic resource operation." - }, - { - "name": "CreateFileOptions", - "properties": [ - { - "name": "overwrite", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "Overwrite existing file. Overwrite wins over `ignoreIfExists`" - }, - { - "name": "ignoreIfExists", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "Ignore if exists." - } - ], - "documentation": "Options to create a file." - }, - { - "name": "RenameFileOptions", - "properties": [ - { - "name": "overwrite", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "Overwrite target if existing. Overwrite wins over `ignoreIfExists`" - }, - { - "name": "ignoreIfExists", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "Ignores if target exists." - } - ], - "documentation": "Rename file options" - }, - { - "name": "DeleteFileOptions", - "properties": [ - { - "name": "recursive", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "Delete the content recursively if a folder is denoted." - }, - { - "name": "ignoreIfNotExists", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "Ignore the operation if the file doesn't exist." - } - ], - "documentation": "Delete file options" - }, - { - "name": "FileOperationPattern", - "properties": [ - { - "name": "glob", - "type": { - "kind": "base", - "name": "string" - }, - "documentation": "The glob pattern to match. Glob patterns can have the following syntax:\n- `*` to match one or more characters in a path segment\n- `?` to match on one character in a path segment\n- `**` to match any number of path segments, including none\n- `{}` to group sub patterns into an OR expression. (e.g. `**​/*.{ts,js}` matches all TypeScript and JavaScript files)\n- `[]` to declare a range of characters to match in a path segment (e.g., `example.[0-9]` to match on `example.0`, `example.1`, …)\n- `[!...]` to negate a range of characters to match in a path segment (e.g., `example.[!0-9]` to match on `example.a`, `example.b`, but not `example.0`)" - }, - { - "name": "matches", - "type": { - "kind": "reference", - "name": "FileOperationPatternKind" - }, - "optional": true, - "documentation": "Whether to match files or folders with this pattern.\n\nMatches both if undefined." - }, - { - "name": "options", - "type": { - "kind": "reference", - "name": "FileOperationPatternOptions" - }, - "optional": true, - "documentation": "Additional options used during matching." - } - ], - "documentation": "A pattern to describe in which file operation requests or notifications\nthe server is interested in receiving.\n\n@since 3.16.0", - "since": "3.16.0" - }, - { - "name": "WorkspaceFullDocumentDiagnosticReport", - "properties": [ - { - "name": "uri", - "type": { - "kind": "base", - "name": "DocumentUri" - }, - "documentation": "The URI for which diagnostic information is reported." - }, - { - "name": "version", - "type": { - "kind": "or", - "items": [ - { - "kind": "base", - "name": "integer" - }, - { - "kind": "base", - "name": "null" - } - ] - }, - "documentation": "The version number for which the diagnostics are reported.\nIf the document is not marked as open `null` can be provided." - } - ], - "extends": [ - { - "kind": "reference", - "name": "FullDocumentDiagnosticReport" - } - ], - "documentation": "A full document diagnostic report for a workspace diagnostic result.\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "name": "WorkspaceUnchangedDocumentDiagnosticReport", - "properties": [ - { - "name": "uri", - "type": { - "kind": "base", - "name": "DocumentUri" - }, - "documentation": "The URI for which diagnostic information is reported." - }, - { - "name": "version", - "type": { - "kind": "or", - "items": [ - { - "kind": "base", - "name": "integer" - }, - { - "kind": "base", - "name": "null" - } - ] - }, - "documentation": "The version number for which the diagnostics are reported.\nIf the document is not marked as open `null` can be provided." - } - ], - "extends": [ - { - "kind": "reference", - "name": "UnchangedDocumentDiagnosticReport" - } - ], - "documentation": "An unchanged document diagnostic report for a workspace diagnostic result.\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "name": "LSPObject", - "properties": [], - "documentation": "LSP object definition.\n@since 3.17.0", - "since": "3.17.0" - }, - { - "name": "NotebookCell", - "properties": [ - { - "name": "kind", - "type": { - "kind": "reference", - "name": "NotebookCellKind" - }, - "documentation": "The cell's kind" - }, - { - "name": "document", - "type": { - "kind": "base", - "name": "DocumentUri" - }, - "documentation": "The URI of the cell's text document\ncontent." - }, - { - "name": "metadata", - "type": { - "kind": "reference", - "name": "LSPObject" - }, - "optional": true, - "documentation": "Additional metadata stored with the cell.\n\nNote: should always be an object literal (e.g. LSPObject)" - }, - { - "name": "executionSummary", - "type": { - "kind": "reference", - "name": "ExecutionSummary" - }, - "optional": true, - "documentation": "Additional execution summary information\nif supported by the client." - } - ], - "documentation": "A notebook cell.\n\nA cell's document URI must be unique across ALL notebook\ncells and can therefore be used to uniquely identify a\nnotebook cell or the cell's text document.\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "name": "NotebookCellArrayChange", - "properties": [ - { - "name": "start", - "type": { - "kind": "base", - "name": "uinteger" - }, - "documentation": "The start oftest of the cell that changed." - }, - { - "name": "deleteCount", - "type": { - "kind": "base", - "name": "uinteger" - }, - "documentation": "The deleted cells" - }, - { - "name": "cells", - "type": { - "kind": "array", - "element": { - "kind": "reference", - "name": "NotebookCell" - } - }, - "optional": true, - "documentation": "The new cells, if any" - } - ], - "documentation": "A change describing how to move a `NotebookCell`\narray from state S to S'.\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "name": "ClientCapabilities", - "properties": [ - { - "name": "workspace", - "type": { - "kind": "reference", - "name": "WorkspaceClientCapabilities" - }, - "optional": true, - "documentation": "Workspace specific client capabilities." - }, - { - "name": "textDocument", - "type": { - "kind": "reference", - "name": "TextDocumentClientCapabilities" - }, - "optional": true, - "documentation": "Text document specific client capabilities." - }, - { - "name": "notebookDocument", - "type": { - "kind": "reference", - "name": "NotebookDocumentClientCapabilities" - }, - "optional": true, - "documentation": "Capabilities specific to the notebook document support.\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "name": "window", - "type": { - "kind": "reference", - "name": "WindowClientCapabilities" - }, - "optional": true, - "documentation": "Window specific client capabilities." - }, - { - "name": "general", - "type": { - "kind": "reference", - "name": "GeneralClientCapabilities" - }, - "optional": true, - "documentation": "General client capabilities.\n\n@since 3.16.0", - "since": "3.16.0" - }, - { - "name": "experimental", - "type": { - "kind": "reference", - "name": "LSPAny" - }, - "optional": true, - "documentation": "Experimental client capabilities." - } - ], - "documentation": "Defines the capabilities provided by the client." - }, - { - "name": "TextDocumentSyncOptions", - "properties": [ - { - "name": "openClose", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "Open and close notifications are sent to the server. If omitted open close notification should not\nbe sent." - }, - { - "name": "change", - "type": { - "kind": "reference", - "name": "TextDocumentSyncKind" - }, - "optional": true, - "documentation": "Change notifications are sent to the server. See TextDocumentSyncKind.None, TextDocumentSyncKind.Full\nand TextDocumentSyncKind.Incremental. If omitted it defaults to TextDocumentSyncKind.None." - }, - { - "name": "willSave", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "If present will save notifications are sent to the server. If omitted the notification should not be\nsent." - }, - { - "name": "willSaveWaitUntil", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "If present will save wait until requests are sent to the server. If omitted the request should not be\nsent." - }, - { - "name": "save", - "type": { - "kind": "or", - "items": [ - { - "kind": "base", - "name": "boolean" - }, - { - "kind": "reference", - "name": "SaveOptions" - } - ] - }, - "optional": true, - "documentation": "If present save notifications are sent to the server. If omitted the notification should not be\nsent." - } - ] - }, - { - "name": "NotebookDocumentSyncOptions", - "properties": [ - { - "name": "notebookSelector", - "type": { - "kind": "array", - "element": { - "kind": "or", - "items": [ - { - "kind": "literal", - "value": { - "properties": [ - { - "name": "notebook", - "type": { - "kind": "or", - "items": [ - { - "kind": "base", - "name": "string" - }, - { - "kind": "reference", - "name": "NotebookDocumentFilter" - } - ] - }, - "documentation": "The notebook to be synced If a string\nvalue is provided it matches against the\nnotebook type. '*' matches every notebook." - }, - { - "name": "cells", - "type": { - "kind": "array", - "element": { - "kind": "literal", - "value": { - "properties": [ - { - "name": "language", - "type": { - "kind": "base", - "name": "string" - } - } - ] - } - } - }, - "optional": true, - "documentation": "The cells of the matching notebook to be synced." - } - ] - } - }, - { - "kind": "literal", - "value": { - "properties": [ - { - "name": "notebook", - "type": { - "kind": "or", - "items": [ - { - "kind": "base", - "name": "string" - }, - { - "kind": "reference", - "name": "NotebookDocumentFilter" - } - ] - }, - "optional": true, - "documentation": "The notebook to be synced If a string\nvalue is provided it matches against the\nnotebook type. '*' matches every notebook." - }, - { - "name": "cells", - "type": { - "kind": "array", - "element": { - "kind": "literal", - "value": { - "properties": [ - { - "name": "language", - "type": { - "kind": "base", - "name": "string" - } - } - ] - } - } - }, - "documentation": "The cells of the matching notebook to be synced." - } - ] - } - } - ] - } - }, - "documentation": "The notebooks to be synced" - }, - { - "name": "save", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "Whether save notification should be forwarded to\nthe server. Will only be honored if mode === `notebook`." - } - ], - "documentation": "Options specific to a notebook plus its cells\nto be synced to the server.\n\nIf a selector provides a notebook document\nfilter but no cell selector all cells of a\nmatching notebook document will be synced.\n\nIf a selector provides no notebook document\nfilter but only a cell selector all notebook\ndocument that contain at least one matching\ncell will be synced.\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "name": "NotebookDocumentSyncRegistrationOptions", - "properties": [], - "extends": [ - { - "kind": "reference", - "name": "NotebookDocumentSyncOptions" - } - ], - "mixins": [ - { - "kind": "reference", - "name": "StaticRegistrationOptions" - } - ], - "documentation": "Registration options specific to a notebook.\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "name": "WorkspaceFoldersServerCapabilities", - "properties": [ - { - "name": "supported", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "The server has support for workspace folders" - }, - { - "name": "changeNotifications", - "type": { - "kind": "or", - "items": [ - { - "kind": "base", - "name": "string" - }, - { - "kind": "base", - "name": "boolean" - } - ] - }, - "optional": true, - "documentation": "Whether the server wants to receive workspace folder\nchange notifications.\n\nIf a string is provided the string is treated as an ID\nunder which the notification is registered on the client\nside. The ID can be used to unregister for these events\nusing the `client/unregisterCapability` request." - } - ] - }, - { - "name": "FileOperationOptions", - "properties": [ - { - "name": "didCreate", - "type": { - "kind": "reference", - "name": "FileOperationRegistrationOptions" - }, - "optional": true, - "documentation": "The server is interested in receiving didCreateFiles notifications." - }, - { - "name": "willCreate", - "type": { - "kind": "reference", - "name": "FileOperationRegistrationOptions" - }, - "optional": true, - "documentation": "The server is interested in receiving willCreateFiles requests." - }, - { - "name": "didRename", - "type": { - "kind": "reference", - "name": "FileOperationRegistrationOptions" - }, - "optional": true, - "documentation": "The server is interested in receiving didRenameFiles notifications." - }, - { - "name": "willRename", - "type": { - "kind": "reference", - "name": "FileOperationRegistrationOptions" - }, - "optional": true, - "documentation": "The server is interested in receiving willRenameFiles requests." - }, - { - "name": "didDelete", - "type": { - "kind": "reference", - "name": "FileOperationRegistrationOptions" - }, - "optional": true, - "documentation": "The server is interested in receiving didDeleteFiles file notifications." - }, - { - "name": "willDelete", - "type": { - "kind": "reference", - "name": "FileOperationRegistrationOptions" - }, - "optional": true, - "documentation": "The server is interested in receiving willDeleteFiles file requests." - } - ], - "documentation": "Options for notifications/requests for user operations on files.\n\n@since 3.16.0", - "since": "3.16.0" - }, - { - "name": "CodeDescription", - "properties": [ - { - "name": "href", - "type": { - "kind": "base", - "name": "URI" - }, - "documentation": "An URI to open with more information about the diagnostic error." - } - ], - "documentation": "Structure to capture a description for an error code.\n\n@since 3.16.0", - "since": "3.16.0" - }, - { - "name": "DiagnosticRelatedInformation", - "properties": [ - { - "name": "location", - "type": { - "kind": "reference", - "name": "Location" - }, - "documentation": "The location of this related diagnostic information." - }, - { - "name": "message", - "type": { - "kind": "base", - "name": "string" - }, - "documentation": "The message of this related diagnostic information." - } - ], - "documentation": "Represents a related message and source code location for a diagnostic. This should be\nused to point to code locations that cause or related to a diagnostics, e.g when duplicating\na symbol in a scope." - }, - { - "name": "ParameterInformation", - "properties": [ - { - "name": "label", - "type": { - "kind": "or", - "items": [ - { - "kind": "base", - "name": "string" - }, - { - "kind": "tuple", - "items": [ - { - "kind": "base", - "name": "uinteger" - }, - { - "kind": "base", - "name": "uinteger" - } - ] - } - ] - }, - "documentation": "The label of this parameter information.\n\nEither a string or an inclusive start and exclusive end offsets within its containing\nsignature label. (see SignatureInformation.label). The offsets are based on a UTF-16\nstring representation as `Position` and `Range` does.\n\n*Note*: a label of type string should be a substring of its containing signature label.\nIts intended use case is to highlight the parameter label part in the `SignatureInformation.label`." - }, - { - "name": "documentation", - "type": { - "kind": "or", - "items": [ - { - "kind": "base", - "name": "string" - }, - { - "kind": "reference", - "name": "MarkupContent" - } - ] - }, - "optional": true, - "documentation": "The human-readable doc-comment of this parameter. Will be shown\nin the UI but can be omitted." - } - ], - "documentation": "Represents a parameter of a callable-signature. A parameter can\nhave a label and a doc-comment." - }, - { - "name": "NotebookCellTextDocumentFilter", - "properties": [ - { - "name": "notebook", - "type": { - "kind": "or", - "items": [ - { - "kind": "base", - "name": "string" - }, - { - "kind": "reference", - "name": "NotebookDocumentFilter" - } - ] - }, - "documentation": "A filter that matches against the notebook\ncontaining the notebook cell. If a string\nvalue is provided it matches against the\nnotebook type. '*' matches every notebook." - }, - { - "name": "language", - "type": { - "kind": "base", - "name": "string" - }, - "optional": true, - "documentation": "A language id like `python`.\n\nWill be matched against the language id of the\nnotebook cell document. '*' matches every language." - } - ], - "documentation": "A notebook cell text document filter denotes a cell text\ndocument by different properties.\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "name": "FileOperationPatternOptions", - "properties": [ - { - "name": "ignoreCase", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "The pattern should be matched ignoring casing." - } - ], - "documentation": "Matching options for the file operation pattern.\n\n@since 3.16.0", - "since": "3.16.0" - }, - { - "name": "ExecutionSummary", - "properties": [ - { - "name": "executionOrder", - "type": { - "kind": "base", - "name": "uinteger" - }, - "documentation": "A strict monotonically increasing value\nindicating the execution order of a cell\ninside a notebook." - }, - { - "name": "success", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "Whether the execution was successful or\nnot if known by the client." - } - ] - }, - { - "name": "WorkspaceClientCapabilities", - "properties": [ - { - "name": "applyEdit", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "The client supports applying batch edits\nto the workspace by supporting the request\n'workspace/applyEdit'" - }, - { - "name": "workspaceEdit", - "type": { - "kind": "reference", - "name": "WorkspaceEditClientCapabilities" - }, - "optional": true, - "documentation": "Capabilities specific to `WorkspaceEdit`s." - }, - { - "name": "didChangeConfiguration", - "type": { - "kind": "reference", - "name": "DidChangeConfigurationClientCapabilities" - }, - "optional": true, - "documentation": "Capabilities specific to the `workspace/didChangeConfiguration` notification." - }, - { - "name": "didChangeWatchedFiles", - "type": { - "kind": "reference", - "name": "DidChangeWatchedFilesClientCapabilities" - }, - "optional": true, - "documentation": "Capabilities specific to the `workspace/didChangeWatchedFiles` notification." - }, - { - "name": "symbol", - "type": { - "kind": "reference", - "name": "WorkspaceSymbolClientCapabilities" - }, - "optional": true, - "documentation": "Capabilities specific to the `workspace/symbol` request." - }, - { - "name": "executeCommand", - "type": { - "kind": "reference", - "name": "ExecuteCommandClientCapabilities" - }, - "optional": true, - "documentation": "Capabilities specific to the `workspace/executeCommand` request." - }, - { - "name": "workspaceFolders", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "The client has support for workspace folders.\n\n@since 3.6.0", - "since": "3.6.0" - }, - { - "name": "configuration", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "The client supports `workspace/configuration` requests.\n\n@since 3.6.0", - "since": "3.6.0" - }, - { - "name": "semanticTokens", - "type": { - "kind": "reference", - "name": "SemanticTokensWorkspaceClientCapabilities" - }, - "optional": true, - "documentation": "Capabilities specific to the semantic token requests scoped to the\nworkspace.\n\n@since 3.16.0.", - "since": "3.16.0." - }, - { - "name": "codeLens", - "type": { - "kind": "reference", - "name": "CodeLensWorkspaceClientCapabilities" - }, - "optional": true, - "documentation": "Capabilities specific to the code lens requests scoped to the\nworkspace.\n\n@since 3.16.0.", - "since": "3.16.0." - }, - { - "name": "fileOperations", - "type": { - "kind": "reference", - "name": "FileOperationClientCapabilities" - }, - "optional": true, - "documentation": "The client has support for file notifications/requests for user operations on files.\n\nSince 3.16.0" - }, - { - "name": "inlineValue", - "type": { - "kind": "reference", - "name": "InlineValueWorkspaceClientCapabilities" - }, - "optional": true, - "documentation": "Capabilities specific to the inline values requests scoped to the\nworkspace.\n\n@since 3.17.0.", - "since": "3.17.0." - }, - { - "name": "inlayHint", - "type": { - "kind": "reference", - "name": "InlayHintWorkspaceClientCapabilities" - }, - "optional": true, - "documentation": "Capabilities specific to the inlay hint requests scoped to the\nworkspace.\n\n@since 3.17.0.", - "since": "3.17.0." - }, - { - "name": "diagnostics", - "type": { - "kind": "reference", - "name": "DiagnosticWorkspaceClientCapabilities" - }, - "optional": true, - "documentation": "Capabilities specific to the diagnostic requests scoped to the\nworkspace.\n\n@since 3.17.0.", - "since": "3.17.0." - } - ], - "documentation": "Workspace specific client capabilities." - }, - { - "name": "TextDocumentClientCapabilities", - "properties": [ - { - "name": "synchronization", - "type": { - "kind": "reference", - "name": "TextDocumentSyncClientCapabilities" - }, - "optional": true, - "documentation": "Defines which synchronization capabilities the client supports." - }, - { - "name": "completion", - "type": { - "kind": "reference", - "name": "CompletionClientCapabilities" - }, - "optional": true, - "documentation": "Capabilities specific to the `textDocument/completion` request." - }, - { - "name": "hover", - "type": { - "kind": "reference", - "name": "HoverClientCapabilities" - }, - "optional": true, - "documentation": "Capabilities specific to the `textDocument/hover` request." - }, - { - "name": "signatureHelp", - "type": { - "kind": "reference", - "name": "SignatureHelpClientCapabilities" - }, - "optional": true, - "documentation": "Capabilities specific to the `textDocument/signatureHelp` request." - }, - { - "name": "declaration", - "type": { - "kind": "reference", - "name": "DeclarationClientCapabilities" - }, - "optional": true, - "documentation": "Capabilities specific to the `textDocument/declaration` request.\n\n@since 3.14.0", - "since": "3.14.0" - }, - { - "name": "definition", - "type": { - "kind": "reference", - "name": "DefinitionClientCapabilities" - }, - "optional": true, - "documentation": "Capabilities specific to the `textDocument/definition` request." - }, - { - "name": "typeDefinition", - "type": { - "kind": "reference", - "name": "TypeDefinitionClientCapabilities" - }, - "optional": true, - "documentation": "Capabilities specific to the `textDocument/typeDefinition` request.\n\n@since 3.6.0", - "since": "3.6.0" - }, - { - "name": "implementation", - "type": { - "kind": "reference", - "name": "ImplementationClientCapabilities" - }, - "optional": true, - "documentation": "Capabilities specific to the `textDocument/implementation` request.\n\n@since 3.6.0", - "since": "3.6.0" - }, - { - "name": "references", - "type": { - "kind": "reference", - "name": "ReferenceClientCapabilities" - }, - "optional": true, - "documentation": "Capabilities specific to the `textDocument/references` request." - }, - { - "name": "documentHighlight", - "type": { - "kind": "reference", - "name": "DocumentHighlightClientCapabilities" - }, - "optional": true, - "documentation": "Capabilities specific to the `textDocument/documentHighlight` request." - }, - { - "name": "documentSymbol", - "type": { - "kind": "reference", - "name": "DocumentSymbolClientCapabilities" - }, - "optional": true, - "documentation": "Capabilities specific to the `textDocument/documentSymbol` request." - }, - { - "name": "codeAction", - "type": { - "kind": "reference", - "name": "CodeActionClientCapabilities" - }, - "optional": true, - "documentation": "Capabilities specific to the `textDocument/codeAction` request." - }, - { - "name": "codeLens", - "type": { - "kind": "reference", - "name": "CodeLensClientCapabilities" - }, - "optional": true, - "documentation": "Capabilities specific to the `textDocument/codeLens` request." - }, - { - "name": "documentLink", - "type": { - "kind": "reference", - "name": "DocumentLinkClientCapabilities" - }, - "optional": true, - "documentation": "Capabilities specific to the `textDocument/documentLink` request." - }, - { - "name": "colorProvider", - "type": { - "kind": "reference", - "name": "DocumentColorClientCapabilities" - }, - "optional": true, - "documentation": "Capabilities specific to the `textDocument/documentColor` and the\n`textDocument/colorPresentation` request.\n\n@since 3.6.0", - "since": "3.6.0" - }, - { - "name": "formatting", - "type": { - "kind": "reference", - "name": "DocumentFormattingClientCapabilities" - }, - "optional": true, - "documentation": "Capabilities specific to the `textDocument/formatting` request." - }, - { - "name": "rangeFormatting", - "type": { - "kind": "reference", - "name": "DocumentRangeFormattingClientCapabilities" - }, - "optional": true, - "documentation": "Capabilities specific to the `textDocument/rangeFormatting` request." - }, - { - "name": "onTypeFormatting", - "type": { - "kind": "reference", - "name": "DocumentOnTypeFormattingClientCapabilities" - }, - "optional": true, - "documentation": "Capabilities specific to the `textDocument/onTypeFormatting` request." - }, - { - "name": "rename", - "type": { - "kind": "reference", - "name": "RenameClientCapabilities" - }, - "optional": true, - "documentation": "Capabilities specific to the `textDocument/rename` request." - }, - { - "name": "foldingRange", - "type": { - "kind": "reference", - "name": "FoldingRangeClientCapabilities" - }, - "optional": true, - "documentation": "Capabilities specific to the `textDocument/foldingRange` request.\n\n@since 3.10.0", - "since": "3.10.0" - }, - { - "name": "selectionRange", - "type": { - "kind": "reference", - "name": "SelectionRangeClientCapabilities" - }, - "optional": true, - "documentation": "Capabilities specific to the `textDocument/selectionRange` request.\n\n@since 3.15.0", - "since": "3.15.0" - }, - { - "name": "publishDiagnostics", - "type": { - "kind": "reference", - "name": "PublishDiagnosticsClientCapabilities" - }, - "optional": true, - "documentation": "Capabilities specific to the `textDocument/publishDiagnostics` notification." - }, - { - "name": "callHierarchy", - "type": { - "kind": "reference", - "name": "CallHierarchyClientCapabilities" - }, - "optional": true, - "documentation": "Capabilities specific to the various call hierarchy requests.\n\n@since 3.16.0", - "since": "3.16.0" - }, - { - "name": "semanticTokens", - "type": { - "kind": "reference", - "name": "SemanticTokensClientCapabilities" - }, - "optional": true, - "documentation": "Capabilities specific to the various semantic token request.\n\n@since 3.16.0", - "since": "3.16.0" - }, - { - "name": "linkedEditingRange", - "type": { - "kind": "reference", - "name": "LinkedEditingRangeClientCapabilities" - }, - "optional": true, - "documentation": "Capabilities specific to the `textDocument/linkedEditingRange` request.\n\n@since 3.16.0", - "since": "3.16.0" - }, - { - "name": "moniker", - "type": { - "kind": "reference", - "name": "MonikerClientCapabilities" - }, - "optional": true, - "documentation": "Client capabilities specific to the `textDocument/moniker` request.\n\n@since 3.16.0", - "since": "3.16.0" - }, - { - "name": "typeHierarchy", - "type": { - "kind": "reference", - "name": "TypeHierarchyClientCapabilities" - }, - "optional": true, - "documentation": "Capabilities specific to the various type hierarchy requests.\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "name": "inlineValue", - "type": { - "kind": "reference", - "name": "InlineValueClientCapabilities" - }, - "optional": true, - "documentation": "Capabilities specific to the `textDocument/inlineValue` request.\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "name": "inlayHint", - "type": { - "kind": "reference", - "name": "InlayHintClientCapabilities" - }, - "optional": true, - "documentation": "Capabilities specific to the `textDocument/inlayHint` request.\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "name": "diagnostic", - "type": { - "kind": "reference", - "name": "DiagnosticClientCapabilities" - }, - "optional": true, - "documentation": "Capabilities specific to the diagnostic pull model.\n\n@since 3.17.0", - "since": "3.17.0" - } - ], - "documentation": "Text document specific client capabilities." - }, - { - "name": "NotebookDocumentClientCapabilities", - "properties": [ - { - "name": "synchronization", - "type": { - "kind": "reference", - "name": "NotebookDocumentSyncClientCapabilities" - }, - "documentation": "Capabilities specific to notebook document synchronization\n\n@since 3.17.0", - "since": "3.17.0" - } - ], - "documentation": "Capabilities specific to the notebook document support.\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "name": "WindowClientCapabilities", - "properties": [ - { - "name": "workDoneProgress", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "It indicates whether the client supports server initiated\nprogress using the `window/workDoneProgress/create` request.\n\nThe capability also controls Whether client supports handling\nof progress notifications. If set servers are allowed to report a\n`workDoneProgress` property in the request specific server\ncapabilities.\n\n@since 3.15.0", - "since": "3.15.0" - }, - { - "name": "showMessage", - "type": { - "kind": "reference", - "name": "ShowMessageRequestClientCapabilities" - }, - "optional": true, - "documentation": "Capabilities specific to the showMessage request.\n\n@since 3.16.0", - "since": "3.16.0" - }, - { - "name": "showDocument", - "type": { - "kind": "reference", - "name": "ShowDocumentClientCapabilities" - }, - "optional": true, - "documentation": "Capabilities specific to the showDocument request.\n\n@since 3.16.0", - "since": "3.16.0" - } - ] - }, - { - "name": "GeneralClientCapabilities", - "properties": [ - { - "name": "staleRequestSupport", - "type": { - "kind": "literal", - "value": { - "properties": [ - { - "name": "cancel", - "type": { - "kind": "base", - "name": "boolean" - }, - "documentation": "The client will actively cancel the request." - }, - { - "name": "retryOnContentModified", - "type": { - "kind": "array", - "element": { - "kind": "base", - "name": "string" - } - }, - "documentation": "The list of requests for which the client\nwill retry the request if it receives a\nresponse with error code `ContentModified`" - } - ] - } - }, - "optional": true, - "documentation": "Client capability that signals how the client\nhandles stale requests (e.g. a request\nfor which the client will not process the response\nanymore since the information is outdated).\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "name": "regularExpressions", - "type": { - "kind": "reference", - "name": "RegularExpressionsClientCapabilities" - }, - "optional": true, - "documentation": "Client capabilities specific to regular expressions.\n\n@since 3.16.0", - "since": "3.16.0" - }, - { - "name": "markdown", - "type": { - "kind": "reference", - "name": "MarkdownClientCapabilities" - }, - "optional": true, - "documentation": "Client capabilities specific to the client's markdown parser.\n\n@since 3.16.0", - "since": "3.16.0" - }, - { - "name": "positionEncodings", - "type": { - "kind": "array", - "element": { - "kind": "reference", - "name": "PositionEncodingKind" - } - }, - "optional": true, - "documentation": "The position encodings supported by the client. Client and server\nhave to agree on the same position encoding to ensure that offsets\n(e.g. character position in a line) are interpreted the same on both\nsides.\n\nTo keep the protocol backwards compatible the following applies: if\nthe value 'utf-16' is missing from the array of position encodings\nservers can assume that the client supports UTF-16. UTF-16 is\ntherefore a mandatory encoding.\n\nIf omitted it defaults to ['utf-16'].\n\nImplementation considerations: since the conversion from one encoding\ninto another requires the content of the file / line the conversion\nis best done where the file is read which is usually on the server\nside.\n\n@since 3.17.0", - "since": "3.17.0" - } - ], - "documentation": "General client capabilities.\n\n@since 3.16.0", - "since": "3.16.0" - }, - { - "name": "RelativePattern", - "properties": [ - { - "name": "baseUri", - "type": { - "kind": "or", - "items": [ - { - "kind": "reference", - "name": "WorkspaceFolder" - }, - { - "kind": "base", - "name": "URI" - } - ] - }, - "documentation": "A workspace folder or a base URI to which this pattern will be matched\nagainst relatively." - }, - { - "name": "pattern", - "type": { - "kind": "reference", - "name": "Pattern" - }, - "documentation": "The actual glob pattern;" - } - ], - "documentation": "A relative pattern is a helper to construct glob patterns that are matched\nrelatively to a base URI. The common value for a `baseUri` is a workspace\nfolder root, but it can be another absolute URI as well.\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "name": "WorkspaceEditClientCapabilities", - "properties": [ - { - "name": "documentChanges", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "The client supports versioned document changes in `WorkspaceEdit`s" - }, - { - "name": "resourceOperations", - "type": { - "kind": "array", - "element": { - "kind": "reference", - "name": "ResourceOperationKind" - } - }, - "optional": true, - "documentation": "The resource operations the client supports. Clients should at least\nsupport 'create', 'rename' and 'delete' files and folders.\n\n@since 3.13.0", - "since": "3.13.0" - }, - { - "name": "failureHandling", - "type": { - "kind": "reference", - "name": "FailureHandlingKind" - }, - "optional": true, - "documentation": "The failure handling strategy of a client if applying the workspace edit\nfails.\n\n@since 3.13.0", - "since": "3.13.0" - }, - { - "name": "normalizesLineEndings", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "Whether the client normalizes line endings to the client specific\nsetting.\nIf set to `true` the client will normalize line ending characters\nin a workspace edit to the client-specified new line\ncharacter.\n\n@since 3.16.0", - "since": "3.16.0" - }, - { - "name": "changeAnnotationSupport", - "type": { - "kind": "literal", - "value": { - "properties": [ - { - "name": "groupsOnLabel", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "Whether the client groups edits with equal labels into tree nodes,\nfor instance all edits labelled with \"Changes in Strings\" would\nbe a tree node." - } - ] - } - }, - "optional": true, - "documentation": "Whether the client in general supports change annotations on text edits,\ncreate file, rename file and delete file changes.\n\n@since 3.16.0", - "since": "3.16.0" - } - ] - }, - { - "name": "DidChangeConfigurationClientCapabilities", - "properties": [ - { - "name": "dynamicRegistration", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "Did change configuration notification supports dynamic registration." - } - ] - }, - { - "name": "DidChangeWatchedFilesClientCapabilities", - "properties": [ - { - "name": "dynamicRegistration", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "Did change watched files notification supports dynamic registration. Please note\nthat the current protocol doesn't support static configuration for file changes\nfrom the server side." - }, - { - "name": "relativePatternSupport", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "Whether the client has support for {@link RelativePattern relative pattern}\nor not.\n\n@since 3.17.0", - "since": "3.17.0" - } - ] - }, - { - "name": "WorkspaceSymbolClientCapabilities", - "properties": [ - { - "name": "dynamicRegistration", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "Symbol request supports dynamic registration." - }, - { - "name": "symbolKind", - "type": { - "kind": "literal", - "value": { - "properties": [ - { - "name": "valueSet", - "type": { - "kind": "array", - "element": { - "kind": "reference", - "name": "SymbolKind" - } - }, - "optional": true, - "documentation": "The symbol kind values the client supports. When this\nproperty exists the client also guarantees that it will\nhandle values outside its set gracefully and falls back\nto a default value when unknown.\n\nIf this property is not present the client only supports\nthe symbol kinds from `File` to `Array` as defined in\nthe initial version of the protocol." - } - ] - } - }, - "optional": true, - "documentation": "Specific capabilities for the `SymbolKind` in the `workspace/symbol` request." - }, - { - "name": "tagSupport", - "type": { - "kind": "literal", - "value": { - "properties": [ - { - "name": "valueSet", - "type": { - "kind": "array", - "element": { - "kind": "reference", - "name": "SymbolTag" - } - }, - "documentation": "The tags supported by the client." - } - ] - } - }, - "optional": true, - "documentation": "The client supports tags on `SymbolInformation`.\nClients supporting tags have to handle unknown tags gracefully.\n\n@since 3.16.0", - "since": "3.16.0" - }, - { - "name": "resolveSupport", - "type": { - "kind": "literal", - "value": { - "properties": [ - { - "name": "properties", - "type": { - "kind": "array", - "element": { - "kind": "base", - "name": "string" - } - }, - "documentation": "The properties that a client can resolve lazily. Usually\n`location.range`" - } - ] - } - }, - "optional": true, - "documentation": "The client support partial workspace symbols. The client will send the\nrequest `workspaceSymbol/resolve` to the server to resolve additional\nproperties.\n\n@since 3.17.0", - "since": "3.17.0" - } - ], - "documentation": "Client capabilities for a [WorkspaceSymbolRequest](#WorkspaceSymbolRequest)." - }, - { - "name": "ExecuteCommandClientCapabilities", - "properties": [ - { - "name": "dynamicRegistration", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "Execute command supports dynamic registration." - } - ], - "documentation": "The client capabilities of a [ExecuteCommandRequest](#ExecuteCommandRequest)." - }, - { - "name": "SemanticTokensWorkspaceClientCapabilities", - "properties": [ - { - "name": "refreshSupport", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "Whether the client implementation supports a refresh request sent from\nthe server to the client.\n\nNote that this event is global and will force the client to refresh all\nsemantic tokens currently shown. It should be used with absolute care\nand is useful for situation where a server for example detects a project\nwide change that requires such a calculation." - } - ], - "documentation": "@since 3.16.0", - "since": "3.16.0" - }, - { - "name": "CodeLensWorkspaceClientCapabilities", - "properties": [ - { - "name": "refreshSupport", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "Whether the client implementation supports a refresh request sent from the\nserver to the client.\n\nNote that this event is global and will force the client to refresh all\ncode lenses currently shown. It should be used with absolute care and is\nuseful for situation where a server for example detect a project wide\nchange that requires such a calculation." - } - ], - "documentation": "@since 3.16.0", - "since": "3.16.0" - }, - { - "name": "FileOperationClientCapabilities", - "properties": [ - { - "name": "dynamicRegistration", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "Whether the client supports dynamic registration for file requests/notifications." - }, - { - "name": "didCreate", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "The client has support for sending didCreateFiles notifications." - }, - { - "name": "willCreate", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "The client has support for sending willCreateFiles requests." - }, - { - "name": "didRename", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "The client has support for sending didRenameFiles notifications." - }, - { - "name": "willRename", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "The client has support for sending willRenameFiles requests." - }, - { - "name": "didDelete", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "The client has support for sending didDeleteFiles notifications." - }, - { - "name": "willDelete", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "The client has support for sending willDeleteFiles requests." - } - ], - "documentation": "Capabilities relating to events from file operations by the user in the client.\n\nThese events do not come from the file system, they come from user operations\nlike renaming a file in the UI.\n\n@since 3.16.0", - "since": "3.16.0" - }, - { - "name": "InlineValueWorkspaceClientCapabilities", - "properties": [ - { - "name": "refreshSupport", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "Whether the client implementation supports a refresh request sent from the\nserver to the client.\n\nNote that this event is global and will force the client to refresh all\ninline values currently shown. It should be used with absolute care and is\nuseful for situation where a server for example detects a project wide\nchange that requires such a calculation." - } - ], - "documentation": "Client workspace capabilities specific to inline values.\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "name": "InlayHintWorkspaceClientCapabilities", - "properties": [ - { - "name": "refreshSupport", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "Whether the client implementation supports a refresh request sent from\nthe server to the client.\n\nNote that this event is global and will force the client to refresh all\ninlay hints currently shown. It should be used with absolute care and\nis useful for situation where a server for example detects a project wide\nchange that requires such a calculation." - } - ], - "documentation": "Client workspace capabilities specific to inlay hints.\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "name": "DiagnosticWorkspaceClientCapabilities", - "properties": [ - { - "name": "refreshSupport", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "Whether the client implementation supports a refresh request sent from\nthe server to the client.\n\nNote that this event is global and will force the client to refresh all\npulled diagnostics currently shown. It should be used with absolute care and\nis useful for situation where a server for example detects a project wide\nchange that requires such a calculation." - } - ], - "documentation": "Workspace client capabilities specific to diagnostic pull requests.\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "name": "TextDocumentSyncClientCapabilities", - "properties": [ - { - "name": "dynamicRegistration", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "Whether text document synchronization supports dynamic registration." - }, - { - "name": "willSave", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "The client supports sending will save notifications." - }, - { - "name": "willSaveWaitUntil", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "The client supports sending a will save request and\nwaits for a response providing text edits which will\nbe applied to the document before it is saved." - }, - { - "name": "didSave", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "The client supports did save notifications." - } - ] - }, - { - "name": "CompletionClientCapabilities", - "properties": [ - { - "name": "dynamicRegistration", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "Whether completion supports dynamic registration." - }, - { - "name": "completionItem", - "type": { - "kind": "literal", - "value": { - "properties": [ - { - "name": "snippetSupport", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "Client supports snippets as insert text.\n\nA snippet can define tab stops and placeholders with `$1`, `$2`\nand `${3:foo}`. `$0` defines the final tab stop, it defaults to\nthe end of the snippet. Placeholders with equal identifiers are linked,\nthat is typing in one will update others too." - }, - { - "name": "commitCharactersSupport", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "Client supports commit characters on a completion item." - }, - { - "name": "documentationFormat", - "type": { - "kind": "array", - "element": { - "kind": "reference", - "name": "MarkupKind" - } - }, - "optional": true, - "documentation": "Client supports the following content formats for the documentation\nproperty. The order describes the preferred format of the client." - }, - { - "name": "deprecatedSupport", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "Client supports the deprecated property on a completion item." - }, - { - "name": "preselectSupport", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "Client supports the preselect property on a completion item." - }, - { - "name": "tagSupport", - "type": { - "kind": "literal", - "value": { - "properties": [ - { - "name": "valueSet", - "type": { - "kind": "array", - "element": { - "kind": "reference", - "name": "CompletionItemTag" - } - }, - "documentation": "The tags supported by the client." - } - ] - } - }, - "optional": true, - "documentation": "Client supports the tag property on a completion item. Clients supporting\ntags have to handle unknown tags gracefully. Clients especially need to\npreserve unknown tags when sending a completion item back to the server in\na resolve call.\n\n@since 3.15.0", - "since": "3.15.0" - }, - { - "name": "insertReplaceSupport", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "Client support insert replace edit to control different behavior if a\ncompletion item is inserted in the text or should replace text.\n\n@since 3.16.0", - "since": "3.16.0" - }, - { - "name": "resolveSupport", - "type": { - "kind": "literal", - "value": { - "properties": [ - { - "name": "properties", - "type": { - "kind": "array", - "element": { - "kind": "base", - "name": "string" - } - }, - "documentation": "The properties that a client can resolve lazily." - } - ] - } - }, - "optional": true, - "documentation": "Indicates which properties a client can resolve lazily on a completion\nitem. Before version 3.16.0 only the predefined properties `documentation`\nand `details` could be resolved lazily.\n\n@since 3.16.0", - "since": "3.16.0" - }, - { - "name": "insertTextModeSupport", - "type": { - "kind": "literal", - "value": { - "properties": [ - { - "name": "valueSet", - "type": { - "kind": "array", - "element": { - "kind": "reference", - "name": "InsertTextMode" - } - } - } - ] - } - }, - "optional": true, - "documentation": "The client supports the `insertTextMode` property on\na completion item to override the whitespace handling mode\nas defined by the client (see `insertTextMode`).\n\n@since 3.16.0", - "since": "3.16.0" - }, - { - "name": "labelDetailsSupport", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "The client has support for completion item label\ndetails (see also `CompletionItemLabelDetails`).\n\n@since 3.17.0", - "since": "3.17.0" - } - ] - } - }, - "optional": true, - "documentation": "The client supports the following `CompletionItem` specific\ncapabilities." - }, - { - "name": "completionItemKind", - "type": { - "kind": "literal", - "value": { - "properties": [ - { - "name": "valueSet", - "type": { - "kind": "array", - "element": { - "kind": "reference", - "name": "CompletionItemKind" - } - }, - "optional": true, - "documentation": "The completion item kind values the client supports. When this\nproperty exists the client also guarantees that it will\nhandle values outside its set gracefully and falls back\nto a default value when unknown.\n\nIf this property is not present the client only supports\nthe completion items kinds from `Text` to `Reference` as defined in\nthe initial version of the protocol." - } - ] - } - }, - "optional": true - }, - { - "name": "insertTextMode", - "type": { - "kind": "reference", - "name": "InsertTextMode" - }, - "optional": true, - "documentation": "Defines how the client handles whitespace and indentation\nwhen accepting a completion item that uses multi line\ntext in either `insertText` or `textEdit`.\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "name": "contextSupport", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "The client supports to send additional context information for a\n`textDocument/completion` request." - }, - { - "name": "completionList", - "type": { - "kind": "literal", - "value": { - "properties": [ - { - "name": "itemDefaults", - "type": { - "kind": "array", - "element": { - "kind": "base", - "name": "string" - } - }, - "optional": true, - "documentation": "The client supports the following itemDefaults on\na completion list.\n\nThe value lists the supported property names of the\n`CompletionList.itemDefaults` object. If omitted\nno properties are supported.\n\n@since 3.17.0", - "since": "3.17.0" - } - ] - } - }, - "optional": true, - "documentation": "The client supports the following `CompletionList` specific\ncapabilities.\n\n@since 3.17.0", - "since": "3.17.0" - } - ], - "documentation": "Completion client capabilities" - }, - { - "name": "HoverClientCapabilities", - "properties": [ - { - "name": "dynamicRegistration", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "Whether hover supports dynamic registration." - }, - { - "name": "contentFormat", - "type": { - "kind": "array", - "element": { - "kind": "reference", - "name": "MarkupKind" - } - }, - "optional": true, - "documentation": "Client supports the following content formats for the content\nproperty. The order describes the preferred format of the client." - } - ] - }, - { - "name": "SignatureHelpClientCapabilities", - "properties": [ - { - "name": "dynamicRegistration", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "Whether signature help supports dynamic registration." - }, - { - "name": "signatureInformation", - "type": { - "kind": "literal", - "value": { - "properties": [ - { - "name": "documentationFormat", - "type": { - "kind": "array", - "element": { - "kind": "reference", - "name": "MarkupKind" - } - }, - "optional": true, - "documentation": "Client supports the following content formats for the documentation\nproperty. The order describes the preferred format of the client." - }, - { - "name": "parameterInformation", - "type": { - "kind": "literal", - "value": { - "properties": [ - { - "name": "labelOffsetSupport", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "The client supports processing label offsets instead of a\nsimple label string.\n\n@since 3.14.0", - "since": "3.14.0" - } - ] - } - }, - "optional": true, - "documentation": "Client capabilities specific to parameter information." - }, - { - "name": "activeParameterSupport", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "The client supports the `activeParameter` property on `SignatureInformation`\nliteral.\n\n@since 3.16.0", - "since": "3.16.0" - } - ] - } - }, - "optional": true, - "documentation": "The client supports the following `SignatureInformation`\nspecific properties." - }, - { - "name": "contextSupport", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "The client supports to send additional context information for a\n`textDocument/signatureHelp` request. A client that opts into\ncontextSupport will also support the `retriggerCharacters` on\n`SignatureHelpOptions`.\n\n@since 3.15.0", - "since": "3.15.0" - } - ], - "documentation": "Client Capabilities for a [SignatureHelpRequest](#SignatureHelpRequest)." - }, - { - "name": "DeclarationClientCapabilities", - "properties": [ - { - "name": "dynamicRegistration", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "Whether declaration supports dynamic registration. If this is set to `true`\nthe client supports the new `DeclarationRegistrationOptions` return value\nfor the corresponding server capability as well." - }, - { - "name": "linkSupport", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "The client supports additional metadata in the form of declaration links." - } - ], - "documentation": "@since 3.14.0", - "since": "3.14.0" - }, - { - "name": "DefinitionClientCapabilities", - "properties": [ - { - "name": "dynamicRegistration", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "Whether definition supports dynamic registration." - }, - { - "name": "linkSupport", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "The client supports additional metadata in the form of definition links.\n\n@since 3.14.0", - "since": "3.14.0" - } - ], - "documentation": "Client Capabilities for a [DefinitionRequest](#DefinitionRequest)." - }, - { - "name": "TypeDefinitionClientCapabilities", - "properties": [ - { - "name": "dynamicRegistration", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "Whether implementation supports dynamic registration. If this is set to `true`\nthe client supports the new `TypeDefinitionRegistrationOptions` return value\nfor the corresponding server capability as well." - }, - { - "name": "linkSupport", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "The client supports additional metadata in the form of definition links.\n\nSince 3.14.0" - } - ], - "documentation": "Since 3.6.0" - }, - { - "name": "ImplementationClientCapabilities", - "properties": [ - { - "name": "dynamicRegistration", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "Whether implementation supports dynamic registration. If this is set to `true`\nthe client supports the new `ImplementationRegistrationOptions` return value\nfor the corresponding server capability as well." - }, - { - "name": "linkSupport", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "The client supports additional metadata in the form of definition links.\n\n@since 3.14.0", - "since": "3.14.0" - } - ], - "documentation": "@since 3.6.0", - "since": "3.6.0" - }, - { - "name": "ReferenceClientCapabilities", - "properties": [ - { - "name": "dynamicRegistration", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "Whether references supports dynamic registration." - } - ], - "documentation": "Client Capabilities for a [ReferencesRequest](#ReferencesRequest)." - }, - { - "name": "DocumentHighlightClientCapabilities", - "properties": [ - { - "name": "dynamicRegistration", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "Whether document highlight supports dynamic registration." - } - ], - "documentation": "Client Capabilities for a [DocumentHighlightRequest](#DocumentHighlightRequest)." - }, - { - "name": "DocumentSymbolClientCapabilities", - "properties": [ - { - "name": "dynamicRegistration", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "Whether document symbol supports dynamic registration." - }, - { - "name": "symbolKind", - "type": { - "kind": "literal", - "value": { - "properties": [ - { - "name": "valueSet", - "type": { - "kind": "array", - "element": { - "kind": "reference", - "name": "SymbolKind" - } - }, - "optional": true, - "documentation": "The symbol kind values the client supports. When this\nproperty exists the client also guarantees that it will\nhandle values outside its set gracefully and falls back\nto a default value when unknown.\n\nIf this property is not present the client only supports\nthe symbol kinds from `File` to `Array` as defined in\nthe initial version of the protocol." - } - ] - } - }, - "optional": true, - "documentation": "Specific capabilities for the `SymbolKind` in the\n`textDocument/documentSymbol` request." - }, - { - "name": "hierarchicalDocumentSymbolSupport", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "The client supports hierarchical document symbols." - }, - { - "name": "tagSupport", - "type": { - "kind": "literal", - "value": { - "properties": [ - { - "name": "valueSet", - "type": { - "kind": "array", - "element": { - "kind": "reference", - "name": "SymbolTag" - } - }, - "documentation": "The tags supported by the client." - } - ] - } - }, - "optional": true, - "documentation": "The client supports tags on `SymbolInformation`. Tags are supported on\n`DocumentSymbol` if `hierarchicalDocumentSymbolSupport` is set to true.\nClients supporting tags have to handle unknown tags gracefully.\n\n@since 3.16.0", - "since": "3.16.0" - }, - { - "name": "labelSupport", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "The client supports an additional label presented in the UI when\nregistering a document symbol provider.\n\n@since 3.16.0", - "since": "3.16.0" - } - ], - "documentation": "Client Capabilities for a [DocumentSymbolRequest](#DocumentSymbolRequest)." - }, - { - "name": "CodeActionClientCapabilities", - "properties": [ - { - "name": "dynamicRegistration", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "Whether code action supports dynamic registration." - }, - { - "name": "codeActionLiteralSupport", - "type": { - "kind": "literal", - "value": { - "properties": [ - { - "name": "codeActionKind", - "type": { - "kind": "literal", - "value": { - "properties": [ - { - "name": "valueSet", - "type": { - "kind": "array", - "element": { - "kind": "reference", - "name": "CodeActionKind" - } - }, - "documentation": "The code action kind values the client supports. When this\nproperty exists the client also guarantees that it will\nhandle values outside its set gracefully and falls back\nto a default value when unknown." - } - ] - } - }, - "documentation": "The code action kind is support with the following value\nset." - } - ] - } - }, - "optional": true, - "documentation": "The client support code action literals of type `CodeAction` as a valid\nresponse of the `textDocument/codeAction` request. If the property is not\nset the request can only return `Command` literals.\n\n@since 3.8.0", - "since": "3.8.0" - }, - { - "name": "isPreferredSupport", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "Whether code action supports the `isPreferred` property.\n\n@since 3.15.0", - "since": "3.15.0" - }, - { - "name": "disabledSupport", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "Whether code action supports the `disabled` property.\n\n@since 3.16.0", - "since": "3.16.0" - }, - { - "name": "dataSupport", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "Whether code action supports the `data` property which is\npreserved between a `textDocument/codeAction` and a\n`codeAction/resolve` request.\n\n@since 3.16.0", - "since": "3.16.0" - }, - { - "name": "resolveSupport", - "type": { - "kind": "literal", - "value": { - "properties": [ - { - "name": "properties", - "type": { - "kind": "array", - "element": { - "kind": "base", - "name": "string" - } - }, - "documentation": "The properties that a client can resolve lazily." - } - ] - } - }, - "optional": true, - "documentation": "Whether the client supports resolving additional code action\nproperties via a separate `codeAction/resolve` request.\n\n@since 3.16.0", - "since": "3.16.0" - }, - { - "name": "honorsChangeAnnotations", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "Whether the client honors the change annotations in\ntext edits and resource operations returned via the\n`CodeAction#edit` property by for example presenting\nthe workspace edit in the user interface and asking\nfor confirmation.\n\n@since 3.16.0", - "since": "3.16.0" - } - ], - "documentation": "The Client Capabilities of a [CodeActionRequest](#CodeActionRequest)." - }, - { - "name": "CodeLensClientCapabilities", - "properties": [ - { - "name": "dynamicRegistration", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "Whether code lens supports dynamic registration." - } - ], - "documentation": "The client capabilities of a [CodeLensRequest](#CodeLensRequest)." - }, - { - "name": "DocumentLinkClientCapabilities", - "properties": [ - { - "name": "dynamicRegistration", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "Whether document link supports dynamic registration." - }, - { - "name": "tooltipSupport", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "Whether the client supports the `tooltip` property on `DocumentLink`.\n\n@since 3.15.0", - "since": "3.15.0" - } - ], - "documentation": "The client capabilities of a [DocumentLinkRequest](#DocumentLinkRequest)." - }, - { - "name": "DocumentColorClientCapabilities", - "properties": [ - { - "name": "dynamicRegistration", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "Whether implementation supports dynamic registration. If this is set to `true`\nthe client supports the new `DocumentColorRegistrationOptions` return value\nfor the corresponding server capability as well." - } - ] - }, - { - "name": "DocumentFormattingClientCapabilities", - "properties": [ - { - "name": "dynamicRegistration", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "Whether formatting supports dynamic registration." - } - ], - "documentation": "Client capabilities of a [DocumentFormattingRequest](#DocumentFormattingRequest)." - }, - { - "name": "DocumentRangeFormattingClientCapabilities", - "properties": [ - { - "name": "dynamicRegistration", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "Whether range formatting supports dynamic registration." - } - ], - "documentation": "Client capabilities of a [DocumentRangeFormattingRequest](#DocumentRangeFormattingRequest)." - }, - { - "name": "DocumentOnTypeFormattingClientCapabilities", - "properties": [ - { - "name": "dynamicRegistration", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "Whether on type formatting supports dynamic registration." - } - ], - "documentation": "Client capabilities of a [DocumentOnTypeFormattingRequest](#DocumentOnTypeFormattingRequest)." - }, - { - "name": "RenameClientCapabilities", - "properties": [ - { - "name": "dynamicRegistration", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "Whether rename supports dynamic registration." - }, - { - "name": "prepareSupport", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "Client supports testing for validity of rename operations\nbefore execution.\n\n@since 3.12.0", - "since": "3.12.0" - }, - { - "name": "prepareSupportDefaultBehavior", - "type": { - "kind": "reference", - "name": "PrepareSupportDefaultBehavior" - }, - "optional": true, - "documentation": "Client supports the default behavior result.\n\nThe value indicates the default behavior used by the\nclient.\n\n@since 3.16.0", - "since": "3.16.0" - }, - { - "name": "honorsChangeAnnotations", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "Whether the client honors the change annotations in\ntext edits and resource operations returned via the\nrename request's workspace edit by for example presenting\nthe workspace edit in the user interface and asking\nfor confirmation.\n\n@since 3.16.0", - "since": "3.16.0" - } - ] - }, - { - "name": "FoldingRangeClientCapabilities", - "properties": [ - { - "name": "dynamicRegistration", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "Whether implementation supports dynamic registration for folding range\nproviders. If this is set to `true` the client supports the new\n`FoldingRangeRegistrationOptions` return value for the corresponding\nserver capability as well." - }, - { - "name": "rangeLimit", - "type": { - "kind": "base", - "name": "uinteger" - }, - "optional": true, - "documentation": "The maximum number of folding ranges that the client prefers to receive\nper document. The value serves as a hint, servers are free to follow the\nlimit." - }, - { - "name": "lineFoldingOnly", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "If set, the client signals that it only supports folding complete lines.\nIf set, client will ignore specified `startCharacter` and `endCharacter`\nproperties in a FoldingRange." - }, - { - "name": "foldingRangeKind", - "type": { - "kind": "literal", - "value": { - "properties": [ - { - "name": "valueSet", - "type": { - "kind": "array", - "element": { - "kind": "reference", - "name": "FoldingRangeKind" - } - }, - "optional": true, - "documentation": "The folding range kind values the client supports. When this\nproperty exists the client also guarantees that it will\nhandle values outside its set gracefully and falls back\nto a default value when unknown." - } - ] - } - }, - "optional": true, - "documentation": "Specific options for the folding range kind.\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "name": "foldingRange", - "type": { - "kind": "literal", - "value": { - "properties": [ - { - "name": "collapsedText", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "If set, the client signals that it supports setting collapsedText on\nfolding ranges to display custom labels instead of the default text.\n\n@since 3.17.0", - "since": "3.17.0" - } - ] - } - }, - "optional": true, - "documentation": "Specific options for the folding range.\n\n@since 3.17.0", - "since": "3.17.0" - } - ] - }, - { - "name": "SelectionRangeClientCapabilities", - "properties": [ - { - "name": "dynamicRegistration", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "Whether implementation supports dynamic registration for selection range providers. If this is set to `true`\nthe client supports the new `SelectionRangeRegistrationOptions` return value for the corresponding server\ncapability as well." - } - ] - }, - { - "name": "PublishDiagnosticsClientCapabilities", - "properties": [ - { - "name": "relatedInformation", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "Whether the clients accepts diagnostics with related information." - }, - { - "name": "tagSupport", - "type": { - "kind": "literal", - "value": { - "properties": [ - { - "name": "valueSet", - "type": { - "kind": "array", - "element": { - "kind": "reference", - "name": "DiagnosticTag" - } - }, - "documentation": "The tags supported by the client." - } - ] - } - }, - "optional": true, - "documentation": "Client supports the tag property to provide meta data about a diagnostic.\nClients supporting tags have to handle unknown tags gracefully.\n\n@since 3.15.0", - "since": "3.15.0" - }, - { - "name": "versionSupport", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "Whether the client interprets the version property of the\n`textDocument/publishDiagnostics` notification's parameter.\n\n@since 3.15.0", - "since": "3.15.0" - }, - { - "name": "codeDescriptionSupport", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "Client supports a codeDescription property\n\n@since 3.16.0", - "since": "3.16.0" - }, - { - "name": "dataSupport", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "Whether code action supports the `data` property which is\npreserved between a `textDocument/publishDiagnostics` and\n`textDocument/codeAction` request.\n\n@since 3.16.0", - "since": "3.16.0" - } - ], - "documentation": "The publish diagnostic client capabilities." - }, - { - "name": "CallHierarchyClientCapabilities", - "properties": [ - { - "name": "dynamicRegistration", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "Whether implementation supports dynamic registration. If this is set to `true`\nthe client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)`\nreturn value for the corresponding server capability as well." - } - ], - "documentation": "@since 3.16.0", - "since": "3.16.0" - }, - { - "name": "SemanticTokensClientCapabilities", - "properties": [ - { - "name": "dynamicRegistration", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "Whether implementation supports dynamic registration. If this is set to `true`\nthe client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)`\nreturn value for the corresponding server capability as well." - }, - { - "name": "requests", - "type": { - "kind": "literal", - "value": { - "properties": [ - { - "name": "range", - "type": { - "kind": "or", - "items": [ - { - "kind": "base", - "name": "boolean" - }, - { - "kind": "literal", - "value": { - "properties": [] - } - } - ] - }, - "optional": true, - "documentation": "The client will send the `textDocument/semanticTokens/range` request if\nthe server provides a corresponding handler." - }, - { - "name": "full", - "type": { - "kind": "or", - "items": [ - { - "kind": "base", - "name": "boolean" - }, - { - "kind": "literal", - "value": { - "properties": [ - { - "name": "delta", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "The client will send the `textDocument/semanticTokens/full/delta` request if\nthe server provides a corresponding handler." - } - ] - } - } - ] - }, - "optional": true, - "documentation": "The client will send the `textDocument/semanticTokens/full` request if\nthe server provides a corresponding handler." - } - ] - } - }, - "documentation": "Which requests the client supports and might send to the server\ndepending on the server's capability. Please note that clients might not\nshow semantic tokens or degrade some of the user experience if a range\nor full request is advertised by the client but not provided by the\nserver. If for example the client capability `requests.full` and\n`request.range` are both set to true but the server only provides a\nrange provider the client might not render a minimap correctly or might\neven decide to not show any semantic tokens at all." - }, - { - "name": "tokenTypes", - "type": { - "kind": "array", - "element": { - "kind": "base", - "name": "string" - } - }, - "documentation": "The token types that the client supports." - }, - { - "name": "tokenModifiers", - "type": { - "kind": "array", - "element": { - "kind": "base", - "name": "string" - } - }, - "documentation": "The token modifiers that the client supports." - }, - { - "name": "formats", - "type": { - "kind": "array", - "element": { - "kind": "reference", - "name": "TokenFormat" - } - }, - "documentation": "The token formats the clients supports." - }, - { - "name": "overlappingTokenSupport", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "Whether the client supports tokens that can overlap each other." - }, - { - "name": "multilineTokenSupport", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "Whether the client supports tokens that can span multiple lines." - }, - { - "name": "serverCancelSupport", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "Whether the client allows the server to actively cancel a\nsemantic token request, e.g. supports returning\nLSPErrorCodes.ServerCancelled. If a server does the client\nneeds to retrigger the request.\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "name": "augmentsSyntaxTokens", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "Whether the client uses semantic tokens to augment existing\nsyntax tokens. If set to `true` client side created syntax\ntokens and semantic tokens are both used for colorization. If\nset to `false` the client only uses the returned semantic tokens\nfor colorization.\n\nIf the value is `undefined` then the client behavior is not\nspecified.\n\n@since 3.17.0", - "since": "3.17.0" - } - ], - "documentation": "@since 3.16.0", - "since": "3.16.0" - }, - { - "name": "LinkedEditingRangeClientCapabilities", - "properties": [ - { - "name": "dynamicRegistration", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "Whether the implementation supports dynamic registration. If this is set to `true`\nthe client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)`\nreturn value for the corresponding server capability as well." - } - ], - "documentation": "Client capabilities for the linked editing range request.\n\n@since 3.16.0", - "since": "3.16.0" - }, - { - "name": "MonikerClientCapabilities", - "properties": [ - { - "name": "dynamicRegistration", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "Whether moniker supports dynamic registration. If this is set to `true`\nthe client supports the new `MonikerRegistrationOptions` return value\nfor the corresponding server capability as well." - } - ], - "documentation": "Client capabilities specific to the moniker request.\n\n@since 3.16.0", - "since": "3.16.0" - }, - { - "name": "TypeHierarchyClientCapabilities", - "properties": [ - { - "name": "dynamicRegistration", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "Whether implementation supports dynamic registration. If this is set to `true`\nthe client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)`\nreturn value for the corresponding server capability as well." - } - ], - "documentation": "@since 3.17.0", - "since": "3.17.0" - }, - { - "name": "InlineValueClientCapabilities", - "properties": [ - { - "name": "dynamicRegistration", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "Whether implementation supports dynamic registration for inline value providers." - } - ], - "documentation": "Client capabilities specific to inline values.\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "name": "InlayHintClientCapabilities", - "properties": [ - { - "name": "dynamicRegistration", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "Whether inlay hints support dynamic registration." - }, - { - "name": "resolveSupport", - "type": { - "kind": "literal", - "value": { - "properties": [ - { - "name": "properties", - "type": { - "kind": "array", - "element": { - "kind": "base", - "name": "string" - } - }, - "documentation": "The properties that a client can resolve lazily." - } - ] - } - }, - "optional": true, - "documentation": "Indicates which properties a client can resolve lazily on an inlay\nhint." - } - ], - "documentation": "Inlay hint client capabilities.\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "name": "DiagnosticClientCapabilities", - "properties": [ - { - "name": "dynamicRegistration", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "Whether implementation supports dynamic registration. If this is set to `true`\nthe client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)`\nreturn value for the corresponding server capability as well." - }, - { - "name": "relatedDocumentSupport", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "Whether the clients supports related documents for document diagnostic pulls." - } - ], - "documentation": "Client capabilities specific to diagnostic pull requests.\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "name": "NotebookDocumentSyncClientCapabilities", - "properties": [ - { - "name": "dynamicRegistration", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "Whether implementation supports dynamic registration. If this is\nset to `true` the client supports the new\n`(TextDocumentRegistrationOptions & StaticRegistrationOptions)`\nreturn value for the corresponding server capability as well." - }, - { - "name": "executionSummarySupport", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "The client supports sending execution summary data per cell." - } - ], - "documentation": "Notebook specific client capabilities.\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "name": "ShowMessageRequestClientCapabilities", - "properties": [ - { - "name": "messageActionItem", - "type": { - "kind": "literal", - "value": { - "properties": [ - { - "name": "additionalPropertiesSupport", - "type": { - "kind": "base", - "name": "boolean" - }, - "optional": true, - "documentation": "Whether the client supports additional attributes which\nare preserved and send back to the server in the\nrequest's response." - } - ] - } - }, - "optional": true, - "documentation": "Capabilities specific to the `MessageActionItem` type." - } - ], - "documentation": "Show message request client capabilities" - }, - { - "name": "ShowDocumentClientCapabilities", - "properties": [ - { - "name": "support", - "type": { - "kind": "base", - "name": "boolean" - }, - "documentation": "The client has support for the showDocument\nrequest." - } - ], - "documentation": "Client capabilities for the showDocument request.\n\n@since 3.16.0", - "since": "3.16.0" - }, - { - "name": "RegularExpressionsClientCapabilities", - "properties": [ - { - "name": "engine", - "type": { - "kind": "base", - "name": "string" - }, - "documentation": "The engine's name." - }, - { - "name": "version", - "type": { - "kind": "base", - "name": "string" - }, - "optional": true, - "documentation": "The engine's version." - } - ], - "documentation": "Client capabilities specific to regular expressions.\n\n@since 3.16.0", - "since": "3.16.0" - }, - { - "name": "MarkdownClientCapabilities", - "properties": [ - { - "name": "parser", - "type": { - "kind": "base", - "name": "string" - }, - "documentation": "The name of the parser." - }, - { - "name": "version", - "type": { - "kind": "base", - "name": "string" - }, - "optional": true, - "documentation": "The version of the parser." - }, - { - "name": "allowedTags", - "type": { - "kind": "array", - "element": { - "kind": "base", - "name": "string" - } - }, - "optional": true, - "documentation": "A list of HTML tags that the client allows / supports in\nMarkdown.\n\n@since 3.17.0", - "since": "3.17.0" - } - ], - "documentation": "Client capabilities specific to the used markdown parser.\n\n@since 3.16.0", - "since": "3.16.0" - } - ], - "enumerations": [ - { - "name": "SemanticTokenTypes", - "type": { - "kind": "base", - "name": "string" - }, - "values": [ - { - "name": "namespace", - "value": "namespace" - }, - { - "name": "type", - "value": "type", - "documentation": "Represents a generic type. Acts as a fallback for types which can't be mapped to\na specific type like class or enum." - }, - { - "name": "class", - "value": "class" - }, - { - "name": "enum", - "value": "enum" - }, - { - "name": "interface", - "value": "interface" - }, - { - "name": "struct", - "value": "struct" - }, - { - "name": "typeParameter", - "value": "typeParameter" - }, - { - "name": "parameter", - "value": "parameter" - }, - { - "name": "variable", - "value": "variable" - }, - { - "name": "property", - "value": "property" - }, - { - "name": "enumMember", - "value": "enumMember" - }, - { - "name": "event", - "value": "event" - }, - { - "name": "function", - "value": "function" - }, - { - "name": "method", - "value": "method" - }, - { - "name": "macro", - "value": "macro" - }, - { - "name": "keyword", - "value": "keyword" - }, - { - "name": "modifier", - "value": "modifier" - }, - { - "name": "comment", - "value": "comment" - }, - { - "name": "string", - "value": "string" - }, - { - "name": "number", - "value": "number" - }, - { - "name": "regexp", - "value": "regexp" - }, - { - "name": "operator", - "value": "operator" - }, - { - "name": "decorator", - "value": "decorator", - "documentation": "@since 3.17.0", - "since": "3.17.0" - } - ], - "supportsCustomValues": true, - "documentation": "A set of predefined token types. This set is not fixed\nan clients can specify additional token types via the\ncorresponding client capabilities.\n\n@since 3.16.0", - "since": "3.16.0" - }, - { - "name": "SemanticTokenModifiers", - "type": { - "kind": "base", - "name": "string" - }, - "values": [ - { - "name": "declaration", - "value": "declaration" - }, - { - "name": "definition", - "value": "definition" - }, - { - "name": "readonly", - "value": "readonly" - }, - { - "name": "static", - "value": "static" - }, - { - "name": "deprecated", - "value": "deprecated" - }, - { - "name": "abstract", - "value": "abstract" - }, - { - "name": "async", - "value": "async" - }, - { - "name": "modification", - "value": "modification" - }, - { - "name": "documentation", - "value": "documentation" - }, - { - "name": "defaultLibrary", - "value": "defaultLibrary" - } - ], - "supportsCustomValues": true, - "documentation": "A set of predefined token modifiers. This set is not fixed\nan clients can specify additional token types via the\ncorresponding client capabilities.\n\n@since 3.16.0", - "since": "3.16.0" - }, - { - "name": "DocumentDiagnosticReportKind", - "type": { - "kind": "base", - "name": "string" - }, - "values": [ - { - "name": "Full", - "value": "full", - "documentation": "A diagnostic report with a full\nset of problems." - }, - { - "name": "Unchanged", - "value": "unchanged", - "documentation": "A report indicating that the last\nreturned report is still accurate." - } - ], - "documentation": "The document diagnostic report kinds.\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "name": "ErrorCodes", - "type": { - "kind": "base", - "name": "integer" - }, - "values": [ - { - "name": "ParseError", - "value": -32700 - }, - { - "name": "InvalidRequest", - "value": -32600 - }, - { - "name": "MethodNotFound", - "value": -32601 - }, - { - "name": "InvalidParams", - "value": -32602 - }, - { - "name": "InternalError", - "value": -32603 - }, - { - "name": "ServerNotInitialized", - "value": -32002, - "documentation": "Error code indicating that a server received a notification or\nrequest before the server has received the `initialize` request." - }, - { - "name": "UnknownErrorCode", - "value": -32001 - } - ], - "supportsCustomValues": true, - "documentation": "Predefined error codes." - }, - { - "name": "LSPErrorCodes", - "type": { - "kind": "base", - "name": "integer" - }, - "values": [ - { - "name": "RequestFailed", - "value": -32803, - "documentation": "A request failed but it was syntactically correct, e.g the\nmethod name was known and the parameters were valid. The error\nmessage should contain human readable information about why\nthe request failed.\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "name": "ServerCancelled", - "value": -32802, - "documentation": "The server cancelled the request. This error code should\nonly be used for requests that explicitly support being\nserver cancellable.\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "name": "ContentModified", - "value": -32801, - "documentation": "The server detected that the content of a document got\nmodified outside normal conditions. A server should\nNOT send this error code if it detects a content change\nin it unprocessed messages. The result even computed\non an older state might still be useful for the client.\n\nIf a client decides that a result is not of any use anymore\nthe client should cancel the request." - }, - { - "name": "RequestCancelled", - "value": -32800, - "documentation": "The client has canceled a request and a server as detected\nthe cancel." - } - ], - "supportsCustomValues": true - }, - { - "name": "FoldingRangeKind", - "type": { - "kind": "base", - "name": "string" - }, - "values": [ - { - "name": "Comment", - "value": "comment", - "documentation": "Folding range for a comment" - }, - { - "name": "Imports", - "value": "imports", - "documentation": "Folding range for an import or include" - }, - { - "name": "Region", - "value": "region", - "documentation": "Folding range for a region (e.g. `#region`)" - } - ], - "supportsCustomValues": true, - "documentation": "A set of predefined range kinds." - }, - { - "name": "SymbolKind", - "type": { - "kind": "base", - "name": "uinteger" - }, - "values": [ - { - "name": "File", - "value": 1 - }, - { - "name": "Module", - "value": 2 - }, - { - "name": "Namespace", - "value": 3 - }, - { - "name": "Package", - "value": 4 - }, - { - "name": "Class", - "value": 5 - }, - { - "name": "Method", - "value": 6 - }, - { - "name": "Property", - "value": 7 - }, - { - "name": "Field", - "value": 8 - }, - { - "name": "Constructor", - "value": 9 - }, - { - "name": "Enum", - "value": 10 - }, - { - "name": "Interface", - "value": 11 - }, - { - "name": "Function", - "value": 12 - }, - { - "name": "Variable", - "value": 13 - }, - { - "name": "Constant", - "value": 14 - }, - { - "name": "String", - "value": 15 - }, - { - "name": "Number", - "value": 16 - }, - { - "name": "Boolean", - "value": 17 - }, - { - "name": "Array", - "value": 18 - }, - { - "name": "Object", - "value": 19 - }, - { - "name": "Key", - "value": 20 - }, - { - "name": "Null", - "value": 21 - }, - { - "name": "EnumMember", - "value": 22 - }, - { - "name": "Struct", - "value": 23 - }, - { - "name": "Event", - "value": 24 - }, - { - "name": "Operator", - "value": 25 - }, - { - "name": "TypeParameter", - "value": 26 - } - ], - "documentation": "A symbol kind." - }, - { - "name": "SymbolTag", - "type": { - "kind": "base", - "name": "uinteger" - }, - "values": [ - { - "name": "Deprecated", - "value": 1, - "documentation": "Render a symbol as obsolete, usually using a strike-out." - } - ], - "documentation": "Symbol tags are extra annotations that tweak the rendering of a symbol.\n\n@since 3.16", - "since": "3.16" - }, - { - "name": "UniquenessLevel", - "type": { - "kind": "base", - "name": "string" - }, - "values": [ - { - "name": "document", - "value": "document", - "documentation": "The moniker is only unique inside a document" - }, - { - "name": "project", - "value": "project", - "documentation": "The moniker is unique inside a project for which a dump got created" - }, - { - "name": "group", - "value": "group", - "documentation": "The moniker is unique inside the group to which a project belongs" - }, - { - "name": "scheme", - "value": "scheme", - "documentation": "The moniker is unique inside the moniker scheme." - }, - { - "name": "global", - "value": "global", - "documentation": "The moniker is globally unique" - } - ], - "documentation": "Moniker uniqueness level to define scope of the moniker.\n\n@since 3.16.0", - "since": "3.16.0" - }, - { - "name": "MonikerKind", - "type": { - "kind": "base", - "name": "string" - }, - "values": [ - { - "name": "import", - "value": "import", - "documentation": "The moniker represent a symbol that is imported into a project" - }, - { - "name": "export", - "value": "export", - "documentation": "The moniker represents a symbol that is exported from a project" - }, - { - "name": "local", - "value": "local", - "documentation": "The moniker represents a symbol that is local to a project (e.g. a local\nvariable of a function, a class not visible outside the project, ...)" - } - ], - "documentation": "The moniker kind.\n\n@since 3.16.0", - "since": "3.16.0" - }, - { - "name": "InlayHintKind", - "type": { - "kind": "base", - "name": "uinteger" - }, - "values": [ - { - "name": "Type", - "value": 1, - "documentation": "An inlay hint that for a type annotation." - }, - { - "name": "Parameter", - "value": 2, - "documentation": "An inlay hint that is for a parameter." - } - ], - "documentation": "Inlay hint kinds.\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "name": "MessageType", - "type": { - "kind": "base", - "name": "uinteger" - }, - "values": [ - { - "name": "Error", - "value": 1, - "documentation": "An error message." - }, - { - "name": "Warning", - "value": 2, - "documentation": "A warning message." - }, - { - "name": "Info", - "value": 3, - "documentation": "An information message." - }, - { - "name": "Log", - "value": 4, - "documentation": "A log message." - } - ], - "documentation": "The message type" - }, - { - "name": "TextDocumentSyncKind", - "type": { - "kind": "base", - "name": "uinteger" - }, - "values": [ - { - "name": "None", - "value": 0, - "documentation": "Documents should not be synced at all." - }, - { - "name": "Full", - "value": 1, - "documentation": "Documents are synced by always sending the full content\nof the document." - }, - { - "name": "Incremental", - "value": 2, - "documentation": "Documents are synced by sending the full content on open.\nAfter that only incremental updates to the document are\nsend." - } - ], - "documentation": "Defines how the host (editor) should sync\ndocument changes to the language server." - }, - { - "name": "TextDocumentSaveReason", - "type": { - "kind": "base", - "name": "uinteger" - }, - "values": [ - { - "name": "Manual", - "value": 1, - "documentation": "Manually triggered, e.g. by the user pressing save, by starting debugging,\nor by an API call." - }, - { - "name": "AfterDelay", - "value": 2, - "documentation": "Automatic after a delay." - }, - { - "name": "FocusOut", - "value": 3, - "documentation": "When the editor lost focus." - } - ], - "documentation": "Represents reasons why a text document is saved." - }, - { - "name": "CompletionItemKind", - "type": { - "kind": "base", - "name": "uinteger" - }, - "values": [ - { - "name": "Text", - "value": 1 - }, - { - "name": "Method", - "value": 2 - }, - { - "name": "Function", - "value": 3 - }, - { - "name": "Constructor", - "value": 4 - }, - { - "name": "Field", - "value": 5 - }, - { - "name": "Variable", - "value": 6 - }, - { - "name": "Class", - "value": 7 - }, - { - "name": "Interface", - "value": 8 - }, - { - "name": "Module", - "value": 9 - }, - { - "name": "Property", - "value": 10 - }, - { - "name": "Unit", - "value": 11 - }, - { - "name": "Value", - "value": 12 - }, - { - "name": "Enum", - "value": 13 - }, - { - "name": "Keyword", - "value": 14 - }, - { - "name": "Snippet", - "value": 15 - }, - { - "name": "Color", - "value": 16 - }, - { - "name": "File", - "value": 17 - }, - { - "name": "Reference", - "value": 18 - }, - { - "name": "Folder", - "value": 19 - }, - { - "name": "EnumMember", - "value": 20 - }, - { - "name": "Constant", - "value": 21 - }, - { - "name": "Struct", - "value": 22 - }, - { - "name": "Event", - "value": 23 - }, - { - "name": "Operator", - "value": 24 - }, - { - "name": "TypeParameter", - "value": 25 - } - ], - "documentation": "The kind of a completion entry." - }, - { - "name": "CompletionItemTag", - "type": { - "kind": "base", - "name": "uinteger" - }, - "values": [ - { - "name": "Deprecated", - "value": 1, - "documentation": "Render a completion as obsolete, usually using a strike-out." - } - ], - "documentation": "Completion item tags are extra annotations that tweak the rendering of a completion\nitem.\n\n@since 3.15.0", - "since": "3.15.0" - }, - { - "name": "InsertTextFormat", - "type": { - "kind": "base", - "name": "uinteger" - }, - "values": [ - { - "name": "PlainText", - "value": 1, - "documentation": "The primary text to be inserted is treated as a plain string." - }, - { - "name": "Snippet", - "value": 2, - "documentation": "The primary text to be inserted is treated as a snippet.\n\nA snippet can define tab stops and placeholders with `$1`, `$2`\nand `${3:foo}`. `$0` defines the final tab stop, it defaults to\nthe end of the snippet. Placeholders with equal identifiers are linked,\nthat is typing in one will update others too.\n\nSee also: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#snippet_syntax" - } - ], - "documentation": "Defines whether the insert text in a completion item should be interpreted as\nplain text or a snippet." - }, - { - "name": "InsertTextMode", - "type": { - "kind": "base", - "name": "uinteger" - }, - "values": [ - { - "name": "asIs", - "value": 1, - "documentation": "The insertion or replace strings is taken as it is. If the\nvalue is multi line the lines below the cursor will be\ninserted using the indentation defined in the string value.\nThe client will not apply any kind of adjustments to the\nstring." - }, - { - "name": "adjustIndentation", - "value": 2, - "documentation": "The editor adjusts leading whitespace of new lines so that\nthey match the indentation up to the cursor of the line for\nwhich the item is accepted.\n\nConsider a line like this: <2tabs><3tabs>foo. Accepting a\nmulti line completion item is indented using 2 tabs and all\nfollowing lines inserted will be indented using 2 tabs as well." - } - ], - "documentation": "How whitespace and indentation is handled during completion\nitem insertion.\n\n@since 3.16.0", - "since": "3.16.0" - }, - { - "name": "DocumentHighlightKind", - "type": { - "kind": "base", - "name": "uinteger" - }, - "values": [ - { - "name": "Text", - "value": 1, - "documentation": "A textual occurrence." - }, - { - "name": "Read", - "value": 2, - "documentation": "Read-access of a symbol, like reading a variable." - }, - { - "name": "Write", - "value": 3, - "documentation": "Write-access of a symbol, like writing to a variable." - } - ], - "documentation": "A document highlight kind." - }, - { - "name": "CodeActionKind", - "type": { - "kind": "base", - "name": "string" - }, - "values": [ - { - "name": "Empty", - "value": "", - "documentation": "Empty kind." - }, - { - "name": "QuickFix", - "value": "quickfix", - "documentation": "Base kind for quickfix actions: 'quickfix'" - }, - { - "name": "Refactor", - "value": "refactor", - "documentation": "Base kind for refactoring actions: 'refactor'" - }, - { - "name": "RefactorExtract", - "value": "refactor.extract", - "documentation": "Base kind for refactoring extraction actions: 'refactor.extract'\n\nExample extract actions:\n\n- Extract method\n- Extract function\n- Extract variable\n- Extract interface from class\n- ..." - }, - { - "name": "RefactorInline", - "value": "refactor.inline", - "documentation": "Base kind for refactoring inline actions: 'refactor.inline'\n\nExample inline actions:\n\n- Inline function\n- Inline variable\n- Inline constant\n- ..." - }, - { - "name": "RefactorRewrite", - "value": "refactor.rewrite", - "documentation": "Base kind for refactoring rewrite actions: 'refactor.rewrite'\n\nExample rewrite actions:\n\n- Convert JavaScript function to class\n- Add or remove parameter\n- Encapsulate field\n- Make method static\n- Move method to base class\n- ..." - }, - { - "name": "Source", - "value": "source", - "documentation": "Base kind for source actions: `source`\n\nSource code actions apply to the entire file." - }, - { - "name": "SourceOrganizeImports", - "value": "source.organizeImports", - "documentation": "Base kind for an organize imports source action: `source.organizeImports`" - }, - { - "name": "SourceFixAll", - "value": "source.fixAll", - "documentation": "Base kind for auto-fix source actions: `source.fixAll`.\n\nFix all actions automatically fix errors that have a clear fix that do not require user input.\nThey should not suppress errors or perform unsafe fixes such as generating new types or classes.\n\n@since 3.15.0", - "since": "3.15.0" - } - ], - "supportsCustomValues": true, - "documentation": "A set of predefined code action kinds" - }, - { - "name": "TraceValues", - "type": { - "kind": "base", - "name": "string" - }, - "values": [ - { - "name": "Off", - "value": "off", - "documentation": "Turn tracing off." - }, - { - "name": "Messages", - "value": "messages", - "documentation": "Trace messages only." - }, - { - "name": "Verbose", - "value": "verbose", - "documentation": "Verbose message tracing." - } - ] - }, - { - "name": "MarkupKind", - "type": { - "kind": "base", - "name": "string" - }, - "values": [ - { - "name": "PlainText", - "value": "plaintext", - "documentation": "Plain text is supported as a content format" - }, - { - "name": "Markdown", - "value": "markdown", - "documentation": "Markdown is supported as a content format" - } - ], - "documentation": "Describes the content type that a client supports in various\nresult literals like `Hover`, `ParameterInfo` or `CompletionItem`.\n\nPlease note that `MarkupKinds` must not start with a `$`. This kinds\nare reserved for internal usage." - }, - { - "name": "PositionEncodingKind", - "type": { - "kind": "base", - "name": "string" - }, - "values": [ - { - "name": "UTF8", - "value": "utf-8", - "documentation": "Character offsets count UTF-8 code units." - }, - { - "name": "UTF16", - "value": "utf-16", - "documentation": "Character offsets count UTF-16 code units.\n\nThis is the default and must always be supported\nby servers" - }, - { - "name": "UTF32", - "value": "utf-32", - "documentation": "Character offsets count UTF-32 code units.\n\nImplementation note: these are the same as Unicode code points,\nso this `PositionEncodingKind` may also be used for an\nencoding-agnostic representation of character offsets." - } - ], - "supportsCustomValues": true, - "documentation": "A set of predefined position encoding kinds.\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "name": "FileChangeType", - "type": { - "kind": "base", - "name": "uinteger" - }, - "values": [ - { - "name": "Created", - "value": 1, - "documentation": "The file got created." - }, - { - "name": "Changed", - "value": 2, - "documentation": "The file got changed." - }, - { - "name": "Deleted", - "value": 3, - "documentation": "The file got deleted." - } - ], - "documentation": "The file event type" - }, - { - "name": "WatchKind", - "type": { - "kind": "base", - "name": "uinteger" - }, - "values": [ - { - "name": "Create", - "value": 1, - "documentation": "Interested in create events." - }, - { - "name": "Change", - "value": 2, - "documentation": "Interested in change events" - }, - { - "name": "Delete", - "value": 4, - "documentation": "Interested in delete events" - } - ], - "supportsCustomValues": true - }, - { - "name": "DiagnosticSeverity", - "type": { - "kind": "base", - "name": "uinteger" - }, - "values": [ - { - "name": "Error", - "value": 1, - "documentation": "Reports an error." - }, - { - "name": "Warning", - "value": 2, - "documentation": "Reports a warning." - }, - { - "name": "Information", - "value": 3, - "documentation": "Reports an information." - }, - { - "name": "Hint", - "value": 4, - "documentation": "Reports a hint." - } - ], - "documentation": "The diagnostic's severity." - }, - { - "name": "DiagnosticTag", - "type": { - "kind": "base", - "name": "uinteger" - }, - "values": [ - { - "name": "Unnecessary", - "value": 1, - "documentation": "Unused or unnecessary code.\n\nClients are allowed to render diagnostics with this tag faded out instead of having\nan error squiggle." - }, - { - "name": "Deprecated", - "value": 2, - "documentation": "Deprecated or obsolete code.\n\nClients are allowed to rendered diagnostics with this tag strike through." - } - ], - "documentation": "The diagnostic tags.\n\n@since 3.15.0", - "since": "3.15.0" - }, - { - "name": "CompletionTriggerKind", - "type": { - "kind": "base", - "name": "uinteger" - }, - "values": [ - { - "name": "Invoked", - "value": 1, - "documentation": "Completion was triggered by typing an identifier (24x7 code\ncomplete), manual invocation (e.g Ctrl+Space) or via API." - }, - { - "name": "TriggerCharacter", - "value": 2, - "documentation": "Completion was triggered by a trigger character specified by\nthe `triggerCharacters` properties of the `CompletionRegistrationOptions`." - }, - { - "name": "TriggerForIncompleteCompletions", - "value": 3, - "documentation": "Completion was re-triggered as current completion list is incomplete" - } - ], - "documentation": "How a completion was triggered" - }, - { - "name": "SignatureHelpTriggerKind", - "type": { - "kind": "base", - "name": "uinteger" - }, - "values": [ - { - "name": "Invoked", - "value": 1, - "documentation": "Signature help was invoked manually by the user or by a command." - }, - { - "name": "TriggerCharacter", - "value": 2, - "documentation": "Signature help was triggered by a trigger character." - }, - { - "name": "ContentChange", - "value": 3, - "documentation": "Signature help was triggered by the cursor moving or by the document content changing." - } - ], - "documentation": "How a signature help was triggered.\n\n@since 3.15.0", - "since": "3.15.0" - }, - { - "name": "CodeActionTriggerKind", - "type": { - "kind": "base", - "name": "uinteger" - }, - "values": [ - { - "name": "Invoked", - "value": 1, - "documentation": "Code actions were explicitly requested by the user or by an extension." - }, - { - "name": "Automatic", - "value": 2, - "documentation": "Code actions were requested automatically.\n\nThis typically happens when current selection in a file changes, but can\nalso be triggered when file content changes." - } - ], - "documentation": "The reason why code actions were requested.\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "name": "FileOperationPatternKind", - "type": { - "kind": "base", - "name": "string" - }, - "values": [ - { - "name": "file", - "value": "file", - "documentation": "The pattern matches a file only." - }, - { - "name": "folder", - "value": "folder", - "documentation": "The pattern matches a folder only." - } - ], - "documentation": "A pattern kind describing if a glob pattern matches a file a folder or\nboth.\n\n@since 3.16.0", - "since": "3.16.0" - }, - { - "name": "NotebookCellKind", - "type": { - "kind": "base", - "name": "uinteger" - }, - "values": [ - { - "name": "Markup", - "value": 1, - "documentation": "A markup-cell is formatted source that is used for display." - }, - { - "name": "Code", - "value": 2, - "documentation": "A code-cell is source code." - } - ], - "documentation": "A notebook cell kind.\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "name": "ResourceOperationKind", - "type": { - "kind": "base", - "name": "string" - }, - "values": [ - { - "name": "Create", - "value": "create", - "documentation": "Supports creating new files and folders." - }, - { - "name": "Rename", - "value": "rename", - "documentation": "Supports renaming existing files and folders." - }, - { - "name": "Delete", - "value": "delete", - "documentation": "Supports deleting existing files and folders." - } - ] - }, - { - "name": "FailureHandlingKind", - "type": { - "kind": "base", - "name": "string" - }, - "values": [ - { - "name": "Abort", - "value": "abort", - "documentation": "Applying the workspace change is simply aborted if one of the changes provided\nfails. All operations executed before the failing operation stay executed." - }, - { - "name": "Transactional", - "value": "transactional", - "documentation": "All operations are executed transactional. That means they either all\nsucceed or no changes at all are applied to the workspace." - }, - { - "name": "TextOnlyTransactional", - "value": "textOnlyTransactional", - "documentation": "If the workspace edit contains only textual file changes they are executed transactional.\nIf resource changes (create, rename or delete file) are part of the change the failure\nhandling strategy is abort." - }, - { - "name": "Undo", - "value": "undo", - "documentation": "The client tries to undo the operations already executed. But there is no\nguarantee that this is succeeding." - } - ] - }, - { - "name": "PrepareSupportDefaultBehavior", - "type": { - "kind": "base", - "name": "uinteger" - }, - "values": [ - { - "name": "Identifier", - "value": 1, - "documentation": "The client's default behavior is to select the identifier\naccording the to language's syntax rule." - } - ] - }, - { - "name": "TokenFormat", - "type": { - "kind": "base", - "name": "string" - }, - "values": [ - { - "name": "Relative", - "value": "relative" - } - ] - } - ], - "typeAliases": [ - { - "name": "Definition", - "type": { - "kind": "or", - "items": [ - { - "kind": "reference", - "name": "Location" - }, - { - "kind": "array", - "element": { - "kind": "reference", - "name": "Location" - } - } - ] - }, - "documentation": "The definition of a symbol represented as one or many [locations](#Location).\nFor most programming languages there is only one location at which a symbol is\ndefined.\n\nServers should prefer returning `DefinitionLink` over `Definition` if supported\nby the client." - }, - { - "name": "DefinitionLink", - "type": { - "kind": "reference", - "name": "LocationLink" - }, - "documentation": "Information about where a symbol is defined.\n\nProvides additional metadata over normal [location](#Location) definitions, including the range of\nthe defining symbol" - }, - { - "name": "LSPArray", - "type": { - "kind": "array", - "element": { - "kind": "reference", - "name": "LSPAny" - } - }, - "documentation": "LSP arrays.\n@since 3.17.0", - "since": "3.17.0" - }, - { - "name": "LSPAny", - "type": { - "kind": "or", - "items": [ - { - "kind": "reference", - "name": "LSPObject" - }, - { - "kind": "reference", - "name": "LSPArray" - }, - { - "kind": "base", - "name": "string" - }, - { - "kind": "base", - "name": "integer" - }, - { - "kind": "base", - "name": "uinteger" - }, - { - "kind": "base", - "name": "decimal" - }, - { - "kind": "base", - "name": "boolean" - }, - { - "kind": "base", - "name": "null" - } - ] - }, - "documentation": "The LSP any type.\nPlease note that strictly speaking a property with the value `undefined`\ncan't be converted into JSON preserving the property name. However for\nconvenience it is allowed and assumed that all these properties are\noptional as well.\n@since 3.17.0", - "since": "3.17.0" - }, - { - "name": "Declaration", - "type": { - "kind": "or", - "items": [ - { - "kind": "reference", - "name": "Location" - }, - { - "kind": "array", - "element": { - "kind": "reference", - "name": "Location" - } - } - ] - }, - "documentation": "The declaration of a symbol representation as one or many [locations](#Location)." - }, - { - "name": "DeclarationLink", - "type": { - "kind": "reference", - "name": "LocationLink" - }, - "documentation": "Information about where a symbol is declared.\n\nProvides additional metadata over normal [location](#Location) declarations, including the range of\nthe declaring symbol.\n\nServers should prefer returning `DeclarationLink` over `Declaration` if supported\nby the client." - }, - { - "name": "InlineValue", - "type": { - "kind": "or", - "items": [ - { - "kind": "reference", - "name": "InlineValueText" - }, - { - "kind": "reference", - "name": "InlineValueVariableLookup" - }, - { - "kind": "reference", - "name": "InlineValueEvaluatableExpression" - } - ] - }, - "documentation": "Inline value information can be provided by different means:\n- directly as a text value (class InlineValueText).\n- as a name to use for a variable lookup (class InlineValueVariableLookup)\n- as an evaluatable expression (class InlineValueEvaluatableExpression)\nThe InlineValue types combines all inline value types into one type.\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "name": "DocumentDiagnosticReport", - "type": { - "kind": "or", - "items": [ - { - "kind": "reference", - "name": "RelatedFullDocumentDiagnosticReport" - }, - { - "kind": "reference", - "name": "RelatedUnchangedDocumentDiagnosticReport" - } - ] - }, - "documentation": "The result of a document diagnostic pull request. A report can\neither be a full report containing all diagnostics for the\nrequested document or an unchanged report indicating that nothing\nhas changed in terms of diagnostics in comparison to the last\npull request.\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "name": "PrepareRenameResult", - "type": { - "kind": "or", - "items": [ - { - "kind": "reference", - "name": "Range" - }, - { - "kind": "literal", - "value": { - "properties": [ - { - "name": "range", - "type": { - "kind": "reference", - "name": "Range" - } - }, - { - "name": "placeholder", - "type": { - "kind": "base", - "name": "string" - } - } - ] - } - }, - { - "kind": "literal", - "value": { - "properties": [ - { - "name": "defaultBehavior", - "type": { - "kind": "base", - "name": "boolean" - } - } - ] - } - } - ] - } - }, - { - "name": "ProgressToken", - "type": { - "kind": "or", - "items": [ - { - "kind": "base", - "name": "integer" - }, - { - "kind": "base", - "name": "string" - } - ] - } - }, - { - "name": "DocumentSelector", - "type": { - "kind": "array", - "element": { - "kind": "reference", - "name": "DocumentFilter" - } - }, - "documentation": "A document selector is the combination of one or many document filters.\n\n@sample `let sel:DocumentSelector = [{ language: 'typescript' }, { language: 'json', pattern: '**∕tsconfig.json' }]`;\n\nThe use of a string as a document filter is deprecated @since 3.16.0.", - "since": "3.16.0." - }, - { - "name": "ChangeAnnotationIdentifier", - "type": { - "kind": "base", - "name": "string" - }, - "documentation": "An identifier to refer to a change annotation stored with a workspace edit." - }, - { - "name": "WorkspaceDocumentDiagnosticReport", - "type": { - "kind": "or", - "items": [ - { - "kind": "reference", - "name": "WorkspaceFullDocumentDiagnosticReport" - }, - { - "kind": "reference", - "name": "WorkspaceUnchangedDocumentDiagnosticReport" - } - ] - }, - "documentation": "A workspace diagnostic document report.\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "name": "TextDocumentContentChangeEvent", - "type": { - "kind": "or", - "items": [ - { - "kind": "literal", - "value": { - "properties": [ - { - "name": "range", - "type": { - "kind": "reference", - "name": "Range" - }, - "documentation": "The range of the document that changed." - }, - { - "name": "rangeLength", - "type": { - "kind": "base", - "name": "uinteger" - }, - "optional": true, - "documentation": "The optional length of the range that got replaced.\n\n@deprecated use range instead." - }, - { - "name": "text", - "type": { - "kind": "base", - "name": "string" - }, - "documentation": "The new text for the provided range." - } - ] - } - }, - { - "kind": "literal", - "value": { - "properties": [ - { - "name": "text", - "type": { - "kind": "base", - "name": "string" - }, - "documentation": "The new text of the whole document." - } - ] - } - } - ] - }, - "documentation": "An event describing a change to a text document. If only a text is provided\nit is considered to be the full content of the document." - }, - { - "name": "MarkedString", - "type": { - "kind": "or", - "items": [ - { - "kind": "base", - "name": "string" - }, - { - "kind": "literal", - "value": { - "properties": [ - { - "name": "language", - "type": { - "kind": "base", - "name": "string" - } - }, - { - "name": "value", - "type": { - "kind": "base", - "name": "string" - } - } - ] - } - } - ] - }, - "documentation": "MarkedString can be used to render human readable text. It is either a markdown string\nor a code-block that provides a language and a code snippet. The language identifier\nis semantically equal to the optional language identifier in fenced code blocks in GitHub\nissues. See https://help.github.com/articles/creating-and-highlighting-code-blocks/#syntax-highlighting\n\nThe pair of a language and a value is an equivalent to markdown:\n```${language}\n${value}\n```\n\nNote that markdown strings will be sanitized - that means html will be escaped.\n@deprecated use MarkupContent instead." - }, - { - "name": "DocumentFilter", - "type": { - "kind": "or", - "items": [ - { - "kind": "reference", - "name": "TextDocumentFilter" - }, - { - "kind": "reference", - "name": "NotebookCellTextDocumentFilter" - } - ] - }, - "documentation": "A document filter describes a top level text document or\na notebook cell document.\n\n@since 3.17.0 - proposed support for NotebookCellTextDocumentFilter.", - "since": "3.17.0 - proposed support for NotebookCellTextDocumentFilter." - }, - { - "name": "GlobPattern", - "type": { - "kind": "or", - "items": [ - { - "kind": "reference", - "name": "Pattern" - }, - { - "kind": "reference", - "name": "RelativePattern" - } - ] - }, - "documentation": "The glob pattern. Either a string pattern or a relative pattern.\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "name": "TextDocumentFilter", - "type": { - "kind": "or", - "items": [ - { - "kind": "literal", - "value": { - "properties": [ - { - "name": "language", - "type": { - "kind": "base", - "name": "string" - }, - "documentation": "A language id, like `typescript`." - }, - { - "name": "scheme", - "type": { - "kind": "base", - "name": "string" - }, - "optional": true, - "documentation": "A Uri [scheme](#Uri.scheme), like `file` or `untitled`." - }, - { - "name": "pattern", - "type": { - "kind": "base", - "name": "string" - }, - "optional": true, - "documentation": "A glob pattern, like `*.{ts,js}`." - } - ] - } - }, - { - "kind": "literal", - "value": { - "properties": [ - { - "name": "language", - "type": { - "kind": "base", - "name": "string" - }, - "optional": true, - "documentation": "A language id, like `typescript`." - }, - { - "name": "scheme", - "type": { - "kind": "base", - "name": "string" - }, - "documentation": "A Uri [scheme](#Uri.scheme), like `file` or `untitled`." - }, - { - "name": "pattern", - "type": { - "kind": "base", - "name": "string" - }, - "optional": true, - "documentation": "A glob pattern, like `*.{ts,js}`." - } - ] - } - }, - { - "kind": "literal", - "value": { - "properties": [ - { - "name": "language", - "type": { - "kind": "base", - "name": "string" - }, - "optional": true, - "documentation": "A language id, like `typescript`." - }, - { - "name": "scheme", - "type": { - "kind": "base", - "name": "string" - }, - "optional": true, - "documentation": "A Uri [scheme](#Uri.scheme), like `file` or `untitled`." - }, - { - "name": "pattern", - "type": { - "kind": "base", - "name": "string" - }, - "documentation": "A glob pattern, like `*.{ts,js}`." - } - ] - } - } - ] - }, - "documentation": "A document filter denotes a document by different properties like\nthe [language](#TextDocument.languageId), the [scheme](#Uri.scheme) of\nits resource, or a glob-pattern that is applied to the [path](#TextDocument.fileName).\n\nGlob patterns can have the following syntax:\n- `*` to match one or more characters in a path segment\n- `?` to match on one character in a path segment\n- `**` to match any number of path segments, including none\n- `{}` to group sub patterns into an OR expression. (e.g. `**​/*.{ts,js}` matches all TypeScript and JavaScript files)\n- `[]` to declare a range of characters to match in a path segment (e.g., `example.[0-9]` to match on `example.0`, `example.1`, …)\n- `[!...]` to negate a range of characters to match in a path segment (e.g., `example.[!0-9]` to match on `example.a`, `example.b`, but not `example.0`)\n\n@sample A language filter that applies to typescript files on disk: `{ language: 'typescript', scheme: 'file' }`\n@sample A language filter that applies to all package.json paths: `{ language: 'json', pattern: '**package.json' }`\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "name": "NotebookDocumentFilter", - "type": { - "kind": "or", - "items": [ - { - "kind": "literal", - "value": { - "properties": [ - { - "name": "notebookType", - "type": { - "kind": "base", - "name": "string" - }, - "documentation": "The type of the enclosing notebook." - }, - { - "name": "scheme", - "type": { - "kind": "base", - "name": "string" - }, - "optional": true, - "documentation": "A Uri [scheme](#Uri.scheme), like `file` or `untitled`." - }, - { - "name": "pattern", - "type": { - "kind": "base", - "name": "string" - }, - "optional": true, - "documentation": "A glob pattern." - } - ] - } - }, - { - "kind": "literal", - "value": { - "properties": [ - { - "name": "notebookType", - "type": { - "kind": "base", - "name": "string" - }, - "optional": true, - "documentation": "The type of the enclosing notebook." - }, - { - "name": "scheme", - "type": { - "kind": "base", - "name": "string" - }, - "documentation": "A Uri [scheme](#Uri.scheme), like `file` or `untitled`." - }, - { - "name": "pattern", - "type": { - "kind": "base", - "name": "string" - }, - "optional": true, - "documentation": "A glob pattern." - } - ] - } - }, - { - "kind": "literal", - "value": { - "properties": [ - { - "name": "notebookType", - "type": { - "kind": "base", - "name": "string" - }, - "optional": true, - "documentation": "The type of the enclosing notebook." - }, - { - "name": "scheme", - "type": { - "kind": "base", - "name": "string" - }, - "optional": true, - "documentation": "A Uri [scheme](#Uri.scheme), like `file` or `untitled`." - }, - { - "name": "pattern", - "type": { - "kind": "base", - "name": "string" - }, - "documentation": "A glob pattern." - } - ] - } - } - ] - }, - "documentation": "A notebook document filter denotes a notebook document by\ndifferent properties. The properties will be match\nagainst the notebook's URI (same as with documents)\n\n@since 3.17.0", - "since": "3.17.0" - }, - { - "name": "Pattern", - "type": { - "kind": "base", - "name": "string" - }, - "documentation": "The glob pattern to watch relative to the base path. Glob patterns can have the following syntax:\n- `*` to match one or more characters in a path segment\n- `?` to match on one character in a path segment\n- `**` to match any number of path segments, including none\n- `{}` to group conditions (e.g. `**​/*.{ts,js}` matches all TypeScript and JavaScript files)\n- `[]` to declare a range of characters to match in a path segment (e.g., `example.[0-9]` to match on `example.0`, `example.1`, …)\n- `[!...]` to negate a range of characters to match in a path segment (e.g., `example.[!0-9]` to match on `example.a`, `example.b`, but not `example.0`)\n\n@since 3.17.0", - "since": "3.17.0" - } - ] -} diff --git a/apps/language_server/lib/mix/tasks/lsp/type_mappings.json b/apps/language_server/lib/mix/tasks/lsp/type_mappings.json deleted file mode 100644 index 399bdda51..000000000 --- a/apps/language_server/lib/mix/tasks/lsp/type_mappings.json +++ /dev/null @@ -1,1852 +0,0 @@ -[ - { - "destination": "TextEdit.Annotated", - "imported_version": "3.17", - "source": "AnnotatedTextEdit" - }, - { - "destination": "ApplyWorkspaceEdit.Params", - "imported_version": "3.17", - "source": "ApplyWorkspaceEditParams" - }, - { - "destination": "ApplyWorkspaceEdit.Result", - "imported_version": "3.17", - "source": "ApplyWorkspaceEditResult" - }, - { - "destination": "BaseSymbolInformation", - "imported_version": "3.17", - "source": "BaseSymbolInformation" - }, - { - "destination": "CallHierarchy.ClientCapabilities", - "imported_version": "3.17", - "source": "CallHierarchyClientCapabilities" - }, - { - "destination": "CallHierarchy.IncomingCall", - "imported_version": "3.17", - "source": "CallHierarchyIncomingCall" - }, - { - "destination": "CallHierarchy.IncomingCalls.Params", - "imported_version": "3.17", - "source": "CallHierarchyIncomingCallsParams" - }, - { - "destination": "CallHierarchy.Item", - "imported_version": "3.17", - "source": "CallHierarchyItem" - }, - { - "destination": "CallHierarchy.Options", - "imported_version": "3.17", - "source": "CallHierarchyOptions" - }, - { - "destination": "CallHierarchy.OutgoingCall", - "imported_version": "3.17", - "source": "CallHierarchyOutgoingCall" - }, - { - "destination": "CallHierarchy.OutgoingCalls.Params", - "imported_version": "3.17", - "source": "CallHierarchyOutgoingCallsParams" - }, - { - "destination": "CallHierarchy.Prepare.Params", - "imported_version": "3.17", - "source": "CallHierarchyPrepareParams" - }, - { - "destination": "CallHierarchy.Registration.Options", - "imported_version": "3.17", - "source": "CallHierarchyRegistrationOptions" - }, - { - "destination": "Cancel.Params", - "imported_version": "3.17", - "source": "CancelParams" - }, - { - "destination": "ChangeAnnotation", - "imported_version": "3.17", - "source": "ChangeAnnotation" - }, - { - "destination": "ChangeAnnotation.Identifier", - "imported_version": "3.17", - "source": "ChangeAnnotationIdentifier" - }, - { - "destination": "ClientCapabilities", - "imported_version": "3.17", - "source": "ClientCapabilities" - }, - { - "destination": "CodeAction", - "imported_version": "3.17", - "source": "CodeAction" - }, - { - "destination": "CodeAction.ClientCapabilities", - "imported_version": "3.17", - "source": "CodeActionClientCapabilities" - }, - { - "destination": "CodeAction.Context", - "imported_version": "3.17", - "source": "CodeActionContext" - }, - { - "destination": "CodeAction.Kind", - "imported_version": "3.17", - "source": "CodeActionKind" - }, - { - "destination": "CodeAction.Options", - "imported_version": "3.17", - "source": "CodeActionOptions" - }, - { - "destination": "CodeAction.Params", - "imported_version": "3.17", - "source": "CodeActionParams" - }, - { - "destination": "CodeAction.Registration.Options", - "imported_version": "3.17", - "source": "CodeActionRegistrationOptions" - }, - { - "destination": "CodeAction.Trigger.Kind", - "imported_version": "3.17", - "source": "CodeActionTriggerKind" - }, - { - "destination": "CodeDescription", - "imported_version": "3.17", - "source": "CodeDescription" - }, - { - "destination": "CodeLens", - "imported_version": "3.17", - "source": "CodeLens" - }, - { - "destination": "CodeLens.ClientCapabilities", - "imported_version": "3.17", - "source": "CodeLensClientCapabilities" - }, - { - "destination": "CodeLens.Options", - "imported_version": "3.17", - "source": "CodeLensOptions" - }, - { - "destination": "CodeLens.Params", - "imported_version": "3.17", - "source": "CodeLensParams" - }, - { - "destination": "CodeLens.Registration.Options", - "imported_version": "3.17", - "source": "CodeLensRegistrationOptions" - }, - { - "destination": "CodeLens.Workspace.ClientCapabilities", - "imported_version": "3.17", - "source": "CodeLensWorkspaceClientCapabilities" - }, - { - "destination": "Color", - "imported_version": "3.17", - "source": "Color" - }, - { - "destination": "Color.Information", - "imported_version": "3.17", - "source": "ColorInformation" - }, - { - "destination": "Color.Presentation", - "imported_version": "3.17", - "source": "ColorPresentation" - }, - { - "destination": "Color.Presentation.Params", - "imported_version": "3.17", - "source": "ColorPresentationParams" - }, - { - "destination": "Command", - "imported_version": "3.17", - "source": "Command" - }, - { - "destination": "Completion.ClientCapabilities", - "imported_version": "3.17", - "source": "CompletionClientCapabilities" - }, - { - "destination": "Completion.Context", - "imported_version": "3.17", - "source": "CompletionContext" - }, - { - "destination": "Completion.Item", - "imported_version": "3.17", - "source": "CompletionItem" - }, - { - "destination": "Completion.Item.Kind", - "imported_version": "3.17", - "source": "CompletionItemKind" - }, - { - "destination": "Completion.Item.LabelDetails", - "imported_version": "3.17", - "source": "CompletionItemLabelDetails" - }, - { - "destination": "Completion.Item.Tag", - "imported_version": "3.17", - "source": "CompletionItemTag" - }, - { - "destination": "Completion.List", - "imported_version": "3.17", - "source": "CompletionList" - }, - { - "destination": "Completion.Options", - "imported_version": "3.17", - "source": "CompletionOptions" - }, - { - "destination": "Completion.Params", - "imported_version": "3.17", - "source": "CompletionParams" - }, - { - "destination": "Completion.Registration.Options", - "imported_version": "3.17", - "source": "CompletionRegistrationOptions" - }, - { - "destination": "Completion.Trigger.Kind", - "imported_version": "3.17", - "source": "CompletionTriggerKind" - }, - { - "destination": "Configuration.Item", - "imported_version": "3.17", - "source": "ConfigurationItem" - }, - { - "destination": "Configuration.Params", - "imported_version": "3.17", - "source": "ConfigurationParams" - }, - { - "destination": "CreateFile", - "imported_version": "3.17", - "source": "CreateFile" - }, - { - "destination": "CreateFile.Options", - "imported_version": "3.17", - "source": "CreateFileOptions" - }, - { - "destination": "CreateFiles.Params", - "imported_version": "3.17", - "source": "CreateFilesParams" - }, - { - "destination": "Declaration", - "imported_version": "3.17", - "source": "Declaration" - }, - { - "destination": "Declaration.ClientCapabilities", - "imported_version": "3.17", - "source": "DeclarationClientCapabilities" - }, - { - "destination": "Declaration.Link", - "imported_version": "3.17", - "source": "DeclarationLink" - }, - { - "destination": "Declaration.Options", - "imported_version": "3.17", - "source": "DeclarationOptions" - }, - { - "destination": "Declaration.Params", - "imported_version": "3.17", - "source": "DeclarationParams" - }, - { - "destination": "Declaration.Registration.Options", - "imported_version": "3.17", - "source": "DeclarationRegistrationOptions" - }, - { - "destination": "Definition", - "imported_version": "3.17", - "source": "Definition" - }, - { - "destination": "Definition.ClientCapabilities", - "imported_version": "3.17", - "source": "DefinitionClientCapabilities" - }, - { - "destination": "Definition.Link", - "imported_version": "3.17", - "source": "DefinitionLink" - }, - { - "destination": "Definition.Options", - "imported_version": "3.17", - "source": "DefinitionOptions" - }, - { - "destination": "Definition.Params", - "imported_version": "3.17", - "source": "DefinitionParams" - }, - { - "destination": "Definition.Registration.Options", - "imported_version": "3.17", - "source": "DefinitionRegistrationOptions" - }, - { - "destination": "DeleteFile", - "imported_version": "3.17", - "source": "DeleteFile" - }, - { - "destination": "DeleteFile.Options", - "imported_version": "3.17", - "source": "DeleteFileOptions" - }, - { - "destination": "DeleteFiles.Params", - "imported_version": "3.17", - "source": "DeleteFilesParams" - }, - { - "destination": "Diagnostic", - "imported_version": "3.17", - "source": "Diagnostic" - }, - { - "destination": "Diagnostic.ClientCapabilities", - "imported_version": "3.17", - "source": "DiagnosticClientCapabilities" - }, - { - "destination": "Diagnostic.Options", - "imported_version": "3.17", - "source": "DiagnosticOptions" - }, - { - "destination": "Diagnostic.Registration.Options", - "imported_version": "3.17", - "source": "DiagnosticRegistrationOptions" - }, - { - "destination": "Diagnostic.RelatedInformation", - "imported_version": "3.17", - "source": "DiagnosticRelatedInformation" - }, - { - "destination": "Diagnostic.ServerCancellationData", - "imported_version": "3.17", - "source": "DiagnosticServerCancellationData" - }, - { - "destination": "Diagnostic.Severity", - "imported_version": "3.17", - "source": "DiagnosticSeverity" - }, - { - "destination": "Diagnostic.Tag", - "imported_version": "3.17", - "source": "DiagnosticTag" - }, - { - "destination": "Diagnostic.Workspace.ClientCapabilities", - "imported_version": "3.17", - "source": "DiagnosticWorkspaceClientCapabilities" - }, - { - "destination": "DidChangeConfiguration.ClientCapabilities", - "imported_version": "3.17", - "source": "DidChangeConfigurationClientCapabilities" - }, - { - "destination": "DidChangeConfiguration.Params", - "imported_version": "3.17", - "source": "DidChangeConfigurationParams" - }, - { - "destination": "DidChangeConfiguration.Registration.Options", - "imported_version": "3.17", - "source": "DidChangeConfigurationRegistrationOptions" - }, - { - "destination": "DidChangeNotebookDocument.Params", - "imported_version": "3.17", - "source": "DidChangeNotebookDocumentParams" - }, - { - "destination": "DidChangeTextDocument.Params", - "imported_version": "3.17", - "source": "DidChangeTextDocumentParams" - }, - { - "destination": "DidChangeWatchedFiles.ClientCapabilities", - "imported_version": "3.17", - "source": "DidChangeWatchedFilesClientCapabilities" - }, - { - "destination": "DidChangeWatchedFiles.Params", - "imported_version": "3.17", - "source": "DidChangeWatchedFilesParams" - }, - { - "destination": "DidChangeWatchedFiles.Registration.Options", - "imported_version": "3.17", - "source": "DidChangeWatchedFilesRegistrationOptions" - }, - { - "destination": "DidChangeWorkspaceFolders.Params", - "imported_version": "3.17", - "source": "DidChangeWorkspaceFoldersParams" - }, - { - "destination": "DidCloseNotebookDocument.Params", - "imported_version": "3.17", - "source": "DidCloseNotebookDocumentParams" - }, - { - "destination": "DidCloseTextDocument.Params", - "imported_version": "3.17", - "source": "DidCloseTextDocumentParams" - }, - { - "destination": "DidOpenNotebookDocument.Params", - "imported_version": "3.17", - "source": "DidOpenNotebookDocumentParams" - }, - { - "destination": "DidOpenTextDocument.Params", - "imported_version": "3.17", - "source": "DidOpenTextDocumentParams" - }, - { - "destination": "DidSaveNotebookDocument.Params", - "imported_version": "3.17", - "source": "DidSaveNotebookDocumentParams" - }, - { - "destination": "DidSaveTextDocument.Params", - "imported_version": "3.17", - "source": "DidSaveTextDocumentParams" - }, - { - "destination": "Document.Color.ClientCapabilities", - "imported_version": "3.17", - "source": "DocumentColorClientCapabilities" - }, - { - "destination": "Document.Color.Options", - "imported_version": "3.17", - "source": "DocumentColorOptions" - }, - { - "destination": "Document.Color.Params", - "imported_version": "3.17", - "source": "DocumentColorParams" - }, - { - "destination": "Document.Color.Registration.Options", - "imported_version": "3.17", - "source": "DocumentColorRegistrationOptions" - }, - { - "destination": "Document.Diagnostic.Params", - "imported_version": "3.17", - "source": "DocumentDiagnosticParams" - }, - { - "destination": "DocumentDiagnosticReport", - "imported_version": "3.17", - "source": "DocumentDiagnosticReport" - }, - { - "destination": "Document.DiagnosticReport.Kind", - "imported_version": "3.17", - "source": "DocumentDiagnosticReportKind" - }, - { - "destination": "Document.DiagnosticReport.PartialResult", - "imported_version": "3.17", - "source": "DocumentDiagnosticReportPartialResult" - }, - { - "destination": "Document.Filter", - "imported_version": "3.17", - "source": "DocumentFilter" - }, - { - "destination": "Document.Formatting.ClientCapabilities", - "imported_version": "3.17", - "source": "DocumentFormattingClientCapabilities" - }, - { - "destination": "Document.Formatting.Options", - "imported_version": "3.17", - "source": "DocumentFormattingOptions" - }, - { - "destination": "Document.Formatting.Params", - "imported_version": "3.17", - "source": "DocumentFormattingParams" - }, - { - "destination": "Document.Formatting.Registration.Options", - "imported_version": "3.17", - "source": "DocumentFormattingRegistrationOptions" - }, - { - "destination": "Document.Highlight", - "imported_version": "3.17", - "source": "DocumentHighlight" - }, - { - "destination": "Document.Highlight.ClientCapabilities", - "imported_version": "3.17", - "source": "DocumentHighlightClientCapabilities" - }, - { - "destination": "Document.HighlightKind", - "imported_version": "3.17", - "source": "DocumentHighlightKind" - }, - { - "destination": "Document.Highlight.Options", - "imported_version": "3.17", - "source": "DocumentHighlightOptions" - }, - { - "destination": "Document.Highlight.Params", - "imported_version": "3.17", - "source": "DocumentHighlightParams" - }, - { - "destination": "Document.Highlight.Registration.Options", - "imported_version": "3.17", - "source": "DocumentHighlightRegistrationOptions" - }, - { - "destination": "Document.Link", - "imported_version": "3.17", - "source": "DocumentLink" - }, - { - "destination": "Document.Link.ClientCapabilities", - "imported_version": "3.17", - "source": "DocumentLinkClientCapabilities" - }, - { - "destination": "Document.Link.Options", - "imported_version": "3.17", - "source": "DocumentLinkOptions" - }, - { - "destination": "Document.Link.Params", - "imported_version": "3.17", - "source": "DocumentLinkParams" - }, - { - "destination": "Document.Link.Registration.Options", - "imported_version": "3.17", - "source": "DocumentLinkRegistrationOptions" - }, - { - "destination": "Document.OnTypeFormatting.ClientCapabilities", - "imported_version": "3.17", - "source": "DocumentOnTypeFormattingClientCapabilities" - }, - { - "destination": "Document.OnTypeFormatting.Options", - "imported_version": "3.17", - "source": "DocumentOnTypeFormattingOptions" - }, - { - "destination": "Document.OnTypeFormatting.Params", - "imported_version": "3.17", - "source": "DocumentOnTypeFormattingParams" - }, - { - "destination": "Document.OnTypeFormatting.Registration.Options", - "imported_version": "3.17", - "source": "DocumentOnTypeFormattingRegistrationOptions" - }, - { - "destination": "Document.RangeFormatting.ClientCapabilities", - "imported_version": "3.17", - "source": "DocumentRangeFormattingClientCapabilities" - }, - { - "destination": "Document.RangeFormatting.Options", - "imported_version": "3.17", - "source": "DocumentRangeFormattingOptions" - }, - { - "destination": "Document.RangeFormatting.Params", - "imported_version": "3.17", - "source": "DocumentRangeFormattingParams" - }, - { - "destination": "Document.RangeFormatting.Registration.Options", - "imported_version": "3.17", - "source": "DocumentRangeFormattingRegistrationOptions" - }, - { - "destination": "Document.Selector", - "imported_version": "3.17", - "source": "DocumentSelector" - }, - { - "destination": "Document.Symbol", - "imported_version": "3.17", - "source": "DocumentSymbol" - }, - { - "destination": "Document.Symbol.ClientCapabilities", - "imported_version": "3.17", - "source": "DocumentSymbolClientCapabilities" - }, - { - "destination": "Document.Symbol.Options", - "imported_version": "3.17", - "source": "DocumentSymbolOptions" - }, - { - "destination": "Document.Symbol.Params", - "imported_version": "3.17", - "source": "DocumentSymbolParams" - }, - { - "destination": "Document.Symbol.Registration.Options", - "imported_version": "3.17", - "source": "DocumentSymbolRegistrationOptions" - }, - { - "destination": "ErrorCodes", - "imported_version": "3.17", - "source": "ErrorCodes" - }, - { - "destination": "ExecuteCommand.ClientCapabilities", - "imported_version": "3.17", - "source": "ExecuteCommandClientCapabilities" - }, - { - "destination": "ExecuteCommand.Options", - "imported_version": "3.17", - "source": "ExecuteCommandOptions" - }, - { - "destination": "ExecuteCommand.Params", - "imported_version": "3.17", - "source": "ExecuteCommandParams" - }, - { - "destination": "ExecuteCommand.Registration.Options", - "imported_version": "3.17", - "source": "ExecuteCommandRegistrationOptions" - }, - { - "destination": "ExecutionSummary", - "imported_version": "3.17", - "source": "ExecutionSummary" - }, - { - "destination": "FailureHandling.Kind", - "imported_version": "3.17", - "source": "FailureHandlingKind" - }, - { - "destination": "FileChangeType", - "imported_version": "3.17", - "source": "FileChangeType" - }, - { - "destination": "FileCreate", - "imported_version": "3.17", - "source": "FileCreate" - }, - { - "destination": "FileDelete", - "imported_version": "3.17", - "source": "FileDelete" - }, - { - "destination": "FileEvent", - "imported_version": "3.17", - "source": "FileEvent" - }, - { - "destination": "FileOperation.ClientCapabilities", - "imported_version": "3.17", - "source": "FileOperationClientCapabilities" - }, - { - "destination": "FileOperation.Filter", - "imported_version": "3.17", - "source": "FileOperationFilter" - }, - { - "destination": "FileOperation.Options", - "imported_version": "3.17", - "source": "FileOperationOptions" - }, - { - "destination": "FileOperation.Pattern", - "imported_version": "3.17", - "source": "FileOperationPattern" - }, - { - "destination": "FileOperation.Pattern.Kind", - "imported_version": "3.17", - "source": "FileOperationPatternKind" - }, - { - "destination": "FileOperation.Pattern.Options", - "imported_version": "3.17", - "source": "FileOperationPatternOptions" - }, - { - "destination": "FileOperation.Registration.Options", - "imported_version": "3.17", - "source": "FileOperationRegistrationOptions" - }, - { - "destination": "FileRename", - "imported_version": "3.17", - "source": "FileRename" - }, - { - "destination": "FileSystemWatcher", - "imported_version": "3.17", - "source": "FileSystemWatcher" - }, - { - "destination": "FoldingRange", - "imported_version": "3.17", - "source": "FoldingRange" - }, - { - "destination": "FoldingRange.ClientCapabilities", - "imported_version": "3.17", - "source": "FoldingRangeClientCapabilities" - }, - { - "destination": "FoldingRange.Kind", - "imported_version": "3.17", - "source": "FoldingRangeKind" - }, - { - "destination": "FoldingRange.Options", - "imported_version": "3.17", - "source": "FoldingRangeOptions" - }, - { - "destination": "FoldingRange.Params", - "imported_version": "3.17", - "source": "FoldingRangeParams" - }, - { - "destination": "FoldingRange.Registration.Options", - "imported_version": "3.17", - "source": "FoldingRangeRegistrationOptions" - }, - { - "destination": "Formatting.Options", - "imported_version": "3.17", - "source": "FormattingOptions" - }, - { - "destination": "FullDocumentDiagnosticReport", - "imported_version": "3.17", - "source": "FullDocumentDiagnosticReport" - }, - { - "destination": "General.ClientCapabilities", - "imported_version": "3.17", - "source": "GeneralClientCapabilities" - }, - { - "destination": "GlobPattern", - "imported_version": "3.17", - "source": "GlobPattern" - }, - { - "destination": "Hover", - "imported_version": "3.17", - "source": "Hover" - }, - { - "destination": "Hover.ClientCapabilities", - "imported_version": "3.17", - "source": "HoverClientCapabilities" - }, - { - "destination": "Hover.Options", - "imported_version": "3.17", - "source": "HoverOptions" - }, - { - "destination": "Hover.Params", - "imported_version": "3.17", - "source": "HoverParams" - }, - { - "destination": "Hover.Registration.Options", - "imported_version": "3.17", - "source": "HoverRegistrationOptions" - }, - { - "destination": "Implementation.ClientCapabilities", - "imported_version": "3.17", - "source": "ImplementationClientCapabilities" - }, - { - "destination": "Implementation.Options", - "imported_version": "3.17", - "source": "ImplementationOptions" - }, - { - "destination": "Implementation.Params", - "imported_version": "3.17", - "source": "ImplementationParams" - }, - { - "destination": "Implementation.Registration.Options", - "imported_version": "3.17", - "source": "ImplementationRegistrationOptions" - }, - { - "destination": "Initialize.Error", - "imported_version": "3.17", - "source": "InitializeError" - }, - { - "destination": "Initialize.Params", - "imported_version": "3.17", - "source": "InitializeParams" - }, - { - "destination": "Initialize.Result", - "imported_version": "3.17", - "source": "InitializeResult" - }, - { - "destination": "Initialized.Params", - "imported_version": "3.17", - "source": "InitializedParams" - }, - { - "destination": "InlayHint", - "imported_version": "3.17", - "source": "InlayHint" - }, - { - "destination": "InlayHint.ClientCapabilities", - "imported_version": "3.17", - "source": "InlayHintClientCapabilities" - }, - { - "destination": "InlayHint.Kind", - "imported_version": "3.17", - "source": "InlayHintKind" - }, - { - "destination": "InlayHint.LabelPart", - "imported_version": "3.17", - "source": "InlayHintLabelPart" - }, - { - "destination": "InlayHint.Options", - "imported_version": "3.17", - "source": "InlayHintOptions" - }, - { - "destination": "InlayHint.Params", - "imported_version": "3.17", - "source": "InlayHintParams" - }, - { - "destination": "InlayHint.Registration.Options", - "imported_version": "3.17", - "source": "InlayHintRegistrationOptions" - }, - { - "destination": "InlayHintWorkspace.ClientCapabilities", - "imported_version": "3.17", - "source": "InlayHintWorkspaceClientCapabilities" - }, - { - "destination": "InlineValue", - "imported_version": "3.17", - "source": "InlineValue" - }, - { - "destination": "InlineValue.ClientCapabilities", - "imported_version": "3.17", - "source": "InlineValueClientCapabilities" - }, - { - "destination": "InlineValue.Context", - "imported_version": "3.17", - "source": "InlineValueContext" - }, - { - "destination": "InlineValue.EvaluatableExpression", - "imported_version": "3.17", - "source": "InlineValueEvaluatableExpression" - }, - { - "destination": "InlineValue.Options", - "imported_version": "3.17", - "source": "InlineValueOptions" - }, - { - "destination": "InlineValue.Params", - "imported_version": "3.17", - "source": "InlineValueParams" - }, - { - "destination": "InlineValue.Registration.Options", - "imported_version": "3.17", - "source": "InlineValueRegistrationOptions" - }, - { - "destination": "InlineValue.Text", - "imported_version": "3.17", - "source": "InlineValueText" - }, - { - "destination": "InlineValue.VariableLookup", - "imported_version": "3.17", - "source": "InlineValueVariableLookup" - }, - { - "destination": "InlineValue.Workspace.ClientCapabilities", - "imported_version": "3.17", - "source": "InlineValueWorkspaceClientCapabilities" - }, - { - "destination": "InsertReplaceEdit", - "imported_version": "3.17", - "source": "InsertReplaceEdit" - }, - { - "destination": "InsertTextFormat", - "imported_version": "3.17", - "source": "InsertTextFormat" - }, - { - "destination": "InsertTextMode", - "imported_version": "3.17", - "source": "InsertTextMode" - }, - { - "destination": "LSPAny", - "imported_version": "3.17", - "source": "LSPAny" - }, - { - "destination": "LSPArray", - "imported_version": "3.17", - "source": "LSPArray" - }, - { - "destination": "LSPErrorCodes", - "imported_version": "3.17", - "source": "LSPErrorCodes" - }, - { - "destination": "LSPObject", - "imported_version": "3.17", - "source": "LSPObject" - }, - { - "destination": "LinkedEditingRange.ClientCapabilities", - "imported_version": "3.17", - "source": "LinkedEditingRangeClientCapabilities" - }, - { - "destination": "LinkedEditingRange.Options", - "imported_version": "3.17", - "source": "LinkedEditingRangeOptions" - }, - { - "destination": "LinkedEditingRange.Params", - "imported_version": "3.17", - "source": "LinkedEditingRangeParams" - }, - { - "destination": "LinkedEditingRange.Registration.Options", - "imported_version": "3.17", - "source": "LinkedEditingRangeRegistrationOptions" - }, - { - "destination": "LinkedEditingRanges", - "imported_version": "3.17", - "source": "LinkedEditingRanges" - }, - { - "destination": "Location", - "imported_version": "3.17", - "source": "Location" - }, - { - "destination": "Location.Link", - "imported_version": "3.17", - "source": "LocationLink" - }, - { - "destination": "LogMessage.Params", - "imported_version": "3.17", - "source": "LogMessageParams" - }, - { - "destination": "LogTrace.Params", - "imported_version": "3.17", - "source": "LogTraceParams" - }, - { - "destination": "Markdown.ClientCapabilities", - "imported_version": "3.17", - "source": "MarkdownClientCapabilities" - }, - { - "destination": "MarkedString", - "imported_version": "3.17", - "source": "MarkedString" - }, - { - "destination": "Markup.Content", - "imported_version": "3.17", - "source": "MarkupContent" - }, - { - "destination": "Markup.Kind", - "imported_version": "3.17", - "source": "MarkupKind" - }, - { - "destination": "Message.ActionItem", - "imported_version": "3.17", - "source": "MessageActionItem" - }, - { - "destination": "Message.Type", - "imported_version": "3.17", - "source": "MessageType" - }, - { - "destination": "Moniker", - "imported_version": "3.17", - "source": "Moniker" - }, - { - "destination": "Moniker.ClientCapabilities", - "imported_version": "3.17", - "source": "MonikerClientCapabilities" - }, - { - "destination": "Moniker.Kind", - "imported_version": "3.17", - "source": "MonikerKind" - }, - { - "destination": "Moniker.Options", - "imported_version": "3.17", - "source": "MonikerOptions" - }, - { - "destination": "Moniker.Params", - "imported_version": "3.17", - "source": "MonikerParams" - }, - { - "destination": "Moniker.Registration.Options", - "imported_version": "3.17", - "source": "MonikerRegistrationOptions" - }, - { - "destination": "Notebook.Cell", - "imported_version": "3.17", - "source": "NotebookCell" - }, - { - "destination": "Notebook.Cell.ArrayChange", - "imported_version": "3.17", - "source": "NotebookCellArrayChange" - }, - { - "destination": "Notebook.Cell.Kind", - "imported_version": "3.17", - "source": "NotebookCellKind" - }, - { - "destination": "Notebook.Cell.TextDocument.Filter", - "imported_version": "3.17", - "source": "NotebookCellTextDocumentFilter" - }, - { - "destination": "Notebook.Document", - "imported_version": "3.17", - "source": "NotebookDocument" - }, - { - "destination": "Notebook.Document.ChangeEvent", - "imported_version": "3.17", - "source": "NotebookDocumentChangeEvent" - }, - { - "destination": "Notebook.Document.ClientCapabilities", - "imported_version": "3.17", - "source": "NotebookDocumentClientCapabilities" - }, - { - "destination": "Notebook.Document.Filter", - "imported_version": "3.17", - "source": "NotebookDocumentFilter" - }, - { - "destination": "Notebook.Document.Identifier", - "imported_version": "3.17", - "source": "NotebookDocumentIdentifier" - }, - { - "destination": "Notebook.Document.Sync.ClientCapabilities", - "imported_version": "3.17", - "source": "NotebookDocumentSyncClientCapabilities" - }, - { - "destination": "Notebook.Document.Sync.Options", - "imported_version": "3.17", - "source": "NotebookDocumentSyncOptions" - }, - { - "destination": "Notebook.Document.Sync.Registration.Options", - "imported_version": "3.17", - "source": "NotebookDocumentSyncRegistrationOptions" - }, - { - "destination": "TextDocument.OptionalVersioned.Identifier", - "imported_version": "3.17", - "source": "OptionalVersionedTextDocumentIdentifier" - }, - { - "destination": "ParameterInformation", - "imported_version": "3.17", - "source": "ParameterInformation" - }, - { - "destination": "PartialResult.Params", - "imported_version": "3.17", - "source": "PartialResultParams" - }, - { - "destination": "Pattern", - "imported_version": "3.17", - "source": "Pattern" - }, - { - "destination": "Position", - "imported_version": "3.17", - "source": "Position" - }, - { - "destination": "Position.Encoding.Kind", - "imported_version": "3.17", - "source": "PositionEncodingKind" - }, - { - "destination": "PrepareRename.Params", - "imported_version": "3.17", - "source": "PrepareRenameParams" - }, - { - "destination": "PrepareRenameResult", - "imported_version": "3.17", - "source": "PrepareRenameResult" - }, - { - "destination": "PrepareSupportDefaultBehavior", - "imported_version": "3.17", - "source": "PrepareSupportDefaultBehavior" - }, - { - "destination": "PreviousResultId", - "imported_version": "3.17", - "source": "PreviousResultId" - }, - { - "destination": "Progress.Params", - "imported_version": "3.17", - "source": "ProgressParams" - }, - { - "destination": "Progress.Token", - "imported_version": "3.17", - "source": "ProgressToken" - }, - { - "destination": "PublishDiagnostics.ClientCapabilities", - "imported_version": "3.17", - "source": "PublishDiagnosticsClientCapabilities" - }, - { - "destination": "PublishDiagnostics.Params", - "imported_version": "3.17", - "source": "PublishDiagnosticsParams" - }, - { - "destination": "Range", - "imported_version": "3.17", - "source": "Range" - }, - { - "destination": "Reference.ClientCapabilities", - "imported_version": "3.17", - "source": "ReferenceClientCapabilities" - }, - { - "destination": "Reference.Context", - "imported_version": "3.17", - "source": "ReferenceContext" - }, - { - "destination": "Reference.Options", - "imported_version": "3.17", - "source": "ReferenceOptions" - }, - { - "destination": "Reference.Params", - "imported_version": "3.17", - "source": "ReferenceParams" - }, - { - "destination": "Reference.Registration.Options", - "imported_version": "3.17", - "source": "ReferenceRegistrationOptions" - }, - { - "destination": "Registration", - "imported_version": "3.17", - "source": "Registration" - }, - { - "destination": "Registration.Params", - "imported_version": "3.17", - "source": "RegistrationParams" - }, - { - "destination": "RegularExpressions.ClientCapabilities", - "imported_version": "3.17", - "source": "RegularExpressionsClientCapabilities" - }, - { - "destination": "RelatedFullDocumentDiagnosticReport", - "imported_version": "3.17", - "source": "RelatedFullDocumentDiagnosticReport" - }, - { - "destination": "RelatedUnchangedDocumentDiagnosticReport", - "imported_version": "3.17", - "source": "RelatedUnchangedDocumentDiagnosticReport" - }, - { - "destination": "RelativePattern", - "imported_version": "3.17", - "source": "RelativePattern" - }, - { - "destination": "Rename.ClientCapabilities", - "imported_version": "3.17", - "source": "RenameClientCapabilities" - }, - { - "destination": "RenameFile", - "imported_version": "3.17", - "source": "RenameFile" - }, - { - "destination": "RenameFile.Options", - "imported_version": "3.17", - "source": "RenameFileOptions" - }, - { - "destination": "RenameFiles.Params", - "imported_version": "3.17", - "source": "RenameFilesParams" - }, - { - "destination": "Rename.Options", - "imported_version": "3.17", - "source": "RenameOptions" - }, - { - "destination": "Rename.Params", - "imported_version": "3.17", - "source": "RenameParams" - }, - { - "destination": "Rename.Registration.Options", - "imported_version": "3.17", - "source": "RenameRegistrationOptions" - }, - { - "destination": "ResourceOperation", - "imported_version": "3.17", - "source": "ResourceOperation" - }, - { - "destination": "ResourceOperation.Kind", - "imported_version": "3.17", - "source": "ResourceOperationKind" - }, - { - "destination": "Save.Options", - "imported_version": "3.17", - "source": "SaveOptions" - }, - { - "destination": "SelectionRange", - "imported_version": "3.17", - "source": "SelectionRange" - }, - { - "destination": "SelectionRange.ClientCapabilities", - "imported_version": "3.17", - "source": "SelectionRangeClientCapabilities" - }, - { - "destination": "SelectionRange.Options", - "imported_version": "3.17", - "source": "SelectionRangeOptions" - }, - { - "destination": "SelectionRange.Params", - "imported_version": "3.17", - "source": "SelectionRangeParams" - }, - { - "destination": "SelectionRange.Registration.Options", - "imported_version": "3.17", - "source": "SelectionRangeRegistrationOptions" - }, - { - "destination": "SemanticTokenModifiers", - "imported_version": "3.17", - "source": "SemanticTokenModifiers" - }, - { - "destination": "SemanticTokenTypes", - "imported_version": "3.17", - "source": "SemanticTokenTypes" - }, - { - "destination": "SemanticTokens", - "imported_version": "3.17", - "source": "SemanticTokens" - }, - { - "destination": "SemanticTokens.ClientCapabilities", - "imported_version": "3.17", - "source": "SemanticTokensClientCapabilities" - }, - { - "destination": "SemanticTokens.Delta", - "imported_version": "3.17", - "source": "SemanticTokensDelta" - }, - { - "destination": "SemanticTokens.Delta.Params", - "imported_version": "3.17", - "source": "SemanticTokensDeltaParams" - }, - { - "destination": "SemanticTokens.Delta.PartialResult", - "imported_version": "3.17", - "source": "SemanticTokensDeltaPartialResult" - }, - { - "destination": "SemanticTokens.Edit", - "imported_version": "3.17", - "source": "SemanticTokensEdit" - }, - { - "destination": "SemanticTokens.Legend", - "imported_version": "3.17", - "source": "SemanticTokensLegend" - }, - { - "destination": "SemanticTokens.Options", - "imported_version": "3.17", - "source": "SemanticTokensOptions" - }, - { - "destination": "SemanticTokens.Params", - "imported_version": "3.17", - "source": "SemanticTokensParams" - }, - { - "destination": "SemanticTokens.PartialResult", - "imported_version": "3.17", - "source": "SemanticTokensPartialResult" - }, - { - "destination": "SemanticTokens.Range.Params", - "imported_version": "3.17", - "source": "SemanticTokensRangeParams" - }, - { - "destination": "SemanticTokens.Registration.Options", - "imported_version": "3.17", - "source": "SemanticTokensRegistrationOptions" - }, - { - "destination": "SemanticTokens.Workspace.ClientCapabilities", - "imported_version": "3.17", - "source": "SemanticTokensWorkspaceClientCapabilities" - }, - { - "destination": "ServerCapabilities", - "imported_version": "3.17", - "source": "ServerCapabilities" - }, - { - "destination": "SetTrace.Params", - "imported_version": "3.17", - "source": "SetTraceParams" - }, - { - "destination": "ShowDocument.ClientCapabilities", - "imported_version": "3.17", - "source": "ShowDocumentClientCapabilities" - }, - { - "destination": "ShowDocument.Params", - "imported_version": "3.17", - "source": "ShowDocumentParams" - }, - { - "destination": "ShowDocumentResult", - "imported_version": "3.17", - "source": "ShowDocumentResult" - }, - { - "destination": "ShowMessage.Params", - "imported_version": "3.17", - "source": "ShowMessageParams" - }, - { - "destination": "ShowMessageRequest.ClientCapabilities", - "imported_version": "3.17", - "source": "ShowMessageRequestClientCapabilities" - }, - { - "destination": "ShowMessageRequest.Params", - "imported_version": "3.17", - "source": "ShowMessageRequestParams" - }, - { - "destination": "SignatureHelp", - "imported_version": "3.17", - "source": "SignatureHelp" - }, - { - "destination": "SignatureHelp.ClientCapabilities", - "imported_version": "3.17", - "source": "SignatureHelpClientCapabilities" - }, - { - "destination": "SignatureHelp.Context", - "imported_version": "3.17", - "source": "SignatureHelpContext" - }, - { - "destination": "SignatureHelp.Options", - "imported_version": "3.17", - "source": "SignatureHelpOptions" - }, - { - "destination": "SignatureHelp.Params", - "imported_version": "3.17", - "source": "SignatureHelpParams" - }, - { - "destination": "SignatureHelp.Registration.Options", - "imported_version": "3.17", - "source": "SignatureHelpRegistrationOptions" - }, - { - "destination": "SignatureHelp.Trigger.Kind", - "imported_version": "3.17", - "source": "SignatureHelpTriggerKind" - }, - { - "destination": "SignatureInformation", - "imported_version": "3.17", - "source": "SignatureInformation" - }, - { - "destination": "Static.Registration.Options", - "imported_version": "3.17", - "source": "StaticRegistrationOptions" - }, - { - "destination": "Symbol.Information", - "imported_version": "3.17", - "source": "SymbolInformation" - }, - { - "destination": "Symbol.Kind", - "imported_version": "3.17", - "source": "SymbolKind" - }, - { - "destination": "Symbol.Tag", - "imported_version": "3.17", - "source": "SymbolTag" - }, - { - "destination": "TextDocument.Change.Registration.Options", - "imported_version": "3.17", - "source": "TextDocumentChangeRegistrationOptions" - }, - { - "destination": "TextDocument.ClientCapabilities", - "imported_version": "3.17", - "source": "TextDocumentClientCapabilities" - }, - { - "destination": "TextDocument.ContentChangeEvent", - "imported_version": "3.17", - "source": "TextDocumentContentChangeEvent" - }, - { - "destination": "TextDocument.Edit", - "imported_version": "3.17", - "source": "TextDocumentEdit" - }, - { - "destination": "TextDocument.Filter", - "imported_version": "3.17", - "source": "TextDocumentFilter" - }, - { - "destination": "TextDocument.Identifier", - "imported_version": "3.17", - "source": "TextDocumentIdentifier" - }, - { - "destination": "TextDocument.Item", - "imported_version": "3.17", - "source": "TextDocumentItem" - }, - { - "destination": "TextDocument.Position.Params", - "imported_version": "3.17", - "source": "TextDocumentPositionParams" - }, - { - "destination": "TextDocument.Registration.Options", - "imported_version": "3.17", - "source": "TextDocumentRegistrationOptions" - }, - { - "destination": "TextDocument.Save.Reason", - "imported_version": "3.17", - "source": "TextDocumentSaveReason" - }, - { - "destination": "TextDocument.Save.Registration.Options", - "imported_version": "3.17", - "source": "TextDocumentSaveRegistrationOptions" - }, - { - "destination": "TextDocument.Sync.ClientCapabilities", - "imported_version": "3.17", - "source": "TextDocumentSyncClientCapabilities" - }, - { - "destination": "TextDocument.Sync.Kind", - "imported_version": "3.17", - "source": "TextDocumentSyncKind" - }, - { - "destination": "TextDocument.Sync.Options", - "imported_version": "3.17", - "source": "TextDocumentSyncOptions" - }, - { - "destination": "TextEdit", - "imported_version": "3.17", - "source": "TextEdit" - }, - { - "destination": "TokenFormat", - "imported_version": "3.17", - "source": "TokenFormat" - }, - { - "destination": "TraceValues", - "imported_version": "3.17", - "source": "TraceValues" - }, - { - "destination": "TypeDefinition.ClientCapabilities", - "imported_version": "3.17", - "source": "TypeDefinitionClientCapabilities" - }, - { - "destination": "TypeDefinition.Options", - "imported_version": "3.17", - "source": "TypeDefinitionOptions" - }, - { - "destination": "TypeDefinition.Params", - "imported_version": "3.17", - "source": "TypeDefinitionParams" - }, - { - "destination": "TypeDefinition.Registration.Options", - "imported_version": "3.17", - "source": "TypeDefinitionRegistrationOptions" - }, - { - "destination": "TypeHierarchy.ClientCapabilities", - "imported_version": "3.17", - "source": "TypeHierarchyClientCapabilities" - }, - { - "destination": "TypeHierarchy.Item", - "imported_version": "3.17", - "source": "TypeHierarchyItem" - }, - { - "destination": "TypeHierarchy.Options", - "imported_version": "3.17", - "source": "TypeHierarchyOptions" - }, - { - "destination": "TypeHierarchy.Prepare.Params", - "imported_version": "3.17", - "source": "TypeHierarchyPrepareParams" - }, - { - "destination": "TypeHierarchy.Registration.Options", - "imported_version": "3.17", - "source": "TypeHierarchyRegistrationOptions" - }, - { - "destination": "TypeHierarchy.Subtypes.Params", - "imported_version": "3.17", - "source": "TypeHierarchySubtypesParams" - }, - { - "destination": "TypeHierarchy.Supertypes.Params", - "imported_version": "3.17", - "source": "TypeHierarchySupertypesParams" - }, - { - "destination": "UnchangedDocumentDiagnosticReport", - "imported_version": "3.17", - "source": "UnchangedDocumentDiagnosticReport" - }, - { - "destination": "UniquenessLevel", - "imported_version": "3.17", - "source": "UniquenessLevel" - }, - { - "destination": "Unregistration", - "imported_version": "3.17", - "source": "Unregistration" - }, - { - "destination": "Unregistration.Params", - "imported_version": "3.17", - "source": "UnregistrationParams" - }, - { - "destination": "Notebook.VersionedDocument.Identifier", - "imported_version": "3.17", - "source": "VersionedNotebookDocumentIdentifier" - }, - { - "destination": "TextDocument.Versioned.Identifier", - "imported_version": "3.17", - "source": "VersionedTextDocumentIdentifier" - }, - { - "destination": "Watch.Kind", - "imported_version": "3.17", - "source": "WatchKind" - }, - { - "destination": "WillSaveTextDocument.Params", - "imported_version": "3.17", - "source": "WillSaveTextDocumentParams" - }, - { - "destination": "Window.ClientCapabilities", - "imported_version": "3.17", - "source": "WindowClientCapabilities" - }, - { - "destination": "WorkDone.ProgressBegin", - "imported_version": "3.17", - "source": "WorkDoneProgressBegin" - }, - { - "destination": "WorkDone.Progress.Cancel.Params", - "imported_version": "3.17", - "source": "WorkDoneProgressCancelParams" - }, - { - "destination": "WorkDone.Progress.Create.Params", - "imported_version": "3.17", - "source": "WorkDoneProgressCreateParams" - }, - { - "destination": "WorkDone.ProgressEnd", - "imported_version": "3.17", - "source": "WorkDoneProgressEnd" - }, - { - "destination": "WorkDone.Progress.Options", - "imported_version": "3.17", - "source": "WorkDoneProgressOptions" - }, - { - "destination": "WorkDone.Progress.Params", - "imported_version": "3.17", - "source": "WorkDoneProgressParams" - }, - { - "destination": "WorkDone.Progress.Report", - "imported_version": "3.17", - "source": "WorkDoneProgressReport" - }, - { - "destination": "Workspace.ClientCapabilities", - "imported_version": "3.17", - "source": "WorkspaceClientCapabilities" - }, - { - "destination": "Workspace.Diagnostic.Params", - "imported_version": "3.17", - "source": "WorkspaceDiagnosticParams" - }, - { - "destination": "Workspace.Diagnostic.Report", - "imported_version": "3.17", - "source": "WorkspaceDiagnosticReport" - }, - { - "destination": "Workspace.Diagnostic.Report.PartialResult", - "imported_version": "3.17", - "source": "WorkspaceDiagnosticReportPartialResult" - }, - { - "destination": "WorkspaceDocumentDiagnosticReport", - "imported_version": "3.17", - "source": "WorkspaceDocumentDiagnosticReport" - }, - { - "destination": "Workspace.Edit", - "imported_version": "3.17", - "source": "WorkspaceEdit" - }, - { - "destination": "Workspace.Edit.ClientCapabilities", - "imported_version": "3.17", - "source": "WorkspaceEditClientCapabilities" - }, - { - "destination": "Workspace.Folder", - "imported_version": "3.17", - "source": "WorkspaceFolder" - }, - { - "destination": "Workspace.FoldersChangeEvent", - "imported_version": "3.17", - "source": "WorkspaceFoldersChangeEvent" - }, - { - "destination": "Workspace.FoldersInitialize.Params", - "imported_version": "3.17", - "source": "WorkspaceFoldersInitializeParams" - }, - { - "destination": "Workspace.FoldersServerCapabilities", - "imported_version": "3.17", - "source": "WorkspaceFoldersServerCapabilities" - }, - { - "destination": "Workspace.FullDocument.Diagnostic.Report", - "imported_version": "3.17", - "source": "WorkspaceFullDocumentDiagnosticReport" - }, - { - "destination": "Workspace.Symbol", - "imported_version": "3.17", - "source": "WorkspaceSymbol" - }, - { - "destination": "Workspace.Symbol.ClientCapabilities", - "imported_version": "3.17", - "source": "WorkspaceSymbolClientCapabilities" - }, - { - "destination": "Workspace.Symbol.Options", - "imported_version": "3.17", - "source": "WorkspaceSymbolOptions" - }, - { - "destination": "Workspace.Symbol.Params", - "imported_version": "3.17", - "source": "WorkspaceSymbolParams" - }, - { - "destination": "Workspace.Symbol.Registration.Options", - "imported_version": "3.17", - "source": "WorkspaceSymbolRegistrationOptions" - }, - { - "destination": "Workspace.UnchangedDocument.Diagnostic.Report", - "imported_version": "3.17", - "source": "WorkspaceUnchangedDocumentDiagnosticReport" - }, - { - "destination": "_InitializeParams", - "imported_version": "3.17", - "source": "_InitializeParams" - } -] diff --git a/apps/language_server/test/experimental/code_mod/diff_test.exs b/apps/language_server/test/experimental/code_mod/diff_test.exs deleted file mode 100644 index 3bfcaf608..000000000 --- a/apps/language_server/test/experimental/code_mod/diff_test.exs +++ /dev/null @@ -1,239 +0,0 @@ -defmodule ElixirLS.LanguageServer.Experimental.Format.DiffTest do - alias ElixirLS.LanguageServer.Experimental.CodeMod.Diff - alias LSP.Types.Position - alias LSP.Types.Range - alias LSP.Types.TextEdit - - import Diff - - use ElixirLS.Test.CodeMod.Case - - def edit(start_line, start_code_unit, end_line, end_code_unit, replacement) do - TextEdit.new( - new_text: replacement, - range: - Range.new( - start: Position.new(character: start_code_unit, line: start_line), - end: Position.new(character: end_code_unit, line: end_line) - ) - ) - end - - def apply_code_mod(source, _, opts) do - result = Keyword.get(opts, :result) - {:ok, Diff.diff(source, result)} - end - - def assert_edited(initial, final) do - assert {:ok, edited} = modify(initial, result: final, convert_to_ast: false) - assert edited == final - end - - describe "single line ascii diffs" do - test "a deletion at the start" do - orig = " hello" - final = "hello" - - assert [edit] = diff(orig, final) - assert edit == edit(0, 0, 0, 2, "") - assert_edited(orig, final) - end - - test "appending in the middle" do - orig = "hello" - final = "heyello" - - assert [edit] = diff(orig, final) - assert edit == edit(0, 2, 0, 2, "ye") - assert_edited(orig, final) - end - - test "deleting in the middle" do - orig = "hello" - final = "heo" - - assert [edit] = diff(orig, final) - assert edit == edit(0, 2, 0, 4, "") - assert_edited(orig, final) - end - - test "inserting after a delete" do - orig = "hello" - final = "helvetica went" - - # this is collapsed into a single edit of an - # insert that spans the delete and the insert - assert [edit] = diff(orig, final) - assert edit == edit(0, 3, 0, 5, "vetica went") - assert_edited(orig, final) - end - - test "edits are ordered back to front on a line" do - orig = "hello there" - final = "hellothe" - - assert [e1, e2] = diff(orig, final) - assert e1 == edit(0, 9, 0, 11, "") - assert e2 == edit(0, 5, 0, 6, "") - end - end - - describe "applied edits" do - test "multiple edits on the same line don't conflict" do - orig = "foo( a, b)" - expected = "foo(a, b)" - - assert_edited(orig, expected) - end - end - - describe "multi line ascii diffs" do - test "multi-line deletion at the start" do - orig = - """ - none - two - hello - """ - |> String.trim() - - final = "hello" - - assert [edit] = diff(orig, final) - assert edit == edit(0, 0, 2, 0, "") - assert_edited(orig, final) - end - - test "multi-line appending in the middle" do - orig = "hello" - final = "he\n\n ye\n\nllo" - - assert [edit] = diff(orig, final) - assert edit == edit(0, 2, 0, 2, "\n\n ye\n\n") - assert_edited(orig, final) - end - - test "deleting multiple lines in the middle" do - orig = - """ - hello - there - people - goodbye - """ - |> String.trim() - - final = "hellogoodbye" - - assert [edit] = diff(orig, final) - assert edit == edit(0, 5, 3, 0, "") - assert_edited(orig, final) - end - - test "deleting multiple lines" do - orig = ~q[ - foo(a, - b, - c, - d) - ] - - final = ~q[ - foo(a, b, c, d) - ]t - - assert_edited(orig, final) - end - - test "deletions keep indentation" do - orig = - """ - hello - there - - - people - """ - |> String.trim() - - final = - """ - hello - there - people - """ - |> String.trim() - - assert [edit] = diff(orig, final) - assert edit == edit(2, 0, 4, 0, "") - assert_edited(orig, final) - end - end - - describe "single line emoji" do - test "deleting after" do - orig = ~S[{"🎸", "after"}] - final = ~S[{"🎸", "after"}] - - assert [edit] = diff(orig, final) - assert edit == edit(0, 7, 0, 9, "") - assert_edited(orig, final) - end - - test "inserting in the middle" do - orig = ~S[🎸🎸] - final = ~S[🎸🎺🎸] - - assert [edit] = diff(orig, final) - assert edit == edit(0, 2, 0, 2, "🎺") - assert_edited(orig, final) - end - - test "deleting in the middle" do - orig = ~S[🎸🎺🎺🎸] - final = ~S[🎸🎸] - - assert [edit] = diff(orig, final) - assert edit == edit(0, 2, 0, 6, "") - assert_edited(orig, final) - end - - test "multiple deletes on the same line" do - orig = ~S[🎸a 🎺b 🎺c 🎸] - final = ~S[🎸ab🎸] - - assert_edited(orig, final) - end - end - - describe("multi line emoji") do - test "deleting on the first line" do - orig = ~q[ - 🎸a 🎺b 🎺c 🎸 - hello - ]t - - final = ~q[ - 🎸a b c 🎸 - hello - ]t - - assert_edited(orig, final) - end - - test "deleting on subsequent lines" do - orig = ~q[ - 🎸a 🎺b 🎺c 🎸 - hello - 🎸a 🎺b 🎺c 🎸 - ]t - final = ~q[ - 🎸a 🎺b 🎺c 🎸 - ello - 🎸a 🎺b 🎺c 🎸 - ]t - - assert_edited(orig, final) - end - end -end diff --git a/apps/language_server/test/experimental/code_mod/format_test.exs b/apps/language_server/test/experimental/code_mod/format_test.exs deleted file mode 100644 index 05094116f..000000000 --- a/apps/language_server/test/experimental/code_mod/format_test.exs +++ /dev/null @@ -1,178 +0,0 @@ -defmodule ElixirLS.Experimental.FormatTest do - alias ElixirLS.LanguageServer.Experimental.CodeMod.Format - alias ElixirLS.LanguageServer.Experimental.SourceFile - alias ElixirLS.LanguageServer.SourceFile.Path, as: SourceFilePath - - use ElixirLS.Test.CodeMod.Case - - def apply_code_mod(text, _ast, opts) do - file_path = Keyword.get_lazy(opts, :file_path, &File.cwd!/0) - - text - |> source_file() - |> Format.text_edits(file_path) - end - - def source_file(text) do - __ENV__.file - |> SourceFilePath.to_uri() - |> SourceFile.new(text, 1) - end - - def unformatted do - ~q[ - defmodule Unformatted do - def something( a, b ) do - end - end - ]t - end - - def formatted do - ~q[ - defmodule Unformatted do - def something(a, b) do - end - end - ]t - end - - describe "format/2" do - test "it should be able to format a file in the project" do - {:ok, result} = modify(unformatted()) - - assert result == formatted() - end - - test "it should be able to format a file when the project isn't specified" do - assert {:ok, result} = modify(unformatted(), file_path: nil) - assert result == formatted() - end - - test "it should provide an error for a syntax error" do - assert {:error, %SyntaxError{}} = ~q[ - def foo(a, ) do - true - end - ] |> modify() - end - - test "it should provide an error for a missing token" do - assert {:error, %TokenMissingError{}} = ~q[ - defmodule TokenMissing do - :bad - ] |> modify() - end - - test "it correctly handles unicode" do - assert {:ok, result} = ~q[ - {"🎸", "o"} - ] |> modify() - - assert ~q[ - {"🎸", "o"} - ]t == result - end - - test "it can format a long line function definition into multiple lines" do - unformatted = ~q[ - defmodule Unformatted do - def very_loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong(s) do - s - end - end - ]t - - formatted = ~q[ - defmodule Unformatted do - def very_loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong( - s - ) do - s - end - end - ]t - - assert {:ok, formatted} == modify(unformatted) - end - - test "it can format a long line function call into two lines" do - unformatted = ~q[ - defmodule Unformatted do - def foo1(s) do - s = very_loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooonooooong(s) |> IO.inputs() - s - end - - def very_loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooonooooong(s) do - s - end - end - ]t - - formatted = ~q[ - defmodule Unformatted do - def foo1(s) do - s = - very_loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooonooooong(s) |> IO.inputs() - - s - end - - def very_loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooonooooong(s) do - s - end - end - ]t - - assert {:ok, formatted} == modify(unformatted) - end - - test "it can format a long line function definition(with multiple args) into multiple lines" do - unformatted = ~q[ - defmodule Unformatted do - def foo(arg1, arg2, arg3, _arg4, _arg5, _arg6, _arg7, _arg8, _arg9, _arg10, _arg11, _arg12, _arg13) do - arg1 <> arg2 <> arg3 - end - end - ]t - formatted = ~q[ - defmodule Unformatted do - def foo( - arg1, - arg2, - arg3, - _arg4, - _arg5, - _arg6, - _arg7, - _arg8, - _arg9, - _arg10, - _arg11, - _arg12, - _arg13 - ) do - arg1 <> arg2 <> arg3 - end - end - ]t - - assert {:ok, formatted} == modify(unformatted) - end - - test "it handles extra lines" do - assert {:ok, result} = ~q[ - defmodule Unformatted do - def something( a , b) do - - - - end - end - ] |> modify() - - assert result == formatted() - end - end -end diff --git a/apps/language_server/test/experimental/code_mod/replace_with_underscore_test.exs b/apps/language_server/test/experimental/code_mod/replace_with_underscore_test.exs deleted file mode 100644 index 3730f93d0..000000000 --- a/apps/language_server/test/experimental/code_mod/replace_with_underscore_test.exs +++ /dev/null @@ -1,214 +0,0 @@ -defmodule ElixirLS.LanguageServer.Experimental.CodeMod.ReplaceWithUnderscoreTest do - alias ElixirLS.LanguageServer.Experimental.CodeMod.ReplaceWithUnderscore - - use ElixirLS.Test.CodeMod.Case - - def apply_code_mod(original_text, ast, options) do - variable = Keyword.get(options, :variable, :unused) - ReplaceWithUnderscore.text_edits(original_text, ast, variable) - end - - describe "fixes in parameters" do - test "applied to an unadorned param" do - {:ok, result} = - ~q[ - def my_func(unused) do - ] - |> modify() - - assert result == "def my_func(_unused) do" - end - - test "applied to a pattern match in params" do - {:ok, result} = - ~q[ - def my_func(%SourceFile{} = unused) do - ] - |> modify() - - assert result == "def my_func(%SourceFile{} = _unused) do" - end - - test "applied to a pattern match preceding a struct in params" do - {:ok, result} = - ~q[ - def my_func(unused = %SourceFile{}) do - ] - |> modify() - - assert result == "def my_func(_unused = %SourceFile{}) do" - end - - test "applied prior to a map" do - {:ok, result} = - ~q[ - def my_func(unused = %{}) do - ] - |> modify() - - assert result == "def my_func(_unused = %{}) do" - end - - test "applied after a map %{} = unused" do - {:ok, result} = - ~q[ - def my_func(%{} = unused) do - ] - |> modify() - - assert result == "def my_func(%{} = _unused) do" - end - - test "applied to a map key %{foo: unused}" do - {:ok, result} = - ~q[ - def my_func(%{foo: unused}) do - ] - |> modify() - - assert result == "def my_func(%{foo: _unused}) do" - end - - test "applied to a list element params = [unused, a, b | rest]" do - {:ok, result} = - ~q{ - def my_func([unused, a, b | rest]) do - } - |> modify() - - assert result == "def my_func([_unused, a, b | rest]) do" - end - - test "applied to the tail of a list params = [a, b, | unused]" do - {:ok, result} = - ~q{ - def my_func([a, b | unused]) do - } - |> modify() - - assert result == "def my_func([a, b | _unused]) do" - end - end - - describe "fixes in variables" do - test "applied to a variable match " do - {:ok, result} = - ~q[ - x = 3 - ] - |> modify(variable: "x") - - assert result == "_x = 3" - end - - test "applied to a variable match, preserves comments" do - {:ok, result} = - ~q[ - unused = bar # TODO: Fix this - ] - |> modify() - - assert result == "_unused = bar # TODO: Fix this" - end - - test "preserves spacing" do - {:ok, result} = - " x = 3" - |> modify(variable: "x", trim: false) - - assert result == " _x = 3" - end - - test "applied to a variable with a pattern matched struct" do - {:ok, result} = - ~q[ - unused = %Struct{} - ] - |> modify() - - assert result == "_unused = %Struct{}" - end - - test "applied to a variable with a pattern matched struct preserves trailing comments" do - {:ok, result} = - ~q[ - unused = %Struct{} # TODO: fix - ] - |> modify() - - assert result == "_unused = %Struct{} # TODO: fix" - end - - test "applied to struct param matches" do - {:ok, result} = - ~q[ - %Struct{field: unused, other_field: used} - ] - |> modify() - - assert result == "%Struct{field: _unused, other_field: used}" - end - - test "applied to a struct module match %module{}" do - {:ok, result} = - ~q[ - %unused{field: first, other_field: used} - ] - |> modify() - - assert result == "%_unused{field: first, other_field: used}" - end - - test "applied to a tuple value" do - {:ok, result} = - ~q[ - {a, b, unused, c} = whatever - ] - |> modify() - - assert result == "{a, b, _unused, c} = whatever" - end - - test "applied to a list element" do - {:ok, result} = - ~q{ - [a, b, unused, c] = whatever - } - |> modify() - - assert result == "[a, b, _unused, c] = whatever" - end - - test "applied to map value" do - {:ok, result} = - ~q[ - %{foo: a, bar: unused} = whatever - ] - |> modify() - - assert result == "%{foo: a, bar: _unused} = whatever" - end - end - - describe "fixes in structures" do - test "applied to a match of a comprehension" do - {:ok, result} = - ~q[ - for {unused, something_else} <- my_enum, do: something_else - ] - |> modify() - - assert result == "for {_unused, something_else} <- my_enum, do: something_else" - end - - test "applied to a match in a with block" do - {:ok, result} = - ~q[ - with {unused, something_else} <- my_enum, do: something_else - ] - |> modify() - - assert result == "with {_unused, something_else} <- my_enum, do: something_else" - end - end -end diff --git a/apps/language_server/test/experimental/code_unit_test.exs b/apps/language_server/test/experimental/code_unit_test.exs deleted file mode 100644 index 06b602065..000000000 --- a/apps/language_server/test/experimental/code_unit_test.exs +++ /dev/null @@ -1,210 +0,0 @@ -defmodule ElixirLS.LanguageServer.Experimental.CodeUnitTest do - alias ElixirLS.LanguageServer.Experimental.CodeUnit - - use ExUnit.Case - use ExUnitProperties - import CodeUnit - - describe "utf8 offsets" do - test "handles single-byte characters" do - s = "do" - assert 0 == utf8_offset(s, 0) - assert 1 == utf8_offset(s, 1) - assert 2 == utf8_offset(s, 2) - assert 2 == utf8_offset(s, 3) - assert 2 == utf8_offset(s, 4) - end - - test "caps offsets at the end of the string and beyond" do - line = "🎸" - - # reminder, the offsets below are utf-16 - # character code unit offsets, which differ - # from utf8's, and can have gaps. - - assert 4 == utf8_offset(line, 1) - assert 4 == utf8_offset(line, 2) - assert 4 == utf8_offset(line, 3) - assert 4 == utf8_offset(line, 4) - end - - test "handles multi-byte characters properly" do - line = "b🎸abc" - - # reminder, the offsets below are utf-16 - # character code unit offsets, which differ - # from utf8's, and can have gaps. - - assert 0 == utf8_offset(line, 0) - assert 1 == utf8_offset(line, 1) - assert 5 == utf8_offset(line, 3) - assert 6 == utf8_offset(line, 4) - assert 7 == utf8_offset(line, 5) - assert 8 == utf8_offset(line, 6) - assert 8 == utf8_offset(line, 7) - end - end - - describe "utf16_offset/2" do - test "handles single-byte characters" do - s = "do" - assert 0 == utf16_offset(s, 0) - assert 1 == utf16_offset(s, 1) - assert 2 == utf16_offset(s, 2) - assert 2 == utf16_offset(s, 3) - assert 2 == utf16_offset(s, 4) - end - - test "caps offsets at the end of the string and beyond" do - line = "🎸" - assert 2 == utf16_offset(line, 1) - assert 2 == utf16_offset(line, 2) - assert 2 == utf16_offset(line, 3) - assert 2 == utf16_offset(line, 4) - end - - test "handles multi-byte characters properly" do - # guitar is 2 code units in utf16 but 4 in utf8 - line = "b🎸abc" - assert 0 == utf16_offset(line, 0) - assert 1 == utf16_offset(line, 1) - assert 3 == utf16_offset(line, 2) - assert 4 == utf16_offset(line, 3) - assert 5 == utf16_offset(line, 4) - assert 6 == utf16_offset(line, 5) - assert 6 == utf16_offset(line, 6) - end - end - - describe "converting to utf8" do - test "bounds are respected" do - assert {:error, :out_of_bounds} = to_utf16("h", 2) - end - - test "with a multi-byte character" do - line = "🏳️‍🌈" - - code_unit_count = count_utf8_code_units(line) - - assert to_utf8(line, 0) == {:ok, 0} - assert to_utf8(line, 1) == {:error, :misaligned} - assert to_utf8(line, 2) == {:ok, 4} - assert to_utf8(line, 3) == {:ok, 7} - assert to_utf8(line, 4) == {:ok, 10} - assert to_utf8(line, 5) == {:error, :misaligned} - assert to_utf8(line, 6) == {:ok, code_unit_count} - end - - test "after a unicode character" do - line = " {\"🎸\", \"ok\"}" - - assert to_utf8(line, 0) == {:ok, 0} - assert to_utf8(line, 1) == {:ok, 1} - assert to_utf8(line, 4) == {:ok, 4} - assert to_utf8(line, 5) == {:ok, 5} - assert to_utf8(line, 6) == {:ok, 6} - assert to_utf8(line, 7) == {:error, :misaligned} - # after the guitar character - assert to_utf8(line, 8) == {:ok, 10} - assert to_utf8(line, 9) == {:ok, 11} - assert to_utf8(line, 10) == {:ok, 12} - assert to_utf8(line, 11) == {:ok, 13} - assert to_utf8(line, 12) == {:ok, 14} - assert to_utf8(line, 13) == {:ok, 15} - assert to_utf8(line, 17) == {:ok, 19} - end - end - - describe "converting to utf16" do - test "respects bounds" do - assert {:error, :out_of_bounds} = to_utf16("h", 2) - end - - test "with a multi-byte character" do - line = "🏳️‍🌈" - - code_unit_count = count_utf16_code_units(line) - utf8_code_unit_count = count_utf8_code_units(line) - - assert to_utf16(line, 0) == {:ok, 0} - assert to_utf16(line, 1) == {:error, :misaligned} - assert to_utf16(line, 2) == {:error, :misaligned} - assert to_utf16(line, 3) == {:error, :misaligned} - assert to_utf16(line, 4) == {:ok, 2} - assert to_utf16(line, utf8_code_unit_count - 1) == {:error, :misaligned} - assert to_utf16(line, utf8_code_unit_count) == {:ok, code_unit_count} - end - - test "after a multi-byte character" do - line = " {\"🎸\", \"ok\"}" - - utf16_code_unit_count = count_utf16_code_units(line) - utf8_code_unit_count = count_utf8_code_units(line) - - # before, the character, there is no difference between utf8 and utf16 - for index <- 0..5 do - assert to_utf16(line, index) == {:ok, index} - end - - assert to_utf16(line, 6) == {:ok, 6} - assert to_utf16(line, 7) == {:error, :misaligned} - assert to_utf16(line, 8) == {:error, :misaligned} - assert to_utf16(line, 9) == {:error, :misaligned} - - for index <- 10..19 do - assert to_utf16(line, index) == {:ok, index - 2} - end - - assert to_utf16(line, utf8_code_unit_count - 1) == {:ok, utf16_code_unit_count - 1} - end - end - - property "to_utf8 and to_utf16 are inverses of each other" do - check all(s <- filter(string(:printable), &utf8?/1)) do - utf8_code_unit_count = count_utf8_code_units(s) - utf16_unit_count = count_utf16_code_units(s) - - assert {:ok, utf16_unit} = to_utf16(s, utf8_code_unit_count) - assert utf16_unit == utf16_unit_count - - assert {:ok, utf8_unit} = to_utf8(s, utf16_unit) - assert utf8_unit == utf8_code_unit_count - end - end - - property "to_utf16 and to_utf8 are inverses" do - check all(s <- filter(string(:printable), &utf8?/1)) do - utf16_code_unit_count = count_utf16_code_units(s) - utf8_code_unit_count = count_utf8_code_units(s) - - assert {:ok, utf8_code_unit} = to_utf8(s, utf16_code_unit_count) - assert utf8_code_unit == utf8_code_unit_count - - assert {:ok, utf16_unit} = to_utf16(s, utf8_code_unit) - assert utf16_unit == utf16_code_unit_count - end - end - - defp count_utf16_code_units(utf8_string) do - utf8_string - |> :unicode.characters_to_binary(:utf8, :utf16) - |> byte_size() - |> div(2) - end - - defp count_utf8_code_units(utf8_string) do - byte_size(utf8_string) - end - - defp utf8?(<<_::utf8>>) do - true - end - - defp utf8?(<<_::utf8, rest::binary>>) do - utf8?(rest) - end - - defp utf8?(_) do - false - end -end diff --git a/apps/language_server/test/experimental/document_test.exs b/apps/language_server/test/experimental/document_test.exs deleted file mode 100644 index 50b733379..000000000 --- a/apps/language_server/test/experimental/document_test.exs +++ /dev/null @@ -1,67 +0,0 @@ -defmodule ElixirLS.LanguageServer.Experimental.SourceFile.DocumentTest do - alias ElixirLS.LanguageServer.Experimental.SourceFile.Document - alias ElixirLS.LanguageServer.Experimental.SourceFile.Line - - use ExUnit.Case, async: true - use ExUnitProperties - - import Line - - describe "Document Enumerable" do - test "it should be able to be fetched by line number" do - d = Document.new("hello\nthere\npeople") - assert line(text: "hello") = Enum.at(d, 0) - assert line(text: "there") = Enum.at(d, 1) - assert line(text: "people") = Enum.at(d, 2) - assert nil == Enum.at(d, 3) - end - end - - property "always creates valid binaries" do - check all( - elements <- - list_of( - one_of([ - string(:printable), - one_of([constant("\r\n"), constant("\n"), constant("\r")]) - ]) - ) - ) do - document = - elements - |> IO.iodata_to_binary() - |> Document.new() - - for line(text: text, ending: ending) <- document do - assert String.valid?(text) - assert ending in ["\r\n", "\n", "\r", ""] - end - end - end - - property "to_string recreates the original" do - check all( - elements <- - list_of( - one_of([ - string(:printable), - one_of([constant("\r\n"), constant("\n"), constant("\r")]) - ]) - ) - ) do - original_binary = List.to_string(elements) - document = Document.new(original_binary) - assert Document.to_string(document) == original_binary - end - end - - property "size reflects the original line count" do - check all(elements <- list_of(string(:alphanumeric, min_length: 2))) do - line_count = Enum.count(elements) - original_binary = elements |> Enum.join("\n") |> IO.iodata_to_binary() - - document = Document.new(original_binary) - assert Document.size(document) == line_count - end - end -end diff --git a/apps/language_server/test/experimental/line_parser_test.exs b/apps/language_server/test/experimental/line_parser_test.exs deleted file mode 100644 index 4ff274641..000000000 --- a/apps/language_server/test/experimental/line_parser_test.exs +++ /dev/null @@ -1,113 +0,0 @@ -defmodule ElixirLS.LanguageServer.Experimental.SourceFile.LineParserTest do - alias ElixirLS.LanguageServer.Experimental.SourceFile.LineParser - import ElixirLS.LanguageServer.Experimental.SourceFile.Line - use ExUnit.Case - use ExUnitProperties - - test "parsing a single \n" do - assert length(LineParser.parse("\n", 1)) == 1 - end - - def parse(lines) do - LineParser.parse(lines, 1) - end - - describe "parsing lines" do - test "with an empty string" do - assert [] = parse("") - end - - test "beginning with endline" do - assert [line(text: "", ending: "\n", ascii?: true)] = parse("\n") - - assert [ - line(text: "", ending: "\n", ascii?: true), - line(text: "basic", ending: "", ascii?: true) - ] = parse("\nbasic") - end - - test "without any endings" do - assert [line(text: "basic", ending: "")] = parse("basic") - end - - test "with a LF" do - assert [line(text: "text", ending: "\n")] = parse("text\n") - end - - test "with a CR LF" do - assert [line(text: "text", ending: "\r\n")] = parse("text\r\n") - end - - test "with a CR" do - assert [line(text: "text", ending: "\r")] = parse("text\r") - end - - test "with multiple LF lines" do - assert [ - line(text: "line1", ending: "\n"), - line(text: "line2", ending: "\n"), - line(text: "line3", ending: "") - ] = parse("line1\nline2\nline3") - end - - test "with multiple CR LF line endings" do - text = "A\r\nB\r\n\r\nC" - - assert [ - line(text: "A", ending: "\r\n"), - line(text: "B", ending: "\r\n"), - line(text: "", ending: "\r\n"), - line(text: "C", ending: "") - ] = parse(text) - end - - test "with an emoji" do - text = "👨‍👩‍👦 test" - assert [line(text: ^text, ending: "", ascii?: false)] = parse(text) - end - - test "example multi-byte string" do - text = "𐂀" - - assert String.valid?(text) - [line(text: line, ending: "", ascii?: false)] = parse(text) - assert String.valid?(line) - end - - test "a utf-16 line" do - utf8_text = "this is probably on windows. Sorry" - utf16_text = :unicode.characters_to_binary(utf8_text, :utf8, :utf16) - - assert [line(text: text, ascii?: false, ending: "")] = parse(utf16_text) - assert utf8_text == :unicode.characters_to_binary(text, :utf16, :utf8) - end - end - - property "random files" do - check all( - lines <- - list_of(string(:alphanumeric, min_length: 2, max_length: 120), min_length: 1), - ending <- member_of(["\r", "\n", "\r\n"]) - ) do - file_contents = Enum.join(lines, ending) <> ending - parsed = LineParser.parse(file_contents, 1) - - for {orig_line, line(text: text, ending: line_ending)} <- Enum.zip(lines, parsed) do - assert String.starts_with?(orig_line, text) - assert line_ending == ending - end - end - end - - alias ElixirLS.LanguageServer.SourceFile - - property "ascii lines have the same offset in utf8 and utf16" do - check all( - line <- string(:ascii), - offset <- integer(0..String.length(line)) - ) do - source_file_offset = SourceFile.lsp_character_to_elixir(line, offset) - assert source_file_offset == offset + 1 - end - end -end diff --git a/apps/language_server/test/experimental/process_cache_test.exs b/apps/language_server/test/experimental/process_cache_test.exs deleted file mode 100644 index f1e25fad1..000000000 --- a/apps/language_server/test/experimental/process_cache_test.exs +++ /dev/null @@ -1,58 +0,0 @@ -defmodule ElixirLS.LanguageServer.Experimental.ProcessCacheTest do - alias ElixirLS.LanguageServer.Experimental.ProcessCache - import ProcessCache - use ExUnit.Case - use Patch - - setup do - expose(ProcessCache.Entry, now_ts: 0) - {:ok, now: 1} - end - - test "calls the compute function" do - assert 3 == trans("my key", fn -> 3 end) - end - - test "pulls from the process cache when an entry exists" do - assert 3 == trans("my key", fn -> 3 end) - assert 3 == trans("my key", fn -> 6 end) - end - - test "times out after a given timeout", ctx do - now = ctx.now - - patch(ProcessCache.Entry, :now_ts, cycle([now, now + 4999, now + 5000])) - - assert 3 == trans("my key", fn -> 3 end) - assert {:ok, 3} == fetch("my key") - assert :error == fetch("my key") - end - - test "calling get also clears the key after the timeout", ctx do - now = ctx.now - - patch(ProcessCache.Entry, :now_ts, cycle([now, now + 4999, now + 5000])) - - assert 3 == trans("my key", fn -> 3 end) - assert 3 == get("my key") - assert nil == get("my key") - end - - test "the timeout is configurable", ctx do - now = ctx.now - patch(ProcessCache.Entry, :now_ts, cycle([now, now + 49, now + 50])) - - assert 3 = trans("my key", 50, fn -> 3 end) - assert {:ok, 3} == fetch("my key") - assert :error == fetch("my key") - end - - test "trans will replace an expired key", ctx do - now = ctx.now - patch(ProcessCache.Entry, :now_ts, cycle([now, now + 49, now + 50])) - - assert 3 = trans("my key", 50, fn -> 3 end) - assert 3 = trans("my key", 50, fn -> 6 end) - assert 6 = trans("my key", 50, fn -> 6 end) - end -end diff --git a/apps/language_server/test/experimental/project_test.exs b/apps/language_server/test/experimental/project_test.exs deleted file mode 100644 index 34f983532..000000000 --- a/apps/language_server/test/experimental/project_test.exs +++ /dev/null @@ -1,348 +0,0 @@ -defmodule ElixirLS.Experimental.ProjectTest do - alias ElixirLS.LanguageServer.Experimental.Project - alias ElixirLS.LanguageServer.SourceFile - alias ElixirLS.LanguageServer.Test.Paths - - use ExUnit.Case, async: false - use Patch - - def fixture(opts \\ []) do - signature_help? = Keyword.get(opts, :signature_help?, false) - dynamic_registration? = Keyword.get(opts, :dynamic_registration?, false) - hierarchical_symbols? = Keyword.get(opts, :hierarchical_symbols?, false) - snippet? = Keyword.get(opts, :snippet?, false) - deprecated? = Keyword.get(opts, :deprecated?, false) - tag? = Keyword.get(opts, :tag?, false) - - %{ - "textDocument" => %{ - "signatureHelp" => signature_help?, - "codeAction" => %{"dynamicRegistration" => dynamic_registration?}, - "documentSymbol" => %{"hierarchicalDocumentSymbolSupport" => hierarchical_symbols?}, - "completion" => %{ - "completionItem" => %{ - "snippetSupport" => snippet?, - "deprecatedSupport" => deprecated?, - "tagSupport" => tag? - } - } - } - } - end - - def root_uri do - System.tmp_dir!() - |> Path.join("my_project") - |> SourceFile.Path.to_uri() - end - - def with_a_root_uri(_) do - {:ok, root_uri: root_uri()} - end - - setup do - patch(File, :cd, :ok) - patch(File, :dir?, true) - patch(Mix, :env, :ok) - :ok - end - - describe "new/2" do - setup [:with_a_root_uri] - - test "should set the root uri" do - patch(File, :cwd, {:ok, SourceFile.Path.absolute_from_uri(root_uri())}) - project = Project.new(root_uri()) - assert project.root_uri == root_uri() - end - - test "should handle a nil root uri" do - project = Project.new(nil) - assert project.root_uri == nil - end - - test "should cd to the root uri if it exists" do - Project.new(root_uri()) - root_path = SourceFile.Path.absolute_from_uri(root_uri()) - - assert_called(File.cd(^root_path)) - end - - test "shouldn't cd to the root uri if it doesn't exist" do - non_existent_uri = "file:///hopefully/doesn_t/exist" - patch(File, :cd, {:error, :enoent}) - - project = Project.new(non_existent_uri) - - assert project.root_uri == nil - end - end - - def with_a_valid_root_uri(_) do - {:ok, project: Project.new(root_uri())} - end - - describe "changing mix.env" do - setup [:with_a_valid_root_uri] - - test "overwrites an unset env ", ctx do - assert {:ok, %Project{} = project} = Project.change_mix_env(ctx.project, "dev") - - assert project.mix_env == :dev - assert_called(Mix.env(:dev)) - end - - test "defaults to test", ctx do - assert {:ok, %Project{} = project} = Project.change_mix_env(ctx.project, "") - - assert project.mix_env == :test - assert_called(Mix.env(:test)) - end - - test "defaults to test with an empty param", ctx do - assert {:ok, %Project{} = project} = Project.change_mix_env(ctx.project, nil) - assert project.mix_env == :test - assert_called(Mix.env(:test)) - end - - test "with the same mix env has no effect ", ctx do - project = %{ctx.project | mix_env: :dev} - - assert {:ok, %Project{} = project} = Project.change_mix_env(project, "dev") - assert project.mix_env == :dev - refute_called(Mix.env(_)) - end - - test "overriding with nil has no effect", ctx do - project = %{ctx.project | mix_env: :dev} - - assert {:ok, %Project{} = project} = Project.change_mix_env(project, nil) - assert project.mix_env == :dev - refute_called(Mix.env(_)) - end - - test "overriding with an emppty string has no effect", ctx do - project = %{ctx.project | mix_env: :dev} - - assert {:ok, %Project{} = project} = Project.change_mix_env(project, "") - assert project.mix_env == :dev - refute_called(Mix.env(_)) - end - - test "to a new env requires a restar", ctx do - project = %{ctx.project | mix_env: :prod} - - assert {:restart, :warning, message} = Project.change_mix_env(project, "dev") - assert message =~ "Mix env change detected." - refute_called(Mix.env(_)) - end - end - - def with_patched_system_put_env(_) do - patch(System, :put_env, :ok) - on_exit(fn -> restore(System) end) - :ok - end - - describe "setting env vars" do - setup [:with_a_valid_root_uri, :with_patched_system_put_env] - - test "sets env vars if it wasn't set", ctx do - vars = %{"first_var" => "first_value", "second_var" => "second_value"} - assert {:ok, %Project{} = project} = Project.change_environment_variables(ctx.project, vars) - - expected_env_vars = %{ - "first_var" => "first_value", - "second_var" => "second_value" - } - - assert project.env_variables == expected_env_vars - assert_called(System.put_env(^expected_env_vars)) - end - - test "keeps existing env vars if they're the same as the old ones", ctx do - vars = %{"first_var" => "first_value", "second_var" => "second_value"} - project = %Project{ctx.project | env_variables: vars} - - expected_env_vars = %{ - "first_var" => "first_value", - "second_var" => "second_value" - } - - assert {:ok, %Project{} = project} = Project.change_environment_variables(project, vars) - assert project.env_variables == expected_env_vars - refute_called(System.put_env(_)) - end - - test "rejects env variables that aren't a compatible format", ctx do - vars = ["a", "b", "c"] - - assert {:ok, %Project{} = project} = Project.change_environment_variables(ctx.project, vars) - assert project.env_variables == nil - refute_called(System.put_env(_)) - end - - test "requires a restart if the variables have been set and are being overridden", ctx do - project = %{ctx.project | env_variables: %{}} - vars = %{"foo" => "6"} - - assert {:restart, :warning, message} = Project.change_environment_variables(project, vars) - assert message =~ "Environment variables have changed" - refute_called(System.put_env(_)) - end - end - - def with_patched_mix_target(_) do - patch(Mix, :target, :ok) - :ok - end - - describe "setting the mix target" do - setup [:with_a_valid_root_uri, :with_patched_mix_target] - - test "allows you to set the mix target if it was unset", ctx do - assert {:ok, %Project{} = project} = Project.change_mix_target(ctx.project, "local") - assert project.mix_target == :local - assert_called(Mix.target(:local)) - end - - test "rejects nil for the new target", ctx do - assert {:ok, %Project{} = project} = Project.change_mix_target(ctx.project, nil) - assert project.mix_target == nil - refute_called(Mix.target(:local)) - end - - test "rejects empty string for the new target", ctx do - assert {:ok, %Project{} = project} = Project.change_mix_target(ctx.project, "") - assert project.mix_target == nil - refute_called(Mix.target(:local)) - end - - test "does nothing if the mix target is the same as the old target", ctx do - project = %Project{ctx.project | mix_target: :local} - - assert {:ok, %Project{} = project} = Project.change_mix_target(project, "local") - assert project.mix_target == :local - refute_called(Mix.target(:local)) - end - - test "requires a restart if it was changed after being previously set", ctx do - project = %Project{ctx.project | mix_target: :local} - - assert {:restart, :warning, message} = Project.change_mix_target(project, "docs") - assert message =~ "Mix target change detected." - refute_called(Mix.target(_)) - end - end - - describe("setting the project dir") do - setup [:with_a_valid_root_uri] - - test "becomes part of the project if the state is empty", ctx do - patch(File, :exists?, fn path, _ -> - String.ends_with?(path, "mix.exs") - end) - - sub_dir = Path.join(~w(sub_dir new dir)) - assert {:ok, %Project{} = project} = Project.change_project_directory(ctx.project, sub_dir) - - assert Project.project_path(project) == - [File.cwd!(), "sub_dir", "new", "dir"] - |> Path.join() - |> Paths.to_native_separators() - - assert project.mix_project? - end - - test "only sets the project directory if the root uri is set" do - project = Project.new(nil) - sub_dir = Path.join(~w(sub_dir new dir)) - - assert {:ok, project} = Project.change_project_directory(project, sub_dir) - assert project.root_uri == nil - assert Project.project_path(project) == nil - end - - test "defaults to the root uri's directory", ctx do - assert {:ok, project} = Project.change_project_directory(ctx.project, nil) - root_path = SourceFile.Path.absolute_from_uri(project.root_uri) - assert Project.project_path(project) == Paths.to_native_separators(root_path) - end - - test "defaults to the root uri's directory if the project directory is empty", ctx do - assert {:ok, project} = Project.change_project_directory(ctx.project, "") - root_path = SourceFile.Path.absolute_from_uri(project.root_uri) - assert Project.project_path(project) == Paths.to_native_separators(root_path) - end - - test "normalizes the project directory", ctx do - subdirectory = Path.join(~w(sub_dir .. sub_dir new .. new dir)) - - patch(File, :exists?, fn path, _ -> - String.ends_with?(path, "mix.exs") - end) - - assert {:ok, %Project{} = project} = - Project.change_project_directory(ctx.project, subdirectory) - - assert sub_dir = Path.join([File.cwd!(), "sub_dir", "new", "dir"]) - assert Project.project_path(project) == Paths.to_native_separators(sub_dir) - assert project.mix_project? - - assert Project.mix_exs_path(project) == - sub_dir - |> Path.join("mix.exs") - |> Paths.to_native_separators() - end - - test "sets mix project to false if the mix.exs doesn't exist", ctx do - patch(File, :exists?, fn file_name -> - !String.ends_with?(file_name, "mix.exs") - end) - - sub_dir = Path.join(~w(sub_dir new dir)) - assert {:ok, %Project{} = project} = Project.change_project_directory(ctx.project, sub_dir) - - assert Project.project_path(project) == - File.cwd!() - |> Path.join(sub_dir) - |> Paths.to_native_separators() - - refute project.mix_project? - end - - test "asks for a restart if the project directory was set and the new one isn't the same", - ctx do - foo_sub_dir = Path.join(~w(sub_dir foo)) - {:ok, project} = Project.change_project_directory(ctx.project, foo_sub_dir) - - new_dir_sub_dir = Path.join(~w(sub_dir new dir)) - - assert {:restart, :warning, message} = - Project.change_project_directory(project, new_dir_sub_dir) - - assert message =~ "Project directory change detected" - end - - test "shows an error if the project directory doesn't exist", ctx do - {:ok, project} = Project.change_project_directory(ctx.project, "sub_dir/foo") - - patch(File, :dir?, false) - - new_directory = Path.join(~w(sub_dir new dir)) - expected_message_directory = Path.join(File.cwd!(), new_directory) - - assert {:error, message} = Project.change_project_directory(project, new_directory) - assert message =~ "Project directory #{expected_message_directory} does not exist" - end - - test "rejects a change if the project directory isn't a subdirectory of the project root", - ctx do - not_in_project = Path.join(~w(.. .. .. .. not-a-subdir)) - - assert {:error, message} = Project.change_project_directory(ctx.project, not_in_project) - - assert message =~ "is not a subdirectory of" - end - end -end diff --git a/apps/language_server/test/experimental/protocol/notifications_test.exs b/apps/language_server/test/experimental/protocol/notifications_test.exs deleted file mode 100644 index f6d0ae299..000000000 --- a/apps/language_server/test/experimental/protocol/notifications_test.exs +++ /dev/null @@ -1,43 +0,0 @@ -defmodule LSP.NotificationsTest do - alias LSP.Notifications - import Notifications - use ExUnit.Case - - defp fixture(:notification, opts \\ []) do - [method: "something/didChange", params: %{"foo" => 3, "bar" => 6}] - |> Keyword.merge(opts) - |> Enum.reduce(%{"jsonrpc" => "2.0"}, fn - {_k, :drop}, acc -> - acc - - {k, v}, acc -> - Map.put(acc, Atom.to_string(k), v) - end) - end - - describe "matching macros" do - test "can identify a notification with params" do - notification(method, params) = fixture(:notification) - - assert method == "something/didChange" - assert params == %{"foo" => 3, "bar" => 6} - end - - test "can identify a notification without params" do - notification(method) = fixture(:notification, params: :drop) - - assert method == "something/didChange" - end - - test "a notification's params can be an array" do - notification(_method, params) = fixture(:notification, params: [1, 2, 3, 4]) - assert params == [1, 2, 3, 4] - end - - test "a notification's params can be map" do - notification(_method, params) = fixture(:notification, params: %{"a" => "b"}) - - assert params == %{"a" => "b"} - end - end -end diff --git a/apps/language_server/test/experimental/protocol/proto_test.exs b/apps/language_server/test/experimental/protocol/proto_test.exs deleted file mode 100644 index c8551dc9f..000000000 --- a/apps/language_server/test/experimental/protocol/proto_test.exs +++ /dev/null @@ -1,727 +0,0 @@ -defmodule ElixirLS.LanguageServer.Experimental.ProtoTest do - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto.LspTypes - alias LSP.Types - alias ElixirLS.LanguageServer.Experimental.SourceFile - import ElixirLS.LanguageServer.Fixtures.LspProtocol - - require LspTypes.ErrorCodes - - use ExUnit.Case, async: true - - defmodule Child do - use Proto - - deftype name: string() - end - - describe "string fields" do - defmodule StringField do - use Proto - - deftype string_field: string() - end - - test "can parse a string field" do - assert {:ok, val} = StringField.parse(%{"stringField" => "value"}) - assert val.string_field == "value" - end - - test "rejects nil string fields" do - assert {:error, {:invalid_value, :string_field, nil}} = - StringField.parse(%{"stringField" => nil}) - end - end - - describe "integer fields" do - defmodule IntegerField do - use Proto - deftype int_field: integer() - end - - test "can parse an integer field" do - assert {:ok, val} = IntegerField.parse(%{"intField" => 494}) - assert val.int_field == 494 - end - - test "rejects nil int fields" do - assert {:error, {:invalid_value, :int_field, "string"}} = - IntegerField.parse(%{"intField" => "string"}) - end - end - - describe "float fields" do - defmodule FloatField do - use Proto - deftype float_field: float() - end - - test "can parse a float field" do - assert {:ok, val} = FloatField.parse(%{"floatField" => 494.02}) - assert val.float_field == 494.02 - end - - test "rejects nil float fields" do - assert {:error, {:invalid_value, :float_field, "string"}} = - FloatField.parse(%{"floatField" => "string"}) - end - end - - describe "list fields" do - defmodule ListField do - use Proto - deftype list_field: list_of(integer()) - end - - test "can parse a list field" do - assert {:ok, proto} = ListField.parse(%{"listField" => [1, 2, 3]}) - assert proto.list_field == [1, 2, 3] - end - - test "rejecting invalid list of integers" do - assert {:error, {:invalid_value, :list_field, 99}} = ListField.parse(%{"listField" => 99}) - - assert {:error, {:invalid_value, :list_field, "hi"}} = - ListField.parse(%{"listField" => ["hi"]}) - - assert {:ok, result} = ListField.parse(%{"listField" => [99]}) - assert result.list_field == [99] - end - end - - describe "tuple fields" do - defmodule TupleField do - use Proto - deftype tuple_field: tuple_of([integer(), string(), map_of(string())]) - end - - test "can be parsed" do - assert {:ok, proto} = - TupleField.parse(%{"tupleField" => [1, "hello", %{"k" => "3", "v" => "9"}]}) - - assert proto.tuple_field == {1, "hello", %{"k" => "3", "v" => "9"}} - end - - test "can be encoded" do - proto = TupleField.new(tuple_field: {1, "hello", %{"k" => "v"}}) - - assert {:ok, encoded} = encode_and_decode(proto) - assert encoded["tupleField"] == [1, "hello", %{"k" => "v"}] - end - end - - describe "proto fields" do - defmodule SingleParent do - use Proto - - deftype name: string(), child: Child - end - - test "can parse another proto" do - assert {:ok, parent} = - SingleParent.parse(%{ - "name" => "stinky", - "child" => %{"name" => "Smelly"} - }) - - assert parent.name == "stinky" - assert parent.child.name == "Smelly" - end - - test "fails to parse another proto" do - assert {:error, {:invalid_map, "bad"}} == - SingleParent.parse(%{"name" => "stinky", "child" => "bad"}) - - assert {:error, {:missing_keys, ["name"], Child}} == - SingleParent.parse(%{"name" => "parent", "child" => %{"oof" => "not good"}}) - end - end - - describe "type aliases" do - defmodule TypeAlias do - use Proto - defalias one_of([string(), list_of(string())]) - end - - defmodule UsesAlias do - use Proto - - deftype alias: type_alias(TypeAlias), name: string() - end - - test "parses a single item correctly" do - assert {:ok, uses} = UsesAlias.parse(%{"name" => "uses", "alias" => "foo"}) - assert uses.name == "uses" - assert uses.alias == "foo" - end - - test "parses a list correctly" do - assert {:ok, uses} = UsesAlias.parse(%{"name" => "uses", "alias" => ["foo", "bar"]}) - assert uses.name == "uses" - assert uses.alias == ~w(foo bar) - end - - test "encodes correctly" do - assert {:ok, encoded} = encode_and_decode(UsesAlias.new(alias: "hi", name: "easy")) - assert encoded["alias"] == "hi" - assert encoded["name"] == "easy" - end - - test "parse fails if the type isn't correct" do - assert {:error, {:incorrect_type, _, %{}}} = - UsesAlias.parse(%{"name" => "ua", "alias" => %{}}) - end - end - - describe "optional fields" do - defmodule OptionalString do - use Proto - deftype required_string: string(), maybe_there: optional(string()) - end - - test "optional fields can be parsed" do - assert {:ok, proto} = - OptionalString.parse(%{"requiredString" => "req", "maybeThere" => "is_there"}) - - assert proto.required_string == "req" - assert proto.maybe_there == "is_there" - end - - test "optional fields can be omitted" do - assert {:ok, proto} = OptionalString.parse(%{"requiredString" => "req"}) - - assert proto.required_string == "req" - assert proto.maybe_there == nil - end - end - - describe "literal string fields" do - defmodule LiteralString do - use Proto - - deftype name: literal("name"), value: string() - end - - test "it should parse correctly" do - assert {:ok, proto} = LiteralString.parse(%{"name" => "name", "value" => "val"}) - assert proto.name == "name" - assert proto.value == "val" - end - - test "parse should fail if the value isn't the expected value" do - assert {:error, {:invalid_value, :name, "not_name"}} = - LiteralString.parse(%{"name" => "not_name", "value" => "val"}) - end - end - - describe "literal list fields" do - defmodule LiteralList do - use Proto - - deftype name: string(), keys: literal([1, 2, 9, 10]) - end - - test "it should parse correctly" do - assert {:ok, _} = LiteralList.parse(%{"name" => "ll", "keys" => [1, 2, 9, 10]}) - end - - test "parse should fail if the list isn't correct" do - assert {:error, {:invalid_value, :keys, _}} = - LiteralList.parse(%{"name" => "name", "keys" => [9, 2, 1, 10]}) - end - end - - describe "any field" do - defmodule AnyTest do - use Proto - deftype any_list: list_of(any()), any_toplevel: any(), any_optional: optional(any()) - end - - test "it should parse correctly" do - assert {:ok, proto} = - AnyTest.parse(%{ - "anyList" => [1, 3, "a", "b", [43]], - "anyToplevel" => 999, - "anyOptional" => ["any"] - }) - - assert proto.any_list == [1, 3, "a", "b", [43]] - assert proto.any_toplevel == 999 - assert proto.any_optional == ["any"] - end - - test "it should let an optional field be omitted" do - assert {:ok, proto} = - AnyTest.parse(%{ - "anyList" => [1, 3, "a", "b", [43]], - "anyToplevel" => 999 - }) - - assert proto.any_optional == nil - end - end - - describe "constants" do - defmodule ConstantTest do - use Proto - - defenum(good: 1, bad: 2, ugly: 3) - end - - defmodule UsesConstants do - use Proto - deftype name: string(), state: ConstantTest - end - - test "it should define a constant module" do - require ConstantTest - assert ConstantTest.good() == 1 - assert ConstantTest.bad() == 2 - assert ConstantTest.ugly() == 3 - end - - test "constants should parse" do - assert {:ok, :good} == ConstantTest.parse(1) - assert {:ok, :bad} == ConstantTest.parse(2) - assert {:ok, :ugly} == ConstantTest.parse(3) - assert {:error, {:invalid_constant, 4}} = ConstantTest.parse(4) - end - - test "constants should parse when used as values" do - assert {:ok, proto} = UsesConstants.parse(%{"name" => "Clint", "state" => 1}) - assert proto.name == "Clint" - assert proto.state == :good - end - - test "constants should render as their values" do - assert {:ok, proto} = UsesConstants.parse(%{"name" => "Clint", "state" => 2}) - assert {:ok, encoded} = JasonV.encode(proto) - assert {:ok, decoded} = JasonV.decode(encoded) - assert 2 == decoded["state"] - end - end - - describe "constructors" do - defmodule RequiredFields do - use Proto - - deftype name: string(), value: optional(string()), age: integer() - end - - test "required fields are required" do - assert_raise ArgumentError, fn -> - RequiredFields.new() - end - - assert_raise ArgumentError, fn -> - RequiredFields.new(name: "hi", value: "good") - end - - assert RequiredFields.new(name: "hi", value: "good", age: 29) - end - end - - def with_source_file_store(_) do - source_file = """ - defmodule MyTest do - def add(a, b), do: a + b - end - """ - - file_uri = "file:///file.ex" - {:ok, _} = start_supervised(SourceFile.Store) - SourceFile.Store.open(file_uri, source_file, 1) - - {:ok, uri: file_uri} - end - - describe "notifications" do - setup [:with_source_file_store] - - defmodule Notif do - use Proto - - defnotification "textDocument/somethingHappened", - :exlusive, - line: integer(), - notice_message: string(), - column: integer() - end - - test "parse fills out the notification" do - assert {:ok, params} = - params_for(Notif, line: 3, column: 5, notice_message: "This went wrong") - - assert {:ok, notif} = Notif.parse(params) - - assert notif.method == "textDocument/somethingHappened" - assert notif.jsonrpc == "2.0" - assert notif.lsp.line == 3 - assert notif.lsp.column == 5 - assert notif.lsp.notice_message == "This went wrong" - end - - test "the base request is not filled out when parse is called" do - assert {:ok, params} = - params_for(Notif, line: 3, column: 5, notice_message: "This went wrong") - - assert {:ok, notif} = Notif.parse(params) - - refute notif.line - refute notif.column - refute notif.notice_message - end - - test "to_elixir fills out the elixir fields" do - assert {:ok, params} = - params_for(Notif, line: 3, column: 5, notice_message: "This went wrong") - - assert {:ok, notif} = Notif.parse(params) - assert {:ok, notif} = Notif.to_elixir(notif) - - assert notif.line == 3 - assert notif.column == 5 - assert notif.notice_message == "This went wrong" - end - - defmodule Notif.WithTextDoc do - use Proto - - defnotification "notif/withTextDoc", - :exclusive, - text_document: Types.TextDocument.Identifier - end - - test "to_elixir fills out the source file", ctx do - assert {:ok, params} = params_for(Notif.WithTextDoc.LSP, text_document: [uri: ctx.uri]) - assert {:ok, notif} = Notif.WithTextDoc.parse(params) - assert {:ok, notif} = Notif.WithTextDoc.to_elixir(notif) - assert %SourceFile{} = notif.source_file - end - - defmodule Notif.WithPos do - use Proto - - defnotification "notif/WithPos", - :exclusive, - text_document: Types.TextDocument.Identifier, - position: Types.Position - end - - test "to_elixir fills out a position", ctx do - assert {:ok, params} = - params_for(Notif.WithPos.LSP, - text_document: [uri: ctx.uri], - position: [line: 0, character: 0] - ) - - assert {:ok, notif} = Notif.WithPos.parse(params) - assert {:ok, notif} = Notif.WithPos.to_elixir(notif) - - assert %SourceFile{} = notif.source_file - assert %SourceFile.Position{} = notif.position - assert notif.position.line == 1 - assert notif.position.character == 0 - end - - defmodule Notif.WithRange do - use Proto - - defnotification "notif/WithPos", - :exclusive, - text_document: Types.TextDocument.Identifier, - range: Types.Range - end - - test "to_elixir fills out a range", ctx do - assert {:ok, params} = - params_for(Notif.WithRange.LSP, - text_document: [uri: ctx.uri], - range: [ - start: [line: 0, character: 0], - end: [line: 0, character: 3] - ] - ) - - assert {:ok, notif} = Notif.WithRange.parse(params) - assert {:ok, notif} = Notif.WithRange.to_elixir(notif) - - assert %SourceFile{} = notif.source_file - assert %SourceFile.Range{} = notif.range - assert notif.range.start.line == 1 - assert notif.range.start.character == 0 - assert notif.range.end.line == 1 - assert notif.range.end.character == 3 - end - end - - describe "requests" do - setup [:with_source_file_store] - - defmodule Req do - use Proto - - defrequest "something", :exclusive, line: integer(), error_message: string() - end - - defmodule TextDocReq do - use Proto - - defrequest "textDoc", :exclusive, text_document: Types.TextDocument.Identifier - end - - test "parse fills out the request" do - assert {:ok, params} = params_for(Req, id: 3, line: 9, error_message: "borked") - assert {:ok, req} = Req.parse(params) - assert req.id == "3" - assert req.method == "something" - assert req.jsonrpc == "2.0" - assert req.lsp.line == 9 - assert req.lsp.error_message == "borked" - end - - test "the base request is not filled out via parsing" do - assert {:ok, params} = params_for(Req, id: 3, line: 9, error_message: "borked") - assert {:ok, req} = Req.parse(params) - - refute req.line - refute req.error_message - end - - test "parse fills out the raw lsp request" do - assert {:ok, params} = params_for(Req, id: 3, line: 9, error_message: "borked") - assert {:ok, req} = Req.parse(params) - assert req.lsp.line == 9 - assert req.lsp.error_message == "borked" - end - - test "to_elixir fills out the base request" do - assert {:ok, params} = params_for(Req, id: 3, line: 9, error_message: "borked") - assert {:ok, req} = Req.parse(params) - assert {:ok, req} = Req.to_elixir(req) - - assert req.line == 9 - assert req.error_message == "borked" - end - - test "to_elixir fills out a source file", ctx do - assert {:ok, params} = params_for(TextDocReq.LSP, text_document: [uri: ctx.uri]) - assert {:ok, req} = TextDocReq.parse(params) - assert {:ok, ex_req} = TextDocReq.to_elixir(req) - - assert %TextDocReq{} = ex_req - assert %SourceFile{} = ex_req.source_file - end - - defmodule PositionReq do - use Proto - - defrequest "posReq", :exclusive, - text_document: Types.TextDocument.Identifier, - position: Types.Position - end - - test "to_elixir fills out a position", ctx do - assert {:ok, params} = - params_for(PositionReq.LSP, - text_document: [uri: ctx.uri], - position: [line: 1, character: 6] - ) - - assert {:ok, req} = PositionReq.parse(params) - - refute req.position - refute req.source_file - - assert {:ok, ex_req} = PositionReq.to_elixir(req) - - assert %SourceFile.Position{} = ex_req.position - assert %SourceFile{} = ex_req.source_file - end - - defmodule RangeReq do - use Proto - - defrequest "rangeReq", :exclusive, - text_document: Types.TextDocument.Identifier, - range: Types.Range - end - - test "to_elixir fills out a range", ctx do - assert {:ok, params} = - params_for(RangeReq.LSP, - text_document: [uri: ctx.uri], - range: [start: [line: 0, character: 0], end: [line: 0, character: 5]] - ) - - assert {:ok, req} = RangeReq.parse(params) - assert {:ok, req} = RangeReq.to_elixir(req) - - assert req.range == - SourceFile.Range.new( - SourceFile.Position.new(1, 0), - SourceFile.Position.new(1, 5) - ) - end - end - - describe "responses" do - defmodule Resp do - use Proto - - defresponse list_of(integer()) - end - - test "you can create a response" do - response = Resp.new(123, [8, 6, 7, 5]) - assert response.result == [8, 6, 7, 5] - refute response.error - end - - test "you can create an error with a code" do - response = Resp.error(123, 33816, "this is bad") - assert response.id == 123 - assert response.error.code == 33816 - end - - test "you can create an error with a message" do - response = Resp.error(123, 33816, "this is bad") - assert response.id == 123 - assert response.error.code == 33816 - assert response.error.message == "this is bad" - end - - test "a response can be encoded and decoded" do - response = Resp.new(123, [8, 6, 7, 5]) - - assert {:ok, decoded} = encode_and_decode(response) - - assert decoded["id"] == 123 - assert decoded["result"] == [8, 6, 7, 5] - end - - test "an error can be encoded and decoded" do - error = Resp.error(123, :parse_error, "super bad") - assert {:ok, decoded} = encode_and_decode(error) - - assert decoded["id"] == 123 - assert decoded["error"]["message"] == "super bad" - assert decoded["error"]["code"] == LspTypes.ErrorCodes.parse_error() - end - end - - describe "encoding" do - defmodule Mood do - use Proto - defenum happy: 1, sad: 2, miserable: 3 - end - - defmodule EncodingTest do - use Proto - - deftype s: string(), - a: any(), - l: list_of(string()), - i: integer(), - lit: literal("foo"), - enum: Mood, - c: optional(Child), - snake_case_name: string() - end - - def fixture(:encoding, include_child \\ false) do - base = %{ - "s" => "hello", - "a" => ["a", "there"], - "l" => ~w(these are strings), - "i" => 42, - "enum" => 1, - "lit" => "foo", - "snakeCaseName" => "foo" - } - - if include_child do - Map.put(base, "c", Child.new(name: "eric")) - else - base - end - end - - def encode_and_decode(%_struct{} = proto) do - with {:ok, encoded} <- JasonV.encode(proto) do - JasonV.decode(encoded) - end - end - - test "it should be able to encode" do - expected = fixture(:encoding) - assert {:ok, proto} = EncodingTest.parse(expected) - assert {:ok, decoded} = encode_and_decode(proto) - assert decoded == expected - end - - test "it camelizes encoded field names" do - expected = fixture(:encoding) - assert {:ok, proto} = EncodingTest.parse(expected) - assert proto.snake_case_name == "foo" - assert {:ok, decoded} = encode_and_decode(proto) - assert decoded["snakeCaseName"] == "foo" - end - end - - describe "spread" do - defmodule SpreadTest do - use Proto - - deftype name: string(), ..: map_of(string(), as: :opts) - end - - test "it should accept any string keys" do - assert {:ok, proto} = SpreadTest.parse(%{"name" => "spread", "key" => "value"}) - assert proto.name == "spread" - assert proto.opts == %{"key" => "value"} - end - - test "it should encode the spread" do - spread = SpreadTest.new(name: "spread", opts: %{"key" => "value"}) - - assert {:ok, decoded} = encode_and_decode(spread) - - assert decoded["key"] == "value" - assert decoded["name"] == "spread" - end - end - - describe "access behavior" do - defmodule Recursive do - use Proto - deftype name: string(), age: integer(), child: optional(__MODULE__) - end - - def family do - grandkid = Recursive.new(name: "grandkid", age: 8) - child = Recursive.new(name: "child", age: 53, child: grandkid) - Recursive.new(name: "parent", age: 65, child: child) - end - - test "access should work" do - parent = family() - assert get_in(parent, [:child, :child, :age]) == parent.child.child.age - assert get_in(parent, [:child, :age]) == parent.child.age - end - - test "put_in should work" do - parent = put_in(family(), [:child, :child, :age], 28) - assert parent.child.child.age == 28 - end - - test "get and update in should work" do - {"grandkid", parent} = - get_and_update_in(family(), [:child, :child, :name], fn old_name -> - {old_name, "erica"} - end) - - assert parent.child.child.name == "erica" - end - end -end diff --git a/apps/language_server/test/experimental/protocol/requests_test.exs b/apps/language_server/test/experimental/protocol/requests_test.exs deleted file mode 100644 index 2feaf872a..000000000 --- a/apps/language_server/test/experimental/protocol/requests_test.exs +++ /dev/null @@ -1,45 +0,0 @@ -defmodule LSP.RequestsTest do - alias LSP.Requests - import Requests - use ExUnit.Case - - defp fixture(opts \\ []) do - [method: "something/didChange", id: 3, params: %{"foo" => 3, "bar" => 6}] - |> Keyword.merge(opts) - |> Enum.reduce(%{"jsonrpc" => "2.0"}, fn - {_k, :drop}, acc -> - acc - - {k, v}, acc -> - Map.put(acc, Atom.to_string(k), v) - end) - end - - describe "matching macros" do - test "can identify a request with params" do - request(id, method, params) = fixture() - - assert id == 3 - assert method == "something/didChange" - assert params == %{"foo" => 3, "bar" => 6} - end - - test "can identify a request without params" do - request(id, method) = fixture(params: :drop) - - assert id == 3 - assert method == "something/didChange" - end - - test "a request's params can be an array" do - request(_id, _method, params) = fixture(params: [1, 2, 3, 4]) - assert params == [1, 2, 3, 4] - end - - test "a request's params can be map" do - request(_id, _method, params) = fixture(params: %{"a" => "b"}) - - assert params == %{"a" => "b"} - end - end -end diff --git a/apps/language_server/test/experimental/provider/code_action/#warning_parser.ex# b/apps/language_server/test/experimental/provider/code_action/#warning_parser.ex# deleted file mode 100644 index 1081b95ec..000000000 --- a/apps/language_server/test/experimental/provider/code_action/#warning_parser.ex# +++ /dev/null @@ -1,59 +0,0 @@ -defmodule ElixirLS.LanguageServer.Experimental.Provider.CodeAction.WarningParser do - @moduledoc """ - A parser for elixir warning messages - """ - - @type error_message :: String.t() - - def parse(warning_or_error) do - with {:ok, error_type} <- extract_type(warning_or_error), - {:ok, message} <- extract_message(warning_or_error), - {:ok, path, line} <- extract_path_and_line(warning_or_error), - {:ok, mfa} <- extract_mfa(warning_or_error) do - {:ok, error_type, message, path, line, mfa} - end - end - - defp extract_type(warning_or_error) do - - end - - @path_and_line_re ~r/\s+([^\:]+):(\d+)/ - def extract_path_and_line(message) do - with {:ok, line} <- fetch_line(message, 1), - [[_, path, line_number_string]] <- Regex.scan(@path_and_line_re, line), - {line_number, ""} <- Integer.parse(line_number_string) do - {:ok, path, line_number} - else - _ -> - :error - end - end - - @mfa_re ~r/:\s+([^\/]+)\/(\d+)/ - defp extract_mfa(message) do - with {:ok, line} <- fetch_line(message, 1), - [[_, module_and_function, arity_string]] <- Regex.scan(@mfa_re, line), - {arity, ""} <- Integer.parse(arity_string) do - {module, function} = split_module_and_function(module_and_function) - {:ok, {module, function, arity}} - else - _ -> - :error - end - end - - defp split_module_and_function(module_and_function) do - [function | reversed_module] = - module_and_function - |> String.split(".") - |> Enum.reverse() - - module = - reversed_module - |> Enum.reduce([], fn piece, acc -> [String.to_atom(piece) | acc] end) - |> Module.concat() - - {module, String.to_atom(function)} - end -end diff --git a/apps/language_server/test/experimental/provider/code_action/replace_remote_function_test.exs b/apps/language_server/test/experimental/provider/code_action/replace_remote_function_test.exs deleted file mode 100644 index dd304906d..000000000 --- a/apps/language_server/test/experimental/provider/code_action/replace_remote_function_test.exs +++ /dev/null @@ -1,322 +0,0 @@ -defmodule ElixirLS.LanguageServer.Experimental.Provider.CodeAction.ReplaceRemoteFunctionTest do - alias LSP.Requests - alias LSP.Requests.CodeAction, as: CodeActionRequest - alias LSP.Types.CodeAction - alias LSP.Types.CodeAction, as: CodeActionReply - alias LSP.Types.Diagnostic - alias LSP.Types.Range - alias ElixirLS.LanguageServer.Experimental.Provider.CodeAction.ReplaceRemoteFunction - alias ElixirLS.LanguageServer.Experimental.SourceFile - alias ElixirLS.LanguageServer.Experimental.SourceFile.Document - alias ElixirLS.LanguageServer.Fixtures.LspProtocol - alias ElixirLS.LanguageServer.SourceFile.Path, as: SourceFilePath - - import LspProtocol - import ReplaceRemoteFunction - - use ExUnit.Case - use Patch - - setup do - {:ok, _} = start_supervised(SourceFile.Store) - :ok - end - - defp diagnostic_message(arity) do - """ - Enum.counts/#{arity} is undefined or private. Did you mean: - - * concat/1 - * concat/2 - * count/1 - * count/2 - """ - end - - defp code_action(file_body, file_path, line, opts \\ []) do - file_uri = SourceFilePath.to_uri(file_path) - SourceFile.Store.open(file_uri, file_body, 0) - - {:ok, range} = - build(Range, - start: [line: line, character: 0], - end: [line: line, character: 0] - ) - - message = - Keyword.get_lazy(opts, :diagnostic_message, fn -> - diagnostic_message(1) - end) - - diagnostic = Diagnostic.new(range: range, message: message) - {:ok, context} = build(CodeAction.Context, diagnostics: [diagnostic]) - - {:ok, action} = - build(CodeActionRequest, - text_document: [uri: file_uri], - range: range, - context: context - ) - - {:ok, action} = Requests.to_elixir(action) - - {file_uri, file_body, action} - end - - defp apply_selected_action({file_uri, file_body, code_action}, index) do - action = - code_action - |> apply() - |> Enum.at(index) - - assert %CodeActionReply{edit: %{changes: %{^file_uri => edits}}} = action - - {:ok, %SourceFile{document: document}} = - file_uri - |> SourceFile.new(file_body, 0) - |> SourceFile.apply_content_changes(1, edits) - - document - end - - test "produces no actions if the function is not found" do - assert {_, _, action} = code_action("Enum.count([1, 2])", "/project/file.ex", 0) - assert [] = apply(action) - end - - test "produces no actions if the line is empty" do - {_, _, action} = code_action("", "/project/file.ex", 0) - assert [] = apply(action) - end - - test "produces no results if the diagnostic message doesn't fit the format" do - assert {_, _, action} = - code_action("", "/project/file.ex", 0, diagnostic_message: "This isn't cool") - - assert [] = apply(action) - end - - test "produces no results for buggy source code" do - {_, _, action} = - ~S[ - 1 + 2~/3 ; 4ab( - ] - |> code_action("/project/file.ex", 0) - - assert [] = apply(action) - end - - test "handles nil context" do - assert {_, _, action} = code_action("other_var = 6", "/project/file.ex", 0) - - action = put_in(action, [:context], nil) - - assert [] = apply(action) - end - - test "handles nil diagnostics" do - assert {_, _, action} = code_action("other_var = 6", "/project/file.ex", 0) - - action = put_in(action, [:context, :diagnostics], nil) - - assert [] = apply(action) - end - - test "handles empty diagnostics" do - assert {_, _, action} = code_action("other_var = 6", "/project/file.ex", 0) - - action = put_in(action, [:context, :diagnostics], []) - - assert [] = apply(action) - end - - test "applied to an isolated function" do - actual_code = ~S[ - Enum.counts(a) - ] - - expected_doc = ~S[ - Enum.count(a) - ] |> Document.new() - - assert expected_doc == - actual_code - |> code_action("/project/file.ex", 1) - |> apply_selected_action(0) - - expected_doc = ~S[ - Enum.concat(a) - ] |> Document.new() - - assert expected_doc == - actual_code - |> code_action("/project/file.ex", 1) - |> apply_selected_action(1) - end - - test "works for a function assigned to a variable" do - actual_code = ~S[ - var = &Enum.counts/1 - ] - - expected_doc = ~S[ - var = &Enum.count/1 - ] |> Document.new() - - assert expected_doc == - actual_code - |> code_action("/project/file.ex", 1) - |> apply_selected_action(0) - - expected_doc = ~S[ - var = &Enum.concat/1 - ] |> Document.new() - - assert expected_doc == - actual_code - |> code_action("/project/file.ex", 1) - |> apply_selected_action(1) - end - - test "works with multiple lines" do - actual_code = ~S[ - defmodule MyModule do - def my_func(a) do - Enum.counts(a) - end - end - ] - - expected_doc = ~S[ - defmodule MyModule do - def my_func(a) do - Enum.count(a) - end - end - ] |> Document.new() - - assert expected_doc == - actual_code - |> code_action("/project/file.ex", 3) - |> apply_selected_action(0) - - expected_doc = ~S[ - defmodule MyModule do - def my_func(a) do - Enum.concat(a) - end - end - ] |> Document.new() - - assert expected_doc == - actual_code - |> code_action("/project/file.ex", 3) - |> apply_selected_action(1) - end - - test "proposed functions need to match the replaced function arity" do - {_, _, code_action} = - ~S[ - Enum.counts(a) - ] - |> code_action("/project/file.ex", 0, diagnostic_message: diagnostic_message(3)) - - assert [] = apply(code_action) - end - - test "does not replace variables" do - {_, _, code_action} = - ~S[ - counts + 42 - ] - |> code_action("/project/file.ex", 0) - - assert [] = apply(code_action) - end - - test "works with aliased modules" do - diagnostic_message = """ - Example.A.B.my_fun/1 is undefined or private. Did you mean: - - * my_func/1 - """ - - actual_code = ~S[ - defmodule Example do - defmodule A.B do - def my_func(a), do: a - end - - defmodule C do - def my_fun(a), do: a - end - - defmodule D do - alias Example.A - alias Example.A.B - alias Example.C - def bar() do - A.B.my_fun(42) - C.my_fun(42) + B.my_fun(42) - end - end - end - ] - - # A.B.my_fun(42) - expected_doc = ~S[ - defmodule Example do - defmodule A.B do - def my_func(a), do: a - end - - defmodule C do - def my_fun(a), do: a - end - - defmodule D do - alias Example.A - alias Example.A.B - alias Example.C - def bar() do - A.B.my_func(42) - C.my_fun(42) + B.my_fun(42) - end - end - end - ] |> Document.new() - - assert expected_doc == - actual_code - |> code_action("/project/file.ex", 15, diagnostic_message: diagnostic_message) - |> apply_selected_action(0) - - # B.my_fun(42) - expected_doc = ~S[ - defmodule Example do - defmodule A.B do - def my_func(a), do: a - end - - defmodule C do - def my_fun(a), do: a - end - - defmodule D do - alias Example.A - alias Example.A.B - alias Example.C - def bar() do - A.B.my_fun(42) - C.my_fun(42) + B.my_func(42) - end - end - end - ] |> Document.new() - - assert expected_doc == - actual_code - |> code_action("/project/file.ex", 16, diagnostic_message: diagnostic_message) - |> apply_selected_action(0) - end -end diff --git a/apps/language_server/test/experimental/provider/code_action/replace_with_underscore_test.exs b/apps/language_server/test/experimental/provider/code_action/replace_with_underscore_test.exs deleted file mode 100644 index 5b1f48c05..000000000 --- a/apps/language_server/test/experimental/provider/code_action/replace_with_underscore_test.exs +++ /dev/null @@ -1,149 +0,0 @@ -defmodule ElixirLS.LanguageServer.Experimental.Provider.CodeAction.ReplaceWithUnderscoreTest do - alias LSP.Requests - alias LSP.Requests.CodeAction, as: CodeActionRequest - alias LSP.Types.CodeAction - alias LSP.Types.CodeAction, as: CodeActionReply - - alias LSP.Types.Diagnostic - alias LSP.Types.Range - alias ElixirLS.LanguageServer.Experimental.Provider.CodeAction.ReplaceWithUnderscore - alias ElixirLS.LanguageServer.Experimental.SourceFile - alias ElixirLS.LanguageServer.Fixtures.LspProtocol - alias ElixirLS.LanguageServer.SourceFile.Path, as: SourceFilePath - - import LspProtocol - import ReplaceWithUnderscore - - use ExUnit.Case - use Patch - - setup do - {:ok, _} = start_supervised(SourceFile.Store) - :ok - end - - def diagnostic_message(file_path, line, variable_name, {module_name, function_name, arity}) do - """ - warning: variable "#{variable_name}" is unused (if the variable is not meant to be used, prefix it with an underscore) - #{file_path}:#{line}: #{module_name}.#{function_name}/#{arity} - """ - end - - def code_action(file_body, file_path, line, variable_name, opts \\ []) do - trimmed_body = String.trim(file_body, "\n") - - file_uri = SourceFilePath.to_uri(file_path) - SourceFile.Store.open(file_uri, trimmed_body, 0) - - {:ok, range} = - build(Range, - start: [line: line, character: 0], - end: [line: line, character: 0] - ) - - message_file_path = Keyword.get(opts, :message_file_path, file_path) - mfa = Keyword.get(opts, :mfa, {"MyModule", "myfunc", 1}) - - message = - Keyword.get_lazy(opts, :diagnostic_message, fn -> - diagnostic_message(message_file_path, line, variable_name, mfa) - end) - - diagnostic = Diagnostic.new(range: range, message: message) - {:ok, context} = build(CodeAction.Context, diagnostics: [diagnostic]) - - {:ok, action} = - build(CodeActionRequest, - text_document: [uri: file_uri], - range: range, - context: context - ) - - {:ok, action} = Requests.to_elixir(action) - {file_uri, action} - end - - def to_map(%Range{} = range) do - range - |> JasonV.encode!() - |> JasonV.decode!() - end - - test "produces no actions if the name or variable is not found" do - assert {_, action} = code_action("other_var = 6", "/project/file.ex", 1, "not_found") - assert [] = apply(action) - end - - test "produces no actions if the line is empty" do - {_, action} = code_action("", "/project/file.ex", 1, "a") - assert [] = apply(action) - end - - test "produces no results if the diagnostic message doesn't fit the format" do - assert {_, action} = - code_action("", "/project/file.ex", 1, "not_found", - diagnostic_message: "This isn't cool" - ) - - assert [] = apply(action) - end - - test "produces no results for buggy source code" do - {_, action} = - ~S[ - 1 + 2~/3 ; 4ab( - ] - |> code_action("/project/file.ex", 0, "unused") - - assert [] = apply(action) - end - - test "handles nil context" do - assert {_, action} = code_action("other_var = 6", "/project/file.ex", 1, "not_found") - - action = put_in(action, [:context], nil) - - assert [] = apply(action) - end - - test "handles nil diagnostics" do - assert {_, action} = code_action("other_var = 6", "/project/file.ex", 1, "not_found") - - action = put_in(action, [:context, :diagnostics], nil) - - assert [] = apply(action) - end - - test "handles empty diagnostics" do - assert {_, action} = code_action("other_var = 6", "/project/file.ex", 1, "not_found") - - action = put_in(action, [:context, :diagnostics], []) - - assert [] = apply(action) - end - - test "applied to an unadorned param" do - {file_uri, code_action} = - ~S[ - def my_func(a) do - ] - |> code_action("/project/file.ex", 0, "a") - - assert [%CodeActionReply{edit: %{changes: %{^file_uri => [edit]}}}] = apply(code_action) - assert edit.new_text == "_" - end - - test "works with multiple lines" do - {file_uri, code_action} = ~S[ - defmodule MyModule do - def my_func(a) do - end - end - ] |> code_action("/project/file.ex", 1, "a") - - assert [%CodeActionReply{edit: %{changes: %{^file_uri => [edit]}}}] = apply(code_action) - assert edit.new_text == "_" - assert edit.range.start.line == 1 - assert edit.range.end.line == 1 - end -end diff --git a/apps/language_server/test/experimental/provider/handlers/find_references_test.exs b/apps/language_server/test/experimental/provider/handlers/find_references_test.exs deleted file mode 100644 index 68c598514..000000000 --- a/apps/language_server/test/experimental/provider/handlers/find_references_test.exs +++ /dev/null @@ -1,232 +0,0 @@ -defmodule ElixirLS.Experimental.Provider.Handlers.FindReferencesTest do - alias ElixirLS.LanguageServer.Build - alias LSP.Requests.FindReferences - alias LSP.Responses - alias LSP.Types - alias ElixirLS.LanguageServer.Experimental.Provider.Env - alias ElixirLS.LanguageServer.Experimental.Provider.Handlers - alias ElixirLS.LanguageServer.Experimental.SourceFile - alias ElixirLS.LanguageServer.Experimental.SourceFile.Conversions - alias ElixirLS.LanguageServer.Fixtures.LspProtocol - alias ElixirLS.LanguageServer.Test.FixtureHelpers - alias ElixirLS.LanguageServer.Tracer - - import LspProtocol - import ElixirLS.Test.TextLoc, only: [annotate_assert: 4] - require ElixirLS.Test.TextLoc - use ExUnit.Case, async: false - - @fixtures_to_load [ - "references_referenced.ex", - "references_imported.ex", - "references_remote.ex", - "uses_macro_a.ex", - "macro_a.ex" - ] - - setup_all do - File.rm_rf!(FixtureHelpers.get_path(".elixir_ls/calls.dets")) - {:ok, _} = start_supervised(Tracer) - - Tracer.set_project_dir(FixtureHelpers.get_path("")) - - compiler_options = Code.compiler_options() - Build.set_compiler_options(ignore_module_conflict: true) - - on_exit(fn -> - Code.compiler_options(compiler_options) - end) - - names_to_paths = - for file <- @fixtures_to_load, - path = FixtureHelpers.get_path(file), - into: %{} do - Code.compile_file(path) - {file, path} - end - - {:ok, paths: names_to_paths} - end - - setup do - {:ok, _} = start_supervised(SourceFile.Store) - :ok - end - - def request(file_path, line, char) do - uri = Conversions.ensure_uri(file_path) - - params = [ - text_document: [uri: uri], - position: [line: line, character: char] - ] - - with {:ok, contents} <- File.read(file_path), - :ok <- SourceFile.Store.open(uri, contents, 1), - {:ok, _source_file} <- SourceFile.Store.fetch(uri), - {:ok, req} <- build(FindReferences, params) do - FindReferences.to_elixir(req) - end - end - - def handle(request) do - Handlers.FindReferences.handle(request, Env.new()) - end - - test "finds local, remote and imported references to a function", ctx do - line = 1 - char = 8 - file_path = ctx.paths["references_referenced.ex"] - {:ok, request} = request(file_path, line, char) - - annotate_assert(file_path, line, char, """ - def referenced_fun do - ^ - """) - - {:reply, %Responses.FindReferences{result: references}} = handle(request) - - assert length(references) == 3 - assert Enum.any?(references, &String.ends_with?(&1.uri, "references_remote.ex")) - assert Enum.any?(references, &String.ends_with?(&1.uri, "references_imported.ex")) - assert Enum.any?(references, &String.ends_with?(&1.uri, "references_referenced.ex")) - end - - test "finds local, remote and imported references to a macro", ctx do - line = 8 - char = 12 - - file_path = ctx.paths["references_referenced.ex"] - {:ok, request} = request(file_path, line, char) - - annotate_assert(file_path, line, char, """ - defmacro referenced_macro(clause, do: expression) do - ^ - """) - - {:reply, %Responses.FindReferences{result: references}} = handle(request) - - assert length(references) == 3 - - assert Enum.any?(references, &String.ends_with?(&1.uri, "references_remote.ex")) - assert Enum.any?(references, &String.ends_with?(&1.uri, "references_imported.ex")) - assert Enum.any?(references, &String.ends_with?(&1.uri, "references_referenced.ex")) - end - - test "find a references to a macro generated function call", ctx do - line = 6 - char = 13 - - file_path = ctx.paths["uses_macro_a.ex"] - - annotate_assert(file_path, line, char, """ - macro_a_func() - ^ - """) - - {:ok, request} = request(file_path, line, char) - uri = request.source_file.uri - - {:reply, %Responses.FindReferences{result: result}} = handle(request) - - assert [location] = result - - %Types.Location{ - range: %Types.Range{ - start: %Types.Position{character: 4, line: 6}, - end: %Types.Position{character: 16, line: 6} - }, - uri: ^uri - } = location - end - - test "finds a references to a macro imported function call", ctx do - line = 10 - char = 4 - - file_path = ctx.paths["uses_macro_a.ex"] - - {:ok, request} = request(file_path, line, char) - - uri = request.source_file.uri - - annotate_assert(file_path, line, char, """ - macro_imported_fun() - ^ - """) - - {:reply, %Responses.FindReferences{result: [reference]}} = handle(request) - - assert %Types.Location{ - range: %Types.Range{ - start: %Types.Position{line: 10, character: 4}, - end: %Types.Position{line: 10, character: 22} - }, - uri: ^uri - } = reference - end - - test "finds references to a variable", ctx do - line = 4 - char = 14 - file_path = ctx.paths["references_referenced.ex"] - - annotate_assert(file_path, line, char, """ - IO.puts(referenced_variable + 1) - ^ - """) - - assert {:ok, request} = request(file_path, line, char) - uri = request.source_file.uri - - {:reply, %Responses.FindReferences{result: [first, second]}} = handle(request) - - assert %Types.Location{ - uri: ^uri, - range: %Types.Range{ - start: %Types.Position{character: 4, line: 2}, - end: %Types.Position{character: 23, line: 2} - } - } = first - - assert %Types.Location{ - range: %Types.Range{ - start: %Types.Position{character: 12, line: 4}, - end: %Types.Position{character: 31, line: 4} - } - } = second - end - - test "finds references to an attribute", ctx do - line = 24 - char = 5 - file_path = ctx.paths["references_referenced.ex"] - - annotate_assert(file_path, line, char, """ - @referenced_attribute \"123\" - ^ - """) - - {:ok, request} = request(file_path, line, char) - - {:reply, %Responses.FindReferences{result: [first, second]}} = handle(request) - - uri = request.source_file.uri - - assert %Types.Location{ - uri: ^uri, - range: %Types.Range{ - start: %Types.Position{character: 2, line: 24}, - end: %Types.Position{character: 23, line: 24} - } - } = first - - assert %Types.Location{ - uri: ^uri, - range: %Types.Range{ - start: %Types.Position{character: 4, line: 27}, - end: %Types.Position{character: 25, line: 27} - } - } = second - end -end diff --git a/apps/language_server/test/experimental/provider/handlers/formatting_test.exs b/apps/language_server/test/experimental/provider/handlers/formatting_test.exs deleted file mode 100644 index 16883350d..000000000 --- a/apps/language_server/test/experimental/provider/handlers/formatting_test.exs +++ /dev/null @@ -1,3 +0,0 @@ -defmodule ElixriLS.LanguageServer.Experimental.Provider.Handlers.FormattingTest do - use ExUnit.Case -end diff --git a/apps/language_server/test/experimental/provider/handlers/goto_definition_test.exs b/apps/language_server/test/experimental/provider/handlers/goto_definition_test.exs deleted file mode 100644 index a33ce1f00..000000000 --- a/apps/language_server/test/experimental/provider/handlers/goto_definition_test.exs +++ /dev/null @@ -1,208 +0,0 @@ -defmodule ElixirLS.Experimental.Provider.Handlers.GotoDefinitionTest do - alias LSP.Requests.GotoDefinition - alias LSP.Responses - alias ElixirLS.LanguageServer.Experimental.Provider.Env - alias ElixirLS.LanguageServer.Experimental.Provider.Handlers - alias ElixirLS.LanguageServer.Experimental.SourceFile - alias ElixirLS.LanguageServer.Experimental.SourceFile.Conversions - alias ElixirLS.LanguageServer.Fixtures.LspProtocol - alias ElixirLS.LanguageServer.Test.FixtureHelpers - - import LspProtocol - import ElixirLS.Test.TextLoc, only: [annotate_assert: 4] - use ExUnit.Case, async: true - - setup do - {:ok, _} = start_supervised(SourceFile.Store) - :ok - end - - def request(file_path, line, char) do - uri = Conversions.ensure_uri(file_path) - - params = [ - text_document: [uri: uri], - position: [line: line, character: char] - ] - - with {:ok, contents} <- File.read(file_path), - :ok <- SourceFile.Store.open(uri, contents, 1), - {:ok, req} <- build(GotoDefinition, params) do - GotoDefinition.to_elixir(req) - end - end - - def handle(request) do - Handlers.GotoDefinition.handle(request, Env.new()) - end - - def with_referenced_file(_) do - path = FixtureHelpers.get_path("references_referenced.ex") - uri = Conversions.ensure_uri(path) - {:ok, file_uri: uri, file_path: path} - end - - describe "when a file contains references" do - setup [:with_referenced_file] - - test "find definition remote function call", %{file_uri: uri} do - file_path = FixtureHelpers.get_path("references_remote.ex") - {line, char} = {4, 28} - - {:ok, request} = request(file_path, line, char) - - annotate_assert(file_path, line, char, """ - ReferencesReferenced.referenced_fun() - ^ - """) - - {:reply, %Responses.GotoDefinition{result: definition}} = handle(request) - - assert definition.uri == uri - assert definition.range.start.line == 1 - assert definition.range.start.character == 2 - assert definition.range.end.line == 1 - assert definition.range.end.character == 2 - end - - test "find definition remote macro call", %{file_uri: uri} do - file_path = FixtureHelpers.get_path("references_remote.ex") - {line, char} = {8, 28} - - {:ok, request} = request(file_path, line, char) - - annotate_assert(file_path, line, char, """ - ReferencesReferenced.referenced_macro a do - ^ - """) - - {:reply, %Responses.GotoDefinition{result: definition}} = handle(request) - - assert definition.uri == uri - assert definition.range.start.line == 8 - assert definition.range.start.character == 2 - assert definition.range.end.line == 8 - assert definition.range.end.character == 2 - end - - test "find definition imported function call", %{file_uri: uri} do - file_path = FixtureHelpers.get_path("references_imported.ex") - {line, char} = {4, 5} - - {:ok, request} = request(file_path, line, char) - - annotate_assert(file_path, line, char, """ - referenced_fun() - ^ - """) - - {:reply, %Responses.GotoDefinition{result: definition}} = handle(request) - - assert definition.uri == uri - assert definition.range.start.line == 1 - assert definition.range.start.character == 2 - assert definition.range.end.line == 1 - assert definition.range.end.character == 2 - end - - test "find definition imported macro call", %{file_uri: uri} do - file_path = FixtureHelpers.get_path("references_imported.ex") - {line, char} = {8, 5} - - {:ok, request} = request(file_path, line, char) - - annotate_assert(file_path, line, char, """ - referenced_macro a do - ^ - """) - - {:reply, %Responses.GotoDefinition{result: definition}} = handle(request) - - assert definition.uri == uri - assert definition.range.start.line == 8 - assert definition.range.start.character == 2 - assert definition.range.end.line == 8 - assert definition.range.end.character == 2 - end - - test "find definition local function call", %{file_uri: uri} do - file_path = FixtureHelpers.get_path("references_referenced.ex") - {line, char} = {15, 5} - - {:ok, request} = request(file_path, line, char) - - annotate_assert(file_path, line, char, """ - referenced_fun() - ^ - """) - - {:reply, %Responses.GotoDefinition{result: definition}} = handle(request) - - assert definition.uri == uri - assert definition.range.start.line == 1 - assert definition.range.start.character == 2 - assert definition.range.end.line == 1 - assert definition.range.end.character == 2 - end - - test "find definition local macro call", %{file_uri: uri} do - file_path = FixtureHelpers.get_path("references_referenced.ex") - {line, char} = {19, 5} - - {:ok, request} = request(file_path, line, char) - - annotate_assert(file_path, line, char, """ - referenced_macro a do - ^ - """) - - {:reply, %Responses.GotoDefinition{result: definition}} = handle(request) - - assert definition.uri == uri - assert definition.range.start.line == 8 - assert definition.range.start.character == 2 - assert definition.range.end.line == 8 - assert definition.range.end.character == 2 - end - - test "find definition variable", %{file_uri: uri} do - file_path = FixtureHelpers.get_path("references_referenced.ex") - {line, char} = {4, 13} - - {:ok, request} = request(file_path, line, char) - - annotate_assert(file_path, line, char, """ - IO.puts(referenced_variable + 1) - ^ - """) - - {:reply, %Responses.GotoDefinition{result: definition}} = handle(request) - - assert definition.uri == uri - assert definition.range.start.line == 2 - assert definition.range.start.character == 4 - assert definition.range.end.line == 2 - assert definition.range.end.character == 4 - end - - test "find definition attribute", %{file_uri: uri} do - file_path = FixtureHelpers.get_path("references_referenced.ex") - {line, char} = {27, 5} - - {:ok, request} = request(file_path, line, char) - - annotate_assert(file_path, line, char, """ - @referenced_attribute - ^ - """) - - {:reply, %Responses.GotoDefinition{result: definition}} = handle(request) - - assert definition.uri == uri - assert definition.range.start.line == 24 - assert definition.range.start.character == 2 - assert definition.range.end.line == 24 - assert definition.range.end.character == 2 - end - end -end diff --git a/apps/language_server/test/experimental/provider/queue_test.exs b/apps/language_server/test/experimental/provider/queue_test.exs deleted file mode 100644 index 13100d693..000000000 --- a/apps/language_server/test/experimental/provider/queue_test.exs +++ /dev/null @@ -1,101 +0,0 @@ -defmodule ElixirLS.LanguageServer.Experimental.Provider.QueueTest do - alias LSP.Requests - alias LSP.Responses - alias ElixirLS.LanguageServer.Experimental.Provider - alias ElixirLS.LanguageServer.Experimental.Provider.Env - alias ElixirLS.LanguageServer.Experimental.SourceFile - alias ElixirLS.LanguageServer.Tracer - alias ElixirLS.Utils.WireProtocol - - import ElixirLS.LanguageServer.Fixtures.LspProtocol - use ExUnit.Case - use Patch - - setup do - {:ok, _} = start_supervised(Provider.Queue.Supervisor.child_spec()) - {:ok, _} = start_supervised(Provider.Queue) - {:ok, _} = start_supervised(Tracer) - - {:ok, env: %Env{}} - end - - def with_patched_store(_) do - patch(SourceFile.Store, :fetch, fn uri -> - source = """ - defmodule MyModule do - end - """ - - source_file = SourceFile.new(uri, source, 1) - {:ok, source_file} - end) - - :ok - end - - def with_redirected_replies(_) do - me = self() - - patch(WireProtocol, :send, fn message -> - send(me, {:wire_protocol, message}) - end) - - :ok - end - - describe "the request queue" do - setup [:with_patched_store, :with_redirected_replies] - - test "handles a find references request", ctx do - {:ok, request} = - build(Requests.FindReferences, - id: 1, - text_document: [uri: "file:///file.ex", position: [line: 0, character: 5]] - ) - - assert :ok = Provider.Queue.add(request, ctx.env) - assert_receive {:wire_protocol, %Responses.FindReferences{id: "1"}} - end - - test "can cancel requests", ctx do - patch(Provider.Handlers.FindReferences, :handle, fn -> - Process.sleep(250) - {:reply, Responses.FindReferences.new(1, [])} - end) - - {:ok, request} = - build(Requests.FindReferences, - id: 1, - text_document: [uri: "file:///file.ex", position: [line: 0, character: 0]] - ) - - assert :ok = Provider.Queue.add(request, ctx.env) - assert :ok = Provider.Queue.cancel(request.id) - - refute_receive {:wire_protocol, _} - end - - test "knows if a request is running", ctx do - patch(Provider.Handlers.FindReferences, :handle, fn -> - Process.sleep(250) - {:reply, Responses.FindReferences.new(1, [])} - end) - - {:ok, request} = - build(Requests.FindReferences, - id: 1, - text_document: [uri: "file:///file.ex", position: [line: 0, character: 0]] - ) - - assert :ok = Provider.Queue.add(request, ctx.env) - assert Provider.Queue.running?(request) - assert Provider.Queue.running?(request.id) - - assert_receive {:wire_protocol, _} - Process.sleep(100) - - refute Provider.Queue.running?(request) - refute Provider.Queue.running?(request.id) - end - end -end diff --git a/apps/language_server/test/experimental/server/configuration_test.exs b/apps/language_server/test/experimental/server/configuration_test.exs deleted file mode 100644 index 95b07b1fd..000000000 --- a/apps/language_server/test/experimental/server/configuration_test.exs +++ /dev/null @@ -1,286 +0,0 @@ -defmodule ElixirLS.Experimental.Server.ConfigurationTest do - alias ElixirLS.LanguageServer.Dialyzer - alias ElixirLS.LanguageServer.Experimental.Project - alias LSP.Notifications.DidChangeConfiguration - alias ElixirLS.LanguageServer.Experimental.Protocol.Proto.LspTypes.Registration - alias LSP.Requests.RegisterCapability - alias ElixirLS.LanguageServer.Experimental.Server.Configuration - alias ElixirLS.LanguageServer.SourceFile - alias ElixirLS.LanguageServer.Test.Paths - - use ExUnit.Case, async: false - use Patch - - def fixture(opts \\ []) do - signature_help? = Keyword.get(opts, :signature_help?, false) - dynamic_registration? = Keyword.get(opts, :dynamic_registration?, false) - hierarchical_symbols? = Keyword.get(opts, :hierarchical_symbols?, false) - snippet? = Keyword.get(opts, :snippet?, false) - deprecated? = Keyword.get(opts, :deprecated?, false) - tag? = Keyword.get(opts, :tag?, false) - - %{ - "textDocument" => %{ - "signatureHelp" => signature_help?, - "codeAction" => %{"dynamicRegistration" => dynamic_registration?}, - "documentSymbol" => %{"hierarchicalDocumentSymbolSupport" => hierarchical_symbols?}, - "completion" => %{ - "completionItem" => %{ - "snippetSupport" => snippet?, - "deprecatedSupport" => deprecated?, - "tagSupport" => tag? - } - } - } - } - end - - def root_uri do - System.tmp_dir() - |> Path.join("my_project") - |> SourceFile.Path.to_uri() - end - - def with_a_root_uri(_) do - {:ok, root_uri: root_uri()} - end - - setup do - patch(File, :cd, :ok) - patch(File, :dir?, true) - patch(Mix, :env, :ok) - :ok - end - - describe "new/2" do - setup [:with_a_root_uri] - - test "should set the root uri" do - patch(File, :cwd, {:ok, SourceFile.Path.absolute_from_uri(root_uri())}) - config = Configuration.new(root_uri(), fixture()) - assert config.project.root_uri == root_uri() - end - - test "should handle a nil root uri" do - config = Configuration.new(nil, fixture()) - assert config.project.root_uri == nil - end - - test "should cd to the root uri if it exists" do - Configuration.new(root_uri(), fixture()) - root_path = SourceFile.Path.absolute_from_uri(root_uri()) - - assert_called(File.cd(^root_path)) - end - - test "shouldn't cd to the root uri if it doesn't exist" do - non_existent_uri = "file:///hopefully/doesn_t/exist" - patch(File, :cd, {:error, :enoent}) - - config = Configuration.new(non_existent_uri, fixture()) - - assert config.project.root_uri == nil - end - - test "should read dynamic registration" do - pos_config = Configuration.new(root_uri(), fixture(dynamic_registration?: true)) - neg_config = Configuration.new(root_uri(), fixture(dynamic_registration?: false)) - - assert pos_config.support.code_action_dynamic_registration? - refute neg_config.support.code_action_dynamic_registration? - refute Configuration.new(root_uri(), %{}).support.code_action_dynamic_registration? - end - - test "it should support signature_help" do - assert Configuration.new(root_uri(), fixture(signature_help?: true)).support.signature_help? - - refute Configuration.new(root_uri(), fixture(signature_help?: false)).support.signature_help? - - refute Configuration.new(root_uri(), %{}).support.signature_help? - end - - test "it should support hierarchical registration" do - assert Configuration.new(root_uri(), fixture(hierarchical_symbols?: true)).support.hierarchical_document_symbols? - - refute Configuration.new(root_uri(), fixture(hierarchical_symbols?: false)).support.hierarchical_document_symbols? - - refute Configuration.new(root_uri(), %{}).support.hierarchical_document_symbols? - end - - test "it should support snippets" do - assert Configuration.new(root_uri(), fixture(snippet?: true)).support.snippet? - refute Configuration.new(root_uri(), fixture(snippet?: false)).support.snippet? - refute Configuration.new(root_uri(), %{}).support.snippet? - end - - test "it should support deprecated" do - assert Configuration.new(root_uri(), fixture(deprecated?: true)).support.deprecated? - refute Configuration.new(root_uri(), fixture(deprecated?: false)).support.deprecated? - refute Configuration.new(root_uri(), %{}).support.deprecated? - end - - test "it should support tags" do - assert Configuration.new(root_uri(), fixture(deprecated?: true)).support.deprecated? - refute Configuration.new(root_uri(), fixture(deprecated?: false)).support.deprecated? - refute Configuration.new(root_uri(), %{}).support.deprecated? - end - end - - def with_an_empty_config(_) do - {:ok, config: Configuration.new(root_uri(), %{})} - end - - describe "changing mix.env" do - setup [:with_an_empty_config] - - test "overwrites an unset env ", ctx do - change = DidChangeConfiguration.new(settings: %{"mixEnv" => "dev"}) - assert {:ok, %Configuration{} = config} = Configuration.on_change(ctx.config, change) - - assert config.project.mix_env == :dev - assert_called(Mix.env(:dev)) - end - - test "defaults to test", ctx do - change = DidChangeConfiguration.new(settings: %{}) - assert {:ok, %Configuration{} = config} = Configuration.on_change(ctx.config, change) - - assert config.project.mix_env == :test - assert_called(Mix.env(:test)) - end - end - - def with_patched_system_put_env(_) do - patch(System, :put_env, :ok) - - on_exit(fn -> - restore(System) - end) - - :ok - end - - describe "setting env vars" do - setup [:with_an_empty_config, :with_patched_system_put_env] - - test "overwrites existing env vars if it wasn't set", ctx do - vars = %{"first_var" => "first_value", "second_var" => "second_value"} - - change = DidChangeConfiguration.new(settings: %{"envVariables" => vars}) - assert {:ok, %Configuration{} = config} = Configuration.on_change(ctx.config, change) - - expected_env_vars = %{ - "first_var" => "first_value", - "second_var" => "second_value" - } - - assert config.project.env_variables == expected_env_vars - assert_called(System.put_env(^expected_env_vars)) - end - end - - def with_patched_mix_target(_) do - patch(Mix, :target, :ok) - :ok - end - - describe "setting the mix target" do - setup [:with_an_empty_config, :with_patched_mix_target] - - test "allows you to set the mix target if it was unset", ctx do - change = DidChangeConfiguration.new(settings: %{"mixTarget" => "local"}) - - assert {:ok, %Configuration{} = config} = Configuration.on_change(ctx.config, change) - assert config.project.mix_target == :local - assert_called(Mix.target(:local)) - end - end - - describe("setting the project dir") do - setup [:with_an_empty_config] - - test "becomes part of the project if the state is empty", ctx do - subdir_path = Path.join(~w(sub_dir new dir)) - change = DidChangeConfiguration.new(settings: %{"projectDir" => subdir_path}) - - assert {:ok, %Configuration{} = config} = Configuration.on_change(ctx.config, change) - - assert Project.project_path(config.project) == - File.cwd!() - |> Path.join(subdir_path) - |> Paths.to_native_separators() - end - - test "only sets the project directory if the root uri is set" do - config = Configuration.new(nil, fixture()) - subdir_path = Path.join(~w(sub_dir new dir)) - change = DidChangeConfiguration.new(settings: %{"projectDir" => subdir_path}) - - assert {:ok, config} = Configuration.on_change(config, change) - assert config.project.root_uri == nil - assert Project.project_path(config.project) == nil - end - end - - def with_patched_dialyzer_support(_) do - patch(Dialyzer, :check_support, :ok) - :ok - end - - describe("setting dialyzer being enabled") do - setup [:with_an_empty_config, :with_patched_dialyzer_support] - - test "it can be enabled if it is supported", ctx do - refute ctx.config.dialyzer_enabled? - change = DidChangeConfiguration.new(settings: %{"dialyzer_enabled" => true}) - - assert {:ok, config} = Configuration.on_change(ctx.config, change) - assert config.dialyzer_enabled? - end - - test "it should be on by default", ctx do - change = DidChangeConfiguration.new(settings: %{}) - - assert {:ok, config} = Configuration.on_change(ctx.config, change) - assert config.dialyzer_enabled? - end - - test "if dialyzer is not supported, it can't be turned on", ctx do - patch(Dialyzer, :check_support, {:error, "Dialyzer is broken"}) - change = DidChangeConfiguration.new(settings: %{"dialyzer_enabled" => true}) - - assert {:ok, config} = Configuration.on_change(ctx.config, change) - refute config.dialyzer_enabled? - end - end - - describe("setting watched extensions") do - setup [:with_an_empty_config] - - test "it returns the state if no extenstions are given", ctx do - config = ctx.config - change = DidChangeConfiguration.new(settings: %{"additionalWatchedExtensions" => []}) - # ensuring it didn't send back any messages for us to process - assert {:ok, _} = Configuration.on_change(config, change) - end - - test "it returns a register capability request with watchers for each extension", ctx do - config = ctx.config - - change = - DidChangeConfiguration.new( - settings: %{"additionalWatchedExtensions" => [".ex3", ".heex"]} - ) - - assert {:ok, _config, %RegisterCapability{} = watch_request} = - Configuration.on_change(config, change) - - assert [%Registration{} = registration] = watch_request.lsp.registrations - assert registration.method == "workspace/didChangeWatchedFiles" - - assert %{"watchers" => watchers} = registration.register_options - assert %{"globPattern" => "**/*.ex3"} in watchers - assert %{"globPattern" => "**/*.heex"} in watchers - end - end -end diff --git a/apps/language_server/test/experimental/server/state_test.exs b/apps/language_server/test/experimental/server/state_test.exs deleted file mode 100644 index ee14b07aa..000000000 --- a/apps/language_server/test/experimental/server/state_test.exs +++ /dev/null @@ -1,124 +0,0 @@ -defmodule ElixirLS.LanguageServer.Experimental.Server.StateTest do - alias LSP.Requests.Initialize - alias LSP.Notifications - alias LSP.Types.TextDocument - - alias LSP.Types.TextDocument.ContentChangeEvent.TextDocumentContentChangeEvent, - as: RangedContentChangeEvent - - alias LSP.Types.TextDocument.ContentChangeEvent.TextDocumentContentChangeEvent1, - as: ReplaceContentChangeEvent - - alias ElixirLS.LanguageServer.Experimental.SourceFile - alias ElixirLS.LanguageServer.Experimental.Server.State - - import ElixirLS.LanguageServer.Fixtures.LspProtocol - - use ExUnit.Case - - setup do - {:ok, _} = start_supervised(SourceFile.Store) - :ok - end - - def uri do - "file:///file.ex" - end - - def initialized_state do - {:ok, initialize} = build(Initialize, root_uri: "file:///my_project", capabilities: %{}) - {:ok, state} = State.initialize(State.new(), initialize) - - state - end - - def with_an_open_document(_) do - {:ok, did_open} = - build(Notifications.DidOpen, - id: 1, - text_document: [uri: uri(), version: 1, text: "hello"] - ) - - {:ok, state} = State.apply(initialized_state(), did_open) - {:ok, state: state} - end - - def change_notification(opts \\ []) do - {:ok, ranged_event} = - build(RangedContentChangeEvent, - range: [start: [line: 0, character: 0], end: [line: 0, character: 4]], - text: "dog" - ) - - {:ok, identifier} = - build(TextDocument.Versioned.Identifier, - uri: Keyword.get(opts, :uri, uri()), - version: Keyword.get(opts, :version, 2) - ) - - Notifications.DidChange.new( - text_document: identifier, - content_changes: [ReplaceContentChangeEvent.new(text: "goodbye"), ranged_event] - ) - end - - def with_a_changed_document(ctx) do - {:ok, state} = State.apply(ctx.state, change_notification()) - {:ok, state: state, change: change_notification()} - end - - test "closing a document that isn't open fails" do - {:ok, did_close} = build(Notifications.DidClose, text_document: [uri: uri()]) - assert {:error, :not_open} = State.apply(initialized_state(), did_close) - end - - test "saving a document that isn't open fails" do - {:ok, save} = build(Notifications.DidSave, text_document: [uri: uri()]) - assert {:error, :not_open} = State.apply(initialized_state(), save) - end - - test "applying a didOpen notification" do - assert {:error, :not_open} = SourceFile.Store.fetch(uri()) - - {:ok, did_open} = - build(Notifications.DidOpen, - id: 1, - text_document: [uri: uri(), version: 1, text: "hello"] - ) - - {:ok, _state} = State.apply(initialized_state(), did_open) - assert {:ok, file} = SourceFile.Store.fetch(uri()) - assert SourceFile.to_string(file) == "hello" - assert file.version == 1 - end - - describe "a document is open" do - setup [:with_an_open_document] - - test "can be changed", %{state: state} do - assert {:ok, _state} = State.apply(state, change_notification()) - - assert {:ok, file} = SourceFile.Store.fetch(uri()) - assert file.dirty? - assert SourceFile.to_string(file) == "dogbye" - end - - test "a change is rejected if the version is less than the current version", ctx do - change = change_notification(version: 1) - - assert {:error, :invalid_version} = State.apply(ctx.state, change) - end - end - - describe "an open, changed document" do - setup [:with_an_open_document, :with_a_changed_document] - - test "should clear the dirty field when saved", ctx do - assert {:ok, save} = build(Notifications.DidSave, text_document: [uri: uri()]) - assert {:ok, %{dirty?: true}} = SourceFile.Store.fetch(uri()) - assert {:ok, _state} = State.apply(ctx.state, save) - - assert {:ok, %{dirty?: false}} = SourceFile.Store.fetch(uri()) - end - end -end diff --git a/apps/language_server/test/experimental/source_file/conversions_test.exs b/apps/language_server/test/experimental/source_file/conversions_test.exs deleted file mode 100644 index b87f27772..000000000 --- a/apps/language_server/test/experimental/source_file/conversions_test.exs +++ /dev/null @@ -1,94 +0,0 @@ -defmodule Experimental.SourceFile.ConversionsTest do - alias ElixirLS.LanguageServer.Experimental.SourceFile.Conversions - alias ElixirLS.LanguageServer.Experimental.SourceFile.Position, as: ExPosition - alias LSP.Types.Position, as: LSPosition - alias ElixirLS.LanguageServer.Experimental.SourceFile - - use ExUnit.Case - - defp lsp_position(line, char) do - LSPosition.new(line: line, character: char) - end - - defp ex_position(line, char) do - ExPosition.new(line, char) - end - - defp doc(text) do - SourceFile.new("file:///file.ex", text, 0) - end - - describe "to_elixir/2 for positions" do - test "empty" do - assert {:ok, pos} = Conversions.to_elixir(lsp_position(0, 0), doc("")) - assert %ExPosition{line: 1, character: 0} = pos - end - - test "single first char" do - assert {:ok, pos} = Conversions.to_elixir(lsp_position(0, 0), doc("abcde")) - assert %ExPosition{line: 1, character: 0} == pos - end - - test "single line" do - assert {:ok, pos} = Conversions.to_elixir(lsp_position(0, 0), doc("abcde")) - assert %ExPosition{line: 1, character: 0} == pos - end - - test "single line utf8" do - assert {:ok, pos} = Conversions.to_elixir(lsp_position(0, 6), doc("🏳️‍🌈abcde")) - assert %ExPosition{line: 1, character: 14} == pos - end - - test "multi line" do - assert {:ok, pos} = Conversions.to_elixir(lsp_position(1, 1), doc("abcde\n1234")) - assert %ExPosition{line: 2, character: 1} == pos - end - - # LSP spec 3.17 https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#position - # position character If the character value is greater than the line length it defaults back to the line length - - test "position > line length of an empty document" do - assert {:ok, pos} = Conversions.to_elixir(lsp_position(0, 15), doc("")) - assert %ExPosition{line: 1, character: 0} == pos - end - - test "position > line length of a document with characters" do - assert {:ok, pos} = Conversions.to_elixir(lsp_position(0, 15), doc("abcde")) - assert %ExPosition{line: 1, character: 5} == pos - end - - # # This is not specified in LSP but some clients fail to synchronize text properly - test "position > line length multi line after last line" do - # the behavior that conversions does is to clamp at the start line of the end of the - # document. - assert {:ok, pos} = Conversions.to_elixir(lsp_position(8, 2), doc("abcde\n1234")) - assert %ExPosition{line: 3, character: 0} == pos - end - end - - describe "to_lsp/2 for positions" do - test "empty" do - assert :error = Conversions.to_lsp(ex_position(1, 1), doc("")) - end - - test "single line first char" do - assert {:ok, pos} = Conversions.to_lsp(ex_position(1, 1), doc("abcde")) - assert %LSPosition{line: 0, character: 1} == pos - end - - test "single line" do - assert {:ok, pos} = Conversions.to_lsp(ex_position(1, 2), doc("abcde")) - assert %LSPosition{line: 0, character: 2} == pos - end - - test "single line utf8" do - assert {:ok, pos} = Conversions.to_lsp(ex_position(1, 14), doc("🏳️‍🌈abcde")) - assert %LSPosition{character: 6, line: 0} == pos - end - - test "multi line" do - assert {:ok, pos} = Conversions.to_lsp(ex_position(2, 2), doc("abcde\n1234")) - assert %LSPosition{character: 2, line: 1} == pos - end - end -end diff --git a/apps/language_server/test/experimental/source_file/store_test.exs b/apps/language_server/test/experimental/source_file/store_test.exs deleted file mode 100644 index e66336f2f..000000000 --- a/apps/language_server/test/experimental/source_file/store_test.exs +++ /dev/null @@ -1,150 +0,0 @@ -defmodule ElixirLS.LanguageServer.Experimental.SourceFile.StoreTest do - alias ElixirLS.LanguageServer.Experimental.SourceFile - - alias LSP.Types.TextDocument.ContentChangeEvent.TextDocumentContentChangeEvent, - as: RangedContentChangeEvent - - alias LSP.Types.TextDocument.ContentChangeEvent.TextDocumentContentChangeEvent1, - as: ReplaceContextChangeEvent - - import ElixirLS.LanguageServer.Fixtures.LspProtocol - - use ExUnit.Case - use Patch - - setup do - {:ok, _} = start_supervised(SourceFile.Store) - :ok - end - - def uri do - "file:///file.ex" - end - - def with_an_open_document(_) do - :ok = SourceFile.Store.open(uri(), "hello", 1) - :ok - end - - describe "a clean store" do - test "a document can be opened" do - :ok = SourceFile.Store.open(uri(), "hello", 1) - assert {:ok, file} = SourceFile.Store.fetch(uri()) - assert SourceFile.to_string(file) == "hello" - assert file.version == 1 - end - - test "rejects changes to a file that isn't open" do - {:ok, event} = build(ReplaceContextChangeEvent, text: "dog") - - assert {:error, :not_open} = - SourceFile.Store.get_and_update( - "file:///another.ex", - &SourceFile.apply_content_changes(&1, 3, [event]) - ) - end - end - - describe "a document that is already open" do - setup [:with_an_open_document] - - test "can be fetched" do - assert {:ok, doc} = SourceFile.Store.fetch(uri()) - assert doc.uri == uri() - assert SourceFile.to_string(doc) == "hello" - end - - test "can be closed" do - assert :ok = SourceFile.Store.close(uri()) - assert {:error, :not_open} = SourceFile.Store.fetch(uri()) - end - - test "can have its content changed" do - {:ok, event} = - build(RangedContentChangeEvent, - text: "dog", - range: [ - start: [line: 0, character: 0], - end: [line: 0, character: 3] - ] - ) - - assert {:ok, doc} = - SourceFile.Store.get_and_update(uri(), fn source_file -> - SourceFile.apply_content_changes(source_file, 2, [ - event - ]) - end) - - assert SourceFile.to_string(doc) == "doglo" - assert {:ok, file} = SourceFile.Store.fetch(uri()) - assert SourceFile.to_string(file) == "doglo" - end - - test "rejects a change if the version is less than the current version" do - {:ok, event} = build(ReplaceContextChangeEvent, text: "dog") - - assert {:error, :invalid_version} = - SourceFile.Store.get_and_update( - uri(), - &SourceFile.apply_content_changes(&1, -1, [event]) - ) - end - - test "a change cannot be applied once a file is closed" do - {:ok, event} = build(ReplaceContextChangeEvent, text: "dog") - assert :ok = SourceFile.Store.close(uri()) - - assert {:error, :not_open} = - SourceFile.Store.get_and_update( - uri(), - &SourceFile.apply_content_changes(&1, 3, [event]) - ) - end - end - - def with_a_temp_document(_) do - contents = """ - defmodule FakeDocument do - end - """ - - patch(File, :read, fn _uri -> - {:ok, contents} - end) - - {:ok, contents: contents, uri: "file:///file.ex"} - end - - describe "a temp document" do - setup [:with_a_temp_document] - - test "can be opened", ctx do - assert {:ok, doc} = SourceFile.Store.open_temporary(ctx.uri, 100) - assert SourceFile.to_string(doc) == ctx.contents - end - - test "closes after a timeout", ctx do - assert {:ok, _} = SourceFile.Store.open_temporary(ctx.uri, 100) - Process.sleep(101) - refute SourceFile.Store.open?(ctx.uri) - end - - test "the extension is extended on subsequent access", ctx do - assert {:ok, _doc} = SourceFile.Store.open_temporary(ctx.uri, 100) - Process.sleep(75) - assert {:ok, _} = SourceFile.Store.open_temporary(ctx.uri, 100) - Process.sleep(75) - assert SourceFile.Store.open?(ctx.uri) - Process.sleep(50) - refute SourceFile.Store.open?(ctx.uri) - end - - test "opens permanently when a call to open is made", ctx do - assert {:ok, _doc} = SourceFile.Store.open_temporary(ctx.uri, 100) - assert :ok = SourceFile.Store.open(ctx.uri, ctx.contents, 1) - Process.sleep(120) - assert SourceFile.Store.open?(ctx.uri) - end - end -end diff --git a/apps/language_server/test/experimental/source_file_test.exs b/apps/language_server/test/experimental/source_file_test.exs deleted file mode 100644 index 8641bed75..000000000 --- a/apps/language_server/test/experimental/source_file_test.exs +++ /dev/null @@ -1,708 +0,0 @@ -defmodule ElixirLS.LanguageServer.Experimental.SourceFileTest do - alias ElixirLS.LanguageServer.Experimental - alias LSP.Types.Position - alias LSP.Types.Range - - alias LSP.Types.TextDocument.ContentChangeEvent.TextDocumentContentChangeEvent, - as: RangedContentChangeEvent - - alias ElixirLS.LanguageServer.SourceFile - - use ExUnit.Case - use ExUnitProperties - use Patch - - import ElixirLS.LanguageServer.Experimental.SourceFile, except: [to_string: 1] - - def text(%Experimental.SourceFile{} = source) do - Experimental.SourceFile.to_string(source) - end - - def new(text) do - %SourceFile{text: text} - end - - def with_a_simple_module(_) do - module = """ - defmodule MyModule do - def foo, do: 3 - - def bar(a, b) do - a + b - end - end - """ - - {:ok, module: module} - end - - describe "new" do - setup [:with_a_simple_module] - - test "it should be able to parse a single line" do - assert parsed = new("file:///elixir.ex", "hello", 1) - - assert {:ok, "hello"} = fetch_text_at(parsed, 1) - end - - test "it should parse its input into lines", ctx do - assert parsed = new("file:///elixir.ex", ctx.module, 100) - refute parsed.dirty? - assert parsed.version == 100 - - assert {:ok, "defmodule MyModule do"} = fetch_text_at(parsed, 1) - assert {:ok, " def foo, do: 3"} = fetch_text_at(parsed, 2) - assert {:ok, ""} = fetch_text_at(parsed, 3) - assert {:ok, " def bar(a, b) do"} = fetch_text_at(parsed, 4) - assert {:ok, " a + b"} = fetch_text_at(parsed, 5) - assert {:ok, " end"} = fetch_text_at(parsed, 6) - assert {:ok, "end"} = fetch_text_at(parsed, 7) - - assert :error = fetch_text_at(parsed, 8) - end - end - - describe "apply_content_changes" do - # tests and helper functions ported from https://github.com/microsoft/vscode-languageserver-node - # note thet those functions are not production quality e.g. they don't deal with utf8/utf16 encoding issues - defp index_of(string, substring) do - case String.split(string, substring, parts: 2) do - [left, _] -> left |> String.codepoints() |> length - [_] -> -1 - end - end - - def get_line_offsets(text) do - text - |> String.codepoints() - |> do_line_offset(1, 0, [{0, 0}]) - end - - def do_line_offset([], _current_line, _current_index, offsets) do - Map.new(offsets) - end - - def do_line_offset(["\r", "\n" | rest], current_line, current_index, offsets) do - do_line_offset(rest, current_line + 1, current_index + 2, [ - {current_line, current_index + 2} | offsets - ]) - end - - def do_line_offset(["\n" | rest], current_line, current_index, offsets) do - do_line_offset(rest, current_line + 1, current_index + 1, [ - {current_line, current_index + 1} | offsets - ]) - end - - def do_line_offset(["\r" | rest], current_line, current_index, offsets) do - do_line_offset(rest, current_line + 1, current_index + 1, [ - {current_line, current_index + 1} | offsets - ]) - end - - def do_line_offset([_c | rest], current_line, current_index, offsets) do - do_line_offset(rest, current_line, current_index + 1, offsets) - end - - defp find_low_high(low, high, offset, line_offsets) when low < high do - mid = floor((low + high) / 2) - - if line_offsets[mid] > offset do - find_low_high(low, mid, offset, line_offsets) - else - find_low_high(mid + 1, high, offset, line_offsets) - end - end - - defp find_low_high(low, _high, _offset, _line_offsets), do: low - - def position_at(text, offset) do - offset = clamp(offset, 0, text |> String.codepoints() |> length) - - line_offsets = get_line_offsets(text) - low = 0 - high = map_size(line_offsets) - - if high == 0 do - %{"line" => 0, "character" => offset} - else - low = find_low_high(low, high, offset, line_offsets) - - # low is the least x for which the line offset is larger than the current offset - # or array.length if no line offset is larger than the current offset - line = low - 1 - %{"line" => line, "character" => offset - line_offsets[line]} - end - end - - def clamp(num, low, high) do - num - |> max(low) - |> min(high) - end - - def position_create(l, c) do - %{"line" => l, "character" => c} - end - - def position_after_substring(text, sub_text) do - index = index_of(text, sub_text) - position_at(text, index + (String.to_charlist(sub_text) |> length)) - end - - def range_for_substring(%SourceFile{} = source_file, sub_text) do - range_for_substring(source_file.text, sub_text) - end - - def range_for_substring(source, sub_text) do - index = index_of(source, sub_text) - - substring_len = - sub_text - |> String.to_charlist() - |> length() - - %{ - "start" => position_at(source, index), - "end" => position_at(source, index + substring_len) - } - end - - def range_after_substring(%SourceFile{} = source_file, substring) do - range_after_substring(source_file.text, substring) - end - - def range_after_substring(source_text, sub_text) do - pos = position_after_substring(source_text, sub_text) - %{"start" => pos, "end" => pos} - end - - def range_create(sl, sc, el, ec) do - %{"start" => position_create(sl, sc), "end" => position_create(el, ec)} - end - - def run_changes(original, changes, opts \\ []) do - final_version = Keyword.get(opts, :version, 1) - - "file:///elixir.ex" - |> new(original, 0) - |> apply_content_changes(final_version, changes) - end - - test "empty update" do - assert {:ok, source} = run_changes("abc123", [], version: 1) - assert "abc123" == text(source) - assert source.version == 0 - end - - test "setting the version" do - assert {:ok, source} = run_changes("abc123", [%{"text" => "mornin"}], version: 3) - assert "mornin" == text(source) - assert source.version == 3 - end - - test "full update" do - assert {:ok, source} = run_changes("abc123", [%{"text" => "efg456"}]) - assert "efg456" == text(source) - assert source.version == 1 - - assert {:ok, source} = - run_changes( - "abc123", - [ - %{"text" => "hello"}, - %{"text" => "world"} - ], - version: 2 - ) - - assert "world" == text(source) - assert 2 = source.version - end - - test "starting a document" do - assert {:ok, source} = - run_changes("", [ - %{ - "text" => "document", - "range" => range_create(0, 0, 1, 0) - } - ]) - - assert "document" = text(source) - end - - test "incrementally removing content" do - hello_world = "function abc() {\n console.log(\"hello, world!\");\n}" - - assert {:ok, source} = - run_changes(hello_world, [ - %{ - "text" => "", - "range" => range_for_substring(hello_world, "hello, world!") - } - ]) - - assert "function abc() {\n console.log(\"\");\n}" = text(source) - end - - test "incrementally removing multi-line content" do - orig = "function abc() {\n foo();\n bar();\n \n}" - - assert {:ok, source} = - run_changes(orig, [ - %{ - "text" => "", - "range" => range_for_substring(orig, " foo();\n bar();\n") - } - ]) - - assert "function abc() {\n \n}" = text(source) - end - - test "incrementally removing multi-line content 2" do - orig = "function abc() {\n foo();\n bar();\n \n}" - - assert {:ok, source} = - run_changes(orig, [ - %{ - "text" => "", - "range" => range_for_substring(orig, "foo();\n bar();") - } - ]) - - assert "function abc() {\n \n \n}" == text(source) - end - - test "incrementally adding content" do - orig = "function abc() {\n console.log(\"hello\");\n}" - - assert {:ok, source} = - run_changes(orig, [ - %{ - "text" => ", world!", - "range" => range_after_substring(orig, "hello") - } - ]) - - assert "function abc() {\n console.log(\"hello, world!\");\n}" == text(source) - end - - test "incrementally adding multi-line content" do - orig = "function abc() {\n while (true) {\n foo();\n };\n}" - - assert {:ok, source} = - run_changes(orig, [ - %{ - "text" => "\n bar();", - "range" => range_after_substring(orig, "foo();") - } - ]) - - assert "function abc() {\n while (true) {\n foo();\n bar();\n };\n}" == text(source) - end - - test "incrementally replacing single-line content, more chars" do - orig = "function abc() {\n console.log(\"hello, world!\");\n}" - - assert {:ok, source} = - run_changes(orig, [ - %{ - "text" => "hello, test case!!!", - "range" => range_for_substring(orig, "hello, world!") - } - ]) - - assert "function abc() {\n console.log(\"hello, test case!!!\");\n}" == text(source) - end - - test "incrementally replacing single-line content, less chars" do - orig = "function abc() {\n console.log(\"hello, world!\");\n}" - - assert {:ok, source} = - run_changes(orig, [ - %{ - "text" => "hey", - "range" => range_for_substring(orig, "hello, world!") - } - ]) - - assert "function abc() {\n console.log(\"hey\");\n}" == text(source) - end - - test "incrementally replacing single-line content, same num of chars" do - orig = "function abc() {\n console.log(\"hello, world!\");\n}" - - assert {:ok, source} = - run_changes(orig, [ - %{ - "text" => "world, hello!", - "range" => range_for_substring(orig, "hello, world!") - } - ]) - - assert "function abc() {\n console.log(\"world, hello!\");\n}" == text(source) - end - - test "incrementally replacing multi-line content, more lines" do - orig = "function abc() {\n console.log(\"hello, world!\");\n}" - - assert {:ok, source} = - run_changes(orig, [ - %{ - "text" => "\n//hello\nfunction d(){", - "range" => range_for_substring(orig, "function abc() {") - } - ]) - - assert "\n//hello\nfunction d(){\n console.log(\"hello, world!\");\n}" == text(source) - end - - test "incrementally replacing multi-line content, fewer lines" do - orig = "a1\nb1\na2\nb2\na3\nb3\na4\nb4\n" - - assert {:ok, source} = - run_changes(orig, [ - %{ - "text" => "xx\nyy", - "range" => range_for_substring(orig, "\na3\nb3\na4\nb4\n") - } - ]) - - assert "a1\nb1\na2\nb2xx\nyy" == text(source) - end - - test "incrementally replacing multi-line content, same num of lines and chars" do - orig = "a1\nb1\na2\nb2\na3\nb3\na4\nb4\n" - - assert {:ok, source} = - run_changes(orig, [ - %{ - "text" => "\nxx1\nxx2", - "range" => range_for_substring(orig, "a2\nb2\na3") - } - ]) - - assert "a1\nb1\n\nxx1\nxx2\nb3\na4\nb4\n" = text(source) - end - - test "incrementally replacing multi-line content, same num of lines but diff chars" do - orig = "a1\nb1\na2\nb2\na3\nb3\na4\nb4\n" - - assert {:ok, source} = - run_changes(orig, [ - %{ - "text" => "\ny\n", - "range" => range_for_substring(orig, "a2\nb2\na3") - } - ]) - - assert "a1\nb1\n\ny\n\nb3\na4\nb4\n" == text(source) - end - - test "incrementally replacing multi-line content, huge number of lines" do - orig = "a1\ncc\nb1" - text = for _ <- 1..20000, into: "", do: "\ndd" - - assert {:ok, source} = - run_changes(orig, [ - %{ - "text" => text, - "range" => range_for_substring(orig, "\ncc") - } - ]) - - assert "a1" <> text <> "\nb1" == text(source) - end - - test "several incremental content changes" do - orig = "function abc() {\n console.log(\"hello, world!\");\n}" - - assert {:ok, source} = - run_changes(orig, [ - %{ - "text" => "defg", - "range" => range_create(0, 12, 0, 12) - }, - %{ - "text" => "hello, test case!!!", - "range" => range_create(1, 15, 1, 28) - }, - %{ - "text" => "hij", - "range" => range_create(0, 16, 0, 16) - } - ]) - - assert "function abcdefghij() {\n console.log(\"hello, test case!!!\");\n}" = text(source) - end - - test "basic append" do - orig = "foooo\nbar\nbaz" - - assert {:ok, source} = - run_changes(orig, [ - %{ - "text" => " some extra content", - "range" => range_create(1, 3, 1, 3) - } - ]) - - assert "foooo\nbar some extra content\nbaz" == text(source) - end - - test "multi-line append" do - orig = "foooo\nbar\nbaz" - - assert {:ok, source} = - run_changes(orig, [ - %{ - "text" => " some extra\ncontent", - "range" => range_create(1, 3, 1, 3) - } - ]) - - assert "foooo\nbar some extra\ncontent\nbaz" == text(source) - end - - test "basic delete" do - orig = "foooo\nbar\nbaz" - - assert {:ok, source} = - run_changes(orig, [ - %{ - "text" => "", - "range" => range_create(1, 0, 1, 3) - } - ]) - - assert "foooo\n\nbaz" = text(source) - end - - test "multi-line delete" do - orig = "foooo\nbar\nbaz" - - assert {:ok, source} = - run_changes(orig, [ - %{ - "text" => "", - "range" => range_create(0, 5, 1, 3) - } - ]) - - assert "foooo\nbaz" == text(source) - end - - test "single character replace" do - orig = "foooo\nbar\nbaz" - - assert {:ok, source} = - run_changes(orig, [ - %{ - "text" => "z", - "range" => range_create(1, 2, 1, 3) - } - ]) - - assert "foooo\nbaz\nbaz" == text(source) - end - - test "multi-character replace" do - orig = "foo\nbar" - - assert {:ok, source} = - run_changes(orig, [ - %{ - "text" => "foobar", - "range" => range_create(1, 0, 1, 3) - } - ]) - - assert "foo\nfoobar" == text(source) - end - - test "windows line endings are preserved in document" do - orig = "foooo\r\nbar\rbaz" - - assert {:ok, source} = - run_changes(orig, [ - %{ - "text" => "z", - "range" => range_create(1, 2, 1, 3) - } - ]) - - assert "foooo\r\nbaz\rbaz" == text(source) - end - - test "windows line endings are preserved in inserted text" do - orig = "foooo\nbar\nbaz" - - assert {:ok, source} = - run_changes(orig, [ - %{ - "text" => "z\r\nz\rz", - "range" => range_create(1, 2, 1, 3) - } - ]) - - assert "foooo\nbaz\r\nz\rz\nbaz" == text(source) - end - - test "utf8 glyphs are preserved in document" do - orig = "foooo\nb🏳️‍🌈r\nbaz" - - assert {:ok, source} = - run_changes(orig, [ - %{ - "text" => "z", - "range" => range_create(1, 7, 1, 8) - } - ]) - - assert "foooo\nb🏳️‍🌈z\nbaz" == text(source) - end - - test "utf8 glyphs are preserved in inserted text" do - orig = "foooo\nbar\nbaz" - - assert {:ok, source} = - run_changes(orig, [ - %{ - "text" => "z🏳️‍🌈z", - "range" => range_create(1, 2, 1, 3) - } - ]) - - assert "foooo\nbaz🏳️‍🌈z\nbaz" == text(source) - end - - test "works with a content change event" do - orig = """ - defmodule LanguageServer.Experimental.Server.Test do - def foo do - {"🎸", "other"} - end - end - """ - - event = - RangedContentChangeEvent.new( - text: "", - range: - Range.new( - start: Position.new(character: 0, line: 2), - end: Position.new(character: 22, line: 2) - ) - ) - - assert {:ok, source} = run_changes(orig, [event]) - assert {:ok, ""} = fetch_text_at(source, 3) - end - - test "deleting a line with a multi-byte character" do - orig = """ - defmodule LanguageServer.Experimental.Server.Test do - def foo do - {"🎸", "other"} - end - end - """ - - assert {:ok, source} = - run_changes(orig, [ - %{"text" => "", "range" => range_create(2, 0, 2, 19)} - ]) - - {:ok, line} = fetch_text_at(source, 3) - assert line == "" - end - - test "inserting a line with unicode" do - orig = """ - defmodule MyModule do - def func do - - end - end - """ - - assert {:ok, source} = - run_changes(orig, [ - %{"text" => " {\"🎸\", \"ok\"}", "range" => range_create(2, 0, 2, 0)}, - %{"text" => "", "range" => range_create(2, 11, 2, 13)} - ]) - - {:ok, line} = fetch_text_at(source, 3) - - assert line == " {\"🎸\", \"ok\"}" - end - - test "invalid update range - before the document starts -> before the document starts" do - orig = "foo\nbar" - invalid_range = range_create(-2, 0, -1, 3) - - assert {:error, {:invalid_range, ^invalid_range}} = - run_changes(orig, [ - %{ - "text" => "abc123", - "range" => range_create(-2, 0, -1, 3) - } - ]) - end - - test "invalid update range - before the document starts -> the middle of document" do - orig = "foo\nbar" - invalid_range = range_create(-1, 0, 0, 3) - - assert {:error, {:invalid_range, ^invalid_range}} = - run_changes(orig, [ - %{ - "text" => "foobar", - "range" => range_create(-1, 0, 0, 3) - } - ]) - end - - test "invalid update range - the middle of document -> after the document ends" do - orig = "foo\nbar" - - assert {:ok, source} = - run_changes(orig, [ - %{ - "text" => "foobar", - "range" => range_create(1, 0, 1, 10) - } - ]) - - assert "foo\nfoobar" == text(source) - end - - test "invalid update range - after the document ends -> after the document ends" do - orig = "foo\nbar" - - assert {:ok, source} = - run_changes(orig, [ - %{ - "text" => "abc123", - "range" => range_create(3, 0, 6, 10) - } - ]) - - assert "foo\nbarabc123" == text(source) - end - - test "invalid update range - before the document starts -> after the document ends" do - orig = "foo\nbar" - invalid_range = range_create(-1, 1, 2, 10000) - - assert {:error, {:invalid_range, ^invalid_range}} = - run_changes(orig, [ - %{ - "text" => "entirely new content", - "range" => invalid_range - } - ]) - end - end -end diff --git a/apps/language_server/test/support/experimental/code_mod/code_mod_case.ex b/apps/language_server/test/support/experimental/code_mod/code_mod_case.ex deleted file mode 100644 index dd1274573..000000000 --- a/apps/language_server/test/support/experimental/code_mod/code_mod_case.ex +++ /dev/null @@ -1,94 +0,0 @@ -defmodule ElixirLS.Test.CodeMod.Case do - alias LSP.Types.TextDocument.ContentChangeEvent.TextDocumentContentChangeEvent, - as: RangedContentChangeEvent - - alias ElixirLS.LanguageServer.Experimental.SourceFile - - use ExUnit.CaseTemplate - - using do - quote do - import unquote(__MODULE__), only: [sigil_q: 2] - - def apply_code_mod(_, _, _) do - {:error, "You must implement apply_code_mod/3"} - end - - defoverridable apply_code_mod: 3 - - def modify(original, options \\ []) do - with {:ok, ast} <- maybe_convert_to_ast(original, options), - {:ok, edits} <- apply_code_mod(original, ast, options) do - {:ok, unquote(__MODULE__).apply_edits(original, edits, options)} - end - end - - defp maybe_convert_to_ast(code, options) do - alias ElixirLS.LanguageServer.Experimental.CodeMod.Ast - - if Keyword.get(options, :convert_to_ast, true) do - Ast.from(code) - else - {:ok, nil} - end - end - end - end - - def sigil_q(text, opts \\ []) do - ["", first | rest] = text |> String.split("\n") - base_indent = indent(first) - indent_length = String.length(base_indent) - - Enum.map_join([first | rest], "\n", &strip_leading_indent(&1, indent_length)) - |> maybe_trim(opts) - end - - def apply_edits(original, text_edits, opts) do - source_file = SourceFile.new("file:///file.ex", original, 0) - - converted_edits = - Enum.map(text_edits, fn edit -> - RangedContentChangeEvent.new(text: edit.new_text, range: edit.range) - end) - - {:ok, edited_source_file} = SourceFile.apply_content_changes(source_file, 1, converted_edits) - edited_source = SourceFile.to_string(edited_source_file) - - if Keyword.get(opts, :trim, true) do - String.trim(edited_source) - else - edited_source - end - end - - defp maybe_trim(iodata, [?t]) do - iodata - |> IO.iodata_to_binary() - |> String.trim_trailing() - end - - defp maybe_trim(iodata, _) do - IO.iodata_to_binary(iodata) - end - - @indent_re ~r/^\s*/ - defp indent(first_line) do - case Regex.scan(@indent_re, first_line) do - [[indent]] -> indent - _ -> "" - end - end - - defp strip_leading_indent(s, 0) do - s - end - - defp strip_leading_indent(<<" ", rest::binary>>, count) when count > 0 do - strip_leading_indent(rest, count - 1) - end - - defp strip_leading_indent(s, _) do - s - end -end diff --git a/config/config.exs b/config/config.exs index ad4875cc7..2ef99c92e 100644 --- a/config/config.exs +++ b/config/config.exs @@ -24,6 +24,3 @@ env_bool = fn name -> enabled_str == "true" end - -config :language_server, - enable_experimental_server: env_bool.("ENABLE_EXPERIMENTAL_SERVER")