From d554f7c6e9f110fd88f0f5cf34679f04ad6e45d9 Mon Sep 17 00:00:00 2001 From: jansul Date: Thu, 31 Aug 2023 13:40:28 +0100 Subject: [PATCH] LSP: Fix `LSP::LocationLink`'s not being returned within an array (#629) --- .../definition/location_link/connect | 60 ++++++++-------- .../location_link/connect_variable_constant | 60 ++++++++-------- .../location_link/connect_variable_function | 60 ++++++++-------- .../location_link/connect_variable_get | 60 ++++++++-------- .../location_link/connect_variable_state | 60 ++++++++-------- .../location_link/enum_destructuring_name | 60 ++++++++-------- .../location_link/enum_destructuring_option | 60 ++++++++-------- .../definition/location_link/enum_id_name | 60 ++++++++-------- .../definition/location_link/enum_id_option | 60 ++++++++-------- .../definition/location_link/html_attribute | 60 ++++++++-------- .../definition/location_link/html_component | 60 ++++++++-------- .../definition/location_link/html_style | 60 ++++++++-------- .../module_access_component_constant | 60 ++++++++-------- .../module_access_component_function | 60 ++++++++-------- .../module_access_component_gets | 60 ++++++++-------- .../module_access_component_name | 60 ++++++++-------- .../module_access_component_state | 60 ++++++++-------- .../module_access_module_constant | 60 ++++++++-------- .../module_access_module_function | 60 ++++++++-------- .../location_link/module_access_module_name | 60 ++++++++-------- .../module_access_module_name_shared | 60 ++++++++-------- .../module_access_store_constant | 60 ++++++++-------- .../module_access_store_function | 60 ++++++++-------- .../location_link/module_access_store_gets | 60 ++++++++-------- .../location_link/module_access_store_name | 60 ++++++++-------- .../location_link/module_access_store_state | 60 ++++++++-------- .../definition/location_link/type_enum | 60 ++++++++-------- .../definition/location_link/type_record | 60 ++++++++-------- .../variable_block_statement_target | 60 ++++++++-------- .../variable_casebranch_enumdestructuring | 60 ++++++++-------- .../location_link/variable_component_connect | 60 ++++++++-------- .../variable_component_connect_as | 60 ++++++++-------- .../location_link/variable_component_constant | 60 ++++++++-------- .../location_link/variable_component_function | 60 ++++++++-------- .../location_link/variable_component_get | 60 ++++++++-------- .../location_link/variable_component_property | 60 ++++++++-------- .../location_link/variable_component_state | 60 ++++++++-------- .../definition/location_link/variable_for | 60 ++++++++-------- .../location_link/variable_for_subject | 60 ++++++++-------- .../location_link/variable_function_argument | 60 ++++++++-------- .../location_link/variable_module_constant | 60 ++++++++-------- .../location_link/variable_nextcall_component | 60 ++++++++-------- .../location_link/variable_nextcall_record | 60 ++++++++-------- .../location_link/variable_nextcall_store | 60 ++++++++-------- .../location_link/variable_nextcall_value | 60 ++++++++-------- .../location_link/variable_provider_constant | 60 ++++++++-------- .../location_link/variable_recordfield_key | 60 ++++++++-------- .../location_link/variable_recordfield_value | 60 ++++++++-------- .../location_link/variable_store_constant | 60 ++++++++-------- .../location_link/variable_store_function | 60 ++++++++-------- .../location_link/variable_store_get | 60 ++++++++-------- .../location_link/variable_store_state | 60 ++++++++-------- .../location_link/variable_suite_constant | 60 ++++++++-------- src/ls/definition.cr | 69 ++++++++++++------- src/ls/definition/connect.cr | 4 +- src/ls/definition/connect_variable.cr | 4 +- src/ls/definition/enum_destructuring.cr | 6 +- src/ls/definition/enum_id.cr | 8 +-- src/ls/definition/html_attribute.cr | 4 +- src/ls/definition/html_component.cr | 4 +- src/ls/definition/html_element.cr | 4 +- src/ls/definition/html_style.cr | 4 +- src/ls/definition/module_access.cr | 4 +- src/ls/definition/type.cr | 6 +- src/ls/definition/type_id.cr | 9 ++- src/ls/definition/variable.cr | 32 ++++----- 66 files changed, 1730 insertions(+), 1608 deletions(-) diff --git a/spec/language_server/definition/location_link/connect b/spec/language_server/definition/location_link/connect index c03daea65..c32fb04b3 100644 --- a/spec/language_server/definition/location_link/connect +++ b/spec/language_server/definition/location_link/connect @@ -42,39 +42,41 @@ component Test { -------------------------------------------------------------------------request { "jsonrpc": "2.0", - "result": { - "originSelectionRange": { - "start": { - "line": 1, - "character": 10 - }, - "end": { - "line": 1, - "character": 15 - } - }, - "targetUri": "file://#{root_path}/store.mint", - "targetRange": { - "start": { - "line": 0, - "character": 0 + "result": [ + { + "originSelectionRange": { + "start": { + "line": 1, + "character": 10 + }, + "end": { + "line": 1, + "character": 15 + } }, - "end": { - "line": 3, - "character": 1 - } - }, - "targetSelectionRange": { - "start": { - "line": 1, - "character": 6 + "targetUri": "file://#{root_path}/store.mint", + "targetRange": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 3, + "character": 1 + } }, - "end": { - "line": 1, - "character": 11 + "targetSelectionRange": { + "start": { + "line": 1, + "character": 6 + }, + "end": { + "line": 1, + "character": 11 + } } } - }, + ], "id": 1 } ------------------------------------------------------------------------response diff --git a/spec/language_server/definition/location_link/connect_variable_constant b/spec/language_server/definition/location_link/connect_variable_constant index 240e98db2..2c951b0fa 100644 --- a/spec/language_server/definition/location_link/connect_variable_constant +++ b/spec/language_server/definition/location_link/connect_variable_constant @@ -42,39 +42,41 @@ component Test { -------------------------------------------------------------------------request { "jsonrpc": "2.0", - "result": { - "originSelectionRange": { - "start": { - "line": 1, - "character": 27 - }, - "end": { - "line": 1, - "character": 35 - } - }, - "targetUri": "file://#{root_path}/store.mint", - "targetRange": { - "start": { - "line": 2, - "character": 2 + "result": [ + { + "originSelectionRange": { + "start": { + "line": 1, + "character": 27 + }, + "end": { + "line": 1, + "character": 35 + } }, - "end": { - "line": 2, - "character": 23 - } - }, - "targetSelectionRange": { - "start": { - "line": 2, - "character": 8 + "targetUri": "file://#{root_path}/store.mint", + "targetRange": { + "start": { + "line": 2, + "character": 2 + }, + "end": { + "line": 2, + "character": 23 + } }, - "end": { - "line": 2, - "character": 16 + "targetSelectionRange": { + "start": { + "line": 2, + "character": 8 + }, + "end": { + "line": 2, + "character": 16 + } } } - }, + ], "id": 1 } ------------------------------------------------------------------------response diff --git a/spec/language_server/definition/location_link/connect_variable_function b/spec/language_server/definition/location_link/connect_variable_function index c3f5c4102..b846d3511 100644 --- a/spec/language_server/definition/location_link/connect_variable_function +++ b/spec/language_server/definition/location_link/connect_variable_function @@ -44,39 +44,41 @@ component Test { -------------------------------------------------------------------------request { "jsonrpc": "2.0", - "result": { - "originSelectionRange": { - "start": { - "line": 1, - "character": 27 - }, - "end": { - "line": 1, - "character": 31 - } - }, - "targetUri": "file://#{root_path}/store.mint", - "targetRange": { - "start": { - "line": 2, - "character": 2 + "result": [ + { + "originSelectionRange": { + "start": { + "line": 1, + "character": 27 + }, + "end": { + "line": 1, + "character": 31 + } }, - "end": { - "line": 4, - "character": 3 - } - }, - "targetSelectionRange": { - "start": { - "line": 2, - "character": 6 + "targetUri": "file://#{root_path}/store.mint", + "targetRange": { + "start": { + "line": 2, + "character": 2 + }, + "end": { + "line": 4, + "character": 3 + } }, - "end": { - "line": 2, - "character": 10 + "targetSelectionRange": { + "start": { + "line": 2, + "character": 6 + }, + "end": { + "line": 2, + "character": 10 + } } } - }, + ], "id": 1 } ------------------------------------------------------------------------response diff --git a/spec/language_server/definition/location_link/connect_variable_get b/spec/language_server/definition/location_link/connect_variable_get index d5d90eb2b..f292778ef 100644 --- a/spec/language_server/definition/location_link/connect_variable_get +++ b/spec/language_server/definition/location_link/connect_variable_get @@ -44,39 +44,41 @@ component Test { -------------------------------------------------------------------------request { "jsonrpc": "2.0", - "result": { - "originSelectionRange": { - "start": { - "line": 1, - "character": 27 - }, - "end": { - "line": 1, - "character": 31 - } - }, - "targetUri": "file://#{root_path}/store.mint", - "targetRange": { - "start": { - "line": 2, - "character": 2 + "result": [ + { + "originSelectionRange": { + "start": { + "line": 1, + "character": 27 + }, + "end": { + "line": 1, + "character": 31 + } }, - "end": { - "line": 5, - "character": 0 - } - }, - "targetSelectionRange": { - "start": { - "line": 2, - "character": 6 + "targetUri": "file://#{root_path}/store.mint", + "targetRange": { + "start": { + "line": 2, + "character": 2 + }, + "end": { + "line": 5, + "character": 0 + } }, - "end": { - "line": 2, - "character": 10 + "targetSelectionRange": { + "start": { + "line": 2, + "character": 6 + }, + "end": { + "line": 2, + "character": 10 + } } } - }, + ], "id": 1 } ------------------------------------------------------------------------response diff --git a/spec/language_server/definition/location_link/connect_variable_state b/spec/language_server/definition/location_link/connect_variable_state index 25cd3ebb5..7316a195c 100644 --- a/spec/language_server/definition/location_link/connect_variable_state +++ b/spec/language_server/definition/location_link/connect_variable_state @@ -42,39 +42,41 @@ component Test { -------------------------------------------------------------------------request { "jsonrpc": "2.0", - "result": { - "originSelectionRange": { - "start": { - "line": 1, - "character": 27 - }, - "end": { - "line": 1, - "character": 35 - } - }, - "targetUri": "file://#{root_path}/store.mint", - "targetRange": { - "start": { - "line": 2, - "character": 2 + "result": [ + { + "originSelectionRange": { + "start": { + "line": 1, + "character": 27 + }, + "end": { + "line": 1, + "character": 35 + } }, - "end": { - "line": 2, - "character": 24 - } - }, - "targetSelectionRange": { - "start": { - "line": 2, - "character": 8 + "targetUri": "file://#{root_path}/store.mint", + "targetRange": { + "start": { + "line": 2, + "character": 2 + }, + "end": { + "line": 2, + "character": 24 + } }, - "end": { - "line": 2, - "character": 16 + "targetSelectionRange": { + "start": { + "line": 2, + "character": 8 + }, + "end": { + "line": 2, + "character": 16 + } } } - }, + ], "id": 1 } ------------------------------------------------------------------------response diff --git a/spec/language_server/definition/location_link/enum_destructuring_name b/spec/language_server/definition/location_link/enum_destructuring_name index f4bc5361f..694b47c1f 100644 --- a/spec/language_server/definition/location_link/enum_destructuring_name +++ b/spec/language_server/definition/location_link/enum_destructuring_name @@ -44,39 +44,41 @@ module Test { -------------------------------------------------------------------------request { "jsonrpc": "2.0", - "result": { - "originSelectionRange": { - "start": { - "line": 3, - "character": 6 - }, - "end": { - "line": 3, - "character": 12 - } - }, - "targetUri": "file://#{root_path}/status.mint", - "targetRange": { - "start": { - "line": 0, - "character": 0 + "result": [ + { + "originSelectionRange": { + "start": { + "line": 3, + "character": 6 + }, + "end": { + "line": 3, + "character": 12 + } }, - "end": { - "line": 4, - "character": 1 - } - }, - "targetSelectionRange": { - "start": { - "line": 1, - "character": 5 + "targetUri": "file://#{root_path}/status.mint", + "targetRange": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 4, + "character": 1 + } }, - "end": { - "line": 1, - "character": 11 + "targetSelectionRange": { + "start": { + "line": 1, + "character": 5 + }, + "end": { + "line": 1, + "character": 11 + } } } - }, + ], "id": 1 } ------------------------------------------------------------------------response diff --git a/spec/language_server/definition/location_link/enum_destructuring_option b/spec/language_server/definition/location_link/enum_destructuring_option index befd527ce..2ced2ee10 100644 --- a/spec/language_server/definition/location_link/enum_destructuring_option +++ b/spec/language_server/definition/location_link/enum_destructuring_option @@ -50,39 +50,41 @@ module Test { -------------------------------------------------------------------------request { "jsonrpc": "2.0", - "result": { - "originSelectionRange": { - "start": { - "line": 3, - "character": 14 - }, - "end": { - "line": 3, - "character": 19 - } - }, - "targetUri": "file://#{root_path}/status.mint", - "targetRange": { - "start": { - "line": 2, - "character": 2 + "result": [ + { + "originSelectionRange": { + "start": { + "line": 3, + "character": 14 + }, + "end": { + "line": 3, + "character": 19 + } }, - "end": { - "line": 3, - "character": 2 - } - }, - "targetSelectionRange": { - "start": { - "line": 2, - "character": 2 + "targetUri": "file://#{root_path}/status.mint", + "targetRange": { + "start": { + "line": 2, + "character": 2 + }, + "end": { + "line": 3, + "character": 2 + } }, - "end": { - "line": 2, - "character": 7 + "targetSelectionRange": { + "start": { + "line": 2, + "character": 2 + }, + "end": { + "line": 2, + "character": 7 + } } } - }, + ], "id": 1 } ------------------------------------------------------------------------response diff --git a/spec/language_server/definition/location_link/enum_id_name b/spec/language_server/definition/location_link/enum_id_name index 4cb87f01a..9a34fc737 100644 --- a/spec/language_server/definition/location_link/enum_id_name +++ b/spec/language_server/definition/location_link/enum_id_name @@ -43,39 +43,41 @@ component Test { -------------------------------------------------------------------------request { "jsonrpc": "2.0", - "result": { - "originSelectionRange": { - "start": { - "line": 1, - "character": 26 - }, - "end": { - "line": 1, - "character": 32 - } - }, - "targetUri": "file://#{root_path}/status.mint", - "targetRange": { - "start": { - "line": 0, - "character": 0 + "result": [ + { + "originSelectionRange": { + "start": { + "line": 1, + "character": 26 + }, + "end": { + "line": 1, + "character": 32 + } }, - "end": { - "line": 4, - "character": 1 - } - }, - "targetSelectionRange": { - "start": { - "line": 1, - "character": 5 + "targetUri": "file://#{root_path}/status.mint", + "targetRange": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 4, + "character": 1 + } }, - "end": { - "line": 1, - "character": 11 + "targetSelectionRange": { + "start": { + "line": 1, + "character": 5 + }, + "end": { + "line": 1, + "character": 11 + } } } - }, + ], "id": 1 } ------------------------------------------------------------------------response diff --git a/spec/language_server/definition/location_link/enum_id_option b/spec/language_server/definition/location_link/enum_id_option index 97f0e2bf0..4a27d0c48 100644 --- a/spec/language_server/definition/location_link/enum_id_option +++ b/spec/language_server/definition/location_link/enum_id_option @@ -48,39 +48,41 @@ component Test { -------------------------------------------------------------------------request { "jsonrpc": "2.0", - "result": { - "originSelectionRange": { - "start": { - "line": 1, - "character": 34 - }, - "end": { - "line": 1, - "character": 36 - } - }, - "targetUri": "file://#{root_path}/status.mint", - "targetRange": { - "start": { - "line": 2, - "character": 2 + "result": [ + { + "originSelectionRange": { + "start": { + "line": 1, + "character": 34 + }, + "end": { + "line": 1, + "character": 36 + } }, - "end": { - "line": 3, - "character": 0 - } - }, - "targetSelectionRange": { - "start": { - "line": 2, - "character": 2 + "targetUri": "file://#{root_path}/status.mint", + "targetRange": { + "start": { + "line": 2, + "character": 2 + }, + "end": { + "line": 3, + "character": 0 + } }, - "end": { - "line": 2, - "character": 4 + "targetSelectionRange": { + "start": { + "line": 2, + "character": 2 + }, + "end": { + "line": 2, + "character": 4 + } } } - }, + ], "id": 1 } ------------------------------------------------------------------------response diff --git a/spec/language_server/definition/location_link/html_attribute b/spec/language_server/definition/location_link/html_attribute index 4b680751a..cad9608e4 100644 --- a/spec/language_server/definition/location_link/html_attribute +++ b/spec/language_server/definition/location_link/html_attribute @@ -43,39 +43,41 @@ component Test { -------------------------------------------------------------------------request { "jsonrpc": "2.0", - "result": { - "originSelectionRange": { - "start": { - "line": 2, - "character": 12 - }, - "end": { - "line": 2, - "character": 16 - } - }, - "targetUri": "file://#{root_path}/button.mint", - "targetRange": { - "start": { - "line": 1, - "character": 2 + "result": [ + { + "originSelectionRange": { + "start": { + "line": 2, + "character": 12 + }, + "end": { + "line": 2, + "character": 16 + } }, - "end": { - "line": 1, - "character": 34 - } - }, - "targetSelectionRange": { - "start": { - "line": 1, - "character": 11 + "targetUri": "file://#{root_path}/button.mint", + "targetRange": { + "start": { + "line": 1, + "character": 2 + }, + "end": { + "line": 1, + "character": 34 + } }, - "end": { - "line": 1, - "character": 15 + "targetSelectionRange": { + "start": { + "line": 1, + "character": 11 + }, + "end": { + "line": 1, + "character": 15 + } } } - }, + ], "id": 1 } ------------------------------------------------------------------------response diff --git a/spec/language_server/definition/location_link/html_component b/spec/language_server/definition/location_link/html_component index 19448d36e..8796bf68e 100644 --- a/spec/language_server/definition/location_link/html_component +++ b/spec/language_server/definition/location_link/html_component @@ -42,39 +42,41 @@ component Test { -------------------------------------------------------------------------request { "jsonrpc": "2.0", - "result": { - "originSelectionRange": { - "start": { - "line": 2, - "character": 5 - }, - "end": { - "line": 2, - "character": 11 - } - }, - "targetUri": "file://#{root_path}/button.mint", - "targetRange": { - "start": { - "line": 0, - "character": 0 + "result": [ + { + "originSelectionRange": { + "start": { + "line": 2, + "character": 5 + }, + "end": { + "line": 2, + "character": 11 + } }, - "end": { - "line": 5, - "character": 1 - } - }, - "targetSelectionRange": { - "start": { - "line": 1, - "character": 10 + "targetUri": "file://#{root_path}/button.mint", + "targetRange": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 5, + "character": 1 + } }, - "end": { - "line": 1, - "character": 16 + "targetSelectionRange": { + "start": { + "line": 1, + "character": 10 + }, + "end": { + "line": 1, + "character": 16 + } } } - }, + ], "id": 1 } ------------------------------------------------------------------------response diff --git a/spec/language_server/definition/location_link/html_style b/spec/language_server/definition/location_link/html_style index 8dcf970e1..404cf20e1 100644 --- a/spec/language_server/definition/location_link/html_style +++ b/spec/language_server/definition/location_link/html_style @@ -39,39 +39,41 @@ component Test { -------------------------------------------------------------------------request { "jsonrpc": "2.0", - "result": { - "originSelectionRange": { - "start": { - "line": 6, - "character": 10 - }, - "end": { - "line": 6, - "character": 14 - } - }, - "targetUri": "file://#{root_path}/test.mint", - "targetRange": { - "start": { - "line": 1, - "character": 2 + "result": [ + { + "originSelectionRange": { + "start": { + "line": 6, + "character": 10 + }, + "end": { + "line": 6, + "character": 14 + } }, - "end": { - "line": 3, - "character": 3 - } - }, - "targetSelectionRange": { - "start": { - "line": 1, - "character": 8 + "targetUri": "file://#{root_path}/test.mint", + "targetRange": { + "start": { + "line": 1, + "character": 2 + }, + "end": { + "line": 3, + "character": 3 + } }, - "end": { - "line": 1, - "character": 12 + "targetSelectionRange": { + "start": { + "line": 1, + "character": 8 + }, + "end": { + "line": 1, + "character": 12 + } } } - }, + ], "id": 1 } ------------------------------------------------------------------------response diff --git a/spec/language_server/definition/location_link/module_access_component_constant b/spec/language_server/definition/location_link/module_access_component_constant index 01d5a2dda..7e0bb4a42 100644 --- a/spec/language_server/definition/location_link/module_access_component_constant +++ b/spec/language_server/definition/location_link/module_access_component_constant @@ -45,39 +45,41 @@ component Test { -------------------------------------------------------------------------request { "jsonrpc": "2.0", - "result": { - "originSelectionRange": { - "start": { - "line": 3, - "character": 16 - }, - "end": { - "line": 3, - "character": 21 - } - }, - "targetUri": "file://#{root_path}/header.mint", - "targetRange": { - "start": { - "line": 1, - "character": 2 + "result": [ + { + "originSelectionRange": { + "start": { + "line": 3, + "character": 16 + }, + "end": { + "line": 3, + "character": 21 + } }, - "end": { - "line": 1, - "character": 22 - } - }, - "targetSelectionRange": { - "start": { - "line": 1, - "character": 8 + "targetUri": "file://#{root_path}/header.mint", + "targetRange": { + "start": { + "line": 1, + "character": 2 + }, + "end": { + "line": 1, + "character": 22 + } }, - "end": { - "line": 1, - "character": 13 + "targetSelectionRange": { + "start": { + "line": 1, + "character": 8 + }, + "end": { + "line": 1, + "character": 13 + } } } - }, + ], "id": 1 } ------------------------------------------------------------------------response diff --git a/spec/language_server/definition/location_link/module_access_component_function b/spec/language_server/definition/location_link/module_access_component_function index 0b029b2aa..f2c44ddf3 100644 --- a/spec/language_server/definition/location_link/module_access_component_function +++ b/spec/language_server/definition/location_link/module_access_component_function @@ -43,39 +43,41 @@ component Test { -------------------------------------------------------------------------request { "jsonrpc": "2.0", - "result": { - "originSelectionRange": { - "start": { - "line": 3, - "character": 16 - }, - "end": { - "line": 3, - "character": 22 - } - }, - "targetUri": "file://#{root_path}/header.mint", - "targetRange": { - "start": { - "line": 1, - "character": 2 + "result": [ + { + "originSelectionRange": { + "start": { + "line": 3, + "character": 16 + }, + "end": { + "line": 3, + "character": 22 + } }, - "end": { - "line": 3, - "character": 3 - } - }, - "targetSelectionRange": { - "start": { - "line": 1, - "character": 6 + "targetUri": "file://#{root_path}/header.mint", + "targetRange": { + "start": { + "line": 1, + "character": 2 + }, + "end": { + "line": 3, + "character": 3 + } }, - "end": { - "line": 1, - "character": 12 + "targetSelectionRange": { + "start": { + "line": 1, + "character": 6 + }, + "end": { + "line": 1, + "character": 12 + } } } - }, + ], "id": 1 } ------------------------------------------------------------------------response diff --git a/spec/language_server/definition/location_link/module_access_component_gets b/spec/language_server/definition/location_link/module_access_component_gets index 2555b6ee1..3b827025b 100644 --- a/spec/language_server/definition/location_link/module_access_component_gets +++ b/spec/language_server/definition/location_link/module_access_component_gets @@ -47,39 +47,41 @@ component Test { -------------------------------------------------------------------------request { "jsonrpc": "2.0", - "result": { - "originSelectionRange": { - "start": { - "line": 3, - "character": 16 - }, - "end": { - "line": 3, - "character": 21 - } - }, - "targetUri": "file://#{root_path}/header.mint", - "targetRange": { - "start": { - "line": 1, - "character": 2 + "result": [ + { + "originSelectionRange": { + "start": { + "line": 3, + "character": 16 + }, + "end": { + "line": 3, + "character": 21 + } }, - "end": { - "line": 5, - "character": 2 - } - }, - "targetSelectionRange": { - "start": { - "line": 1, - "character": 6 + "targetUri": "file://#{root_path}/header.mint", + "targetRange": { + "start": { + "line": 1, + "character": 2 + }, + "end": { + "line": 5, + "character": 2 + } }, - "end": { - "line": 1, - "character": 11 + "targetSelectionRange": { + "start": { + "line": 1, + "character": 6 + }, + "end": { + "line": 1, + "character": 11 + } } } - }, + ], "id": 1 } ------------------------------------------------------------------------response diff --git a/spec/language_server/definition/location_link/module_access_component_name b/spec/language_server/definition/location_link/module_access_component_name index b669f0b49..b1c738c09 100644 --- a/spec/language_server/definition/location_link/module_access_component_name +++ b/spec/language_server/definition/location_link/module_access_component_name @@ -43,39 +43,41 @@ component Test { -------------------------------------------------------------------------request { "jsonrpc": "2.0", - "result": { - "originSelectionRange": { - "start": { - "line": 3, - "character": 9 - }, - "end": { - "line": 3, - "character": 15 - } - }, - "targetUri": "file://#{root_path}/header.mint", - "targetRange": { - "start": { - "line": 0, - "character": 0 + "result": [ + { + "originSelectionRange": { + "start": { + "line": 3, + "character": 9 + }, + "end": { + "line": 3, + "character": 15 + } }, - "end": { - "line": 4, - "character": 1 - } - }, - "targetSelectionRange": { - "start": { - "line": 0, - "character": 17 + "targetUri": "file://#{root_path}/header.mint", + "targetRange": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 4, + "character": 1 + } }, - "end": { - "line": 0, - "character": 23 + "targetSelectionRange": { + "start": { + "line": 0, + "character": 17 + }, + "end": { + "line": 0, + "character": 23 + } } } - }, + ], "id": 1 } ------------------------------------------------------------------------response diff --git a/spec/language_server/definition/location_link/module_access_component_state b/spec/language_server/definition/location_link/module_access_component_state index 1208ef692..6ada2760a 100644 --- a/spec/language_server/definition/location_link/module_access_component_state +++ b/spec/language_server/definition/location_link/module_access_component_state @@ -45,39 +45,41 @@ component Test { -------------------------------------------------------------------------request { "jsonrpc": "2.0", - "result": { - "originSelectionRange": { - "start": { - "line": 3, - "character": 16 - }, - "end": { - "line": 3, - "character": 21 - } - }, - "targetUri": "file://#{root_path}/header.mint", - "targetRange": { - "start": { - "line": 1, - "character": 2 + "result": [ + { + "originSelectionRange": { + "start": { + "line": 3, + "character": 16 + }, + "end": { + "line": 3, + "character": 21 + } }, - "end": { - "line": 1, - "character": 22 - } - }, - "targetSelectionRange": { - "start": { - "line": 1, - "character": 8 + "targetUri": "file://#{root_path}/header.mint", + "targetRange": { + "start": { + "line": 1, + "character": 2 + }, + "end": { + "line": 1, + "character": 22 + } }, - "end": { - "line": 1, - "character": 13 + "targetSelectionRange": { + "start": { + "line": 1, + "character": 8 + }, + "end": { + "line": 1, + "character": 13 + } } } - }, + ], "id": 1 } ------------------------------------------------------------------------response diff --git a/spec/language_server/definition/location_link/module_access_module_constant b/spec/language_server/definition/location_link/module_access_module_constant index 6896b0322..ac6a20c3e 100644 --- a/spec/language_server/definition/location_link/module_access_module_constant +++ b/spec/language_server/definition/location_link/module_access_module_constant @@ -41,39 +41,41 @@ component Test { -------------------------------------------------------------------------request { "jsonrpc": "2.0", - "result": { - "originSelectionRange": { - "start": { - "line": 3, - "character": 16 - }, - "end": { - "line": 3, - "character": 21 - } - }, - "targetUri": "file://#{root_path}/module.mint", - "targetRange": { - "start": { - "line": 1, - "character": 2 + "result": [ + { + "originSelectionRange": { + "start": { + "line": 3, + "character": 16 + }, + "end": { + "line": 3, + "character": 21 + } }, - "end": { - "line": 1, - "character": 22 - } - }, - "targetSelectionRange": { - "start": { - "line": 1, - "character": 8 + "targetUri": "file://#{root_path}/module.mint", + "targetRange": { + "start": { + "line": 1, + "character": 2 + }, + "end": { + "line": 1, + "character": 22 + } }, - "end": { - "line": 1, - "character": 13 + "targetSelectionRange": { + "start": { + "line": 1, + "character": 8 + }, + "end": { + "line": 1, + "character": 13 + } } } - }, + ], "id": 1 } ------------------------------------------------------------------------response diff --git a/spec/language_server/definition/location_link/module_access_module_function b/spec/language_server/definition/location_link/module_access_module_function index 5488f5465..460177780 100644 --- a/spec/language_server/definition/location_link/module_access_module_function +++ b/spec/language_server/definition/location_link/module_access_module_function @@ -43,39 +43,41 @@ component Test { -------------------------------------------------------------------------request { "jsonrpc": "2.0", - "result": { - "originSelectionRange": { - "start": { - "line": 3, - "character": 16 - }, - "end": { - "line": 3, - "character": 21 - } - }, - "targetUri": "file://#{root_path}/module.mint", - "targetRange": { - "start": { - "line": 1, - "character": 2 + "result": [ + { + "originSelectionRange": { + "start": { + "line": 3, + "character": 16 + }, + "end": { + "line": 3, + "character": 21 + } }, - "end": { - "line": 3, - "character": 3 - } - }, - "targetSelectionRange": { - "start": { - "line": 1, - "character": 6 + "targetUri": "file://#{root_path}/module.mint", + "targetRange": { + "start": { + "line": 1, + "character": 2 + }, + "end": { + "line": 3, + "character": 3 + } }, - "end": { - "line": 1, - "character": 11 + "targetSelectionRange": { + "start": { + "line": 1, + "character": 6 + }, + "end": { + "line": 1, + "character": 11 + } } } - }, + ], "id": 1 } ------------------------------------------------------------------------response diff --git a/spec/language_server/definition/location_link/module_access_module_name b/spec/language_server/definition/location_link/module_access_module_name index 8b86b1571..876b5cbff 100644 --- a/spec/language_server/definition/location_link/module_access_module_name +++ b/spec/language_server/definition/location_link/module_access_module_name @@ -43,39 +43,41 @@ component Test { -------------------------------------------------------------------------request { "jsonrpc": "2.0", - "result": { - "originSelectionRange": { - "start": { - "line": 3, - "character": 9 - }, - "end": { - "line": 3, - "character": 15 - } - }, - "targetUri": "file://#{root_path}/module.mint", - "targetRange": { - "start": { - "line": 0, - "character": 0 + "result": [ + { + "originSelectionRange": { + "start": { + "line": 3, + "character": 9 + }, + "end": { + "line": 3, + "character": 15 + } }, - "end": { - "line": 4, - "character": 1 - } - }, - "targetSelectionRange": { - "start": { - "line": 0, - "character": 7 + "targetUri": "file://#{root_path}/module.mint", + "targetRange": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 4, + "character": 1 + } }, - "end": { - "line": 0, - "character": 13 + "targetSelectionRange": { + "start": { + "line": 0, + "character": 7 + }, + "end": { + "line": 0, + "character": 13 + } } } - }, + ], "id": 1 } ------------------------------------------------------------------------response diff --git a/spec/language_server/definition/location_link/module_access_module_name_shared b/spec/language_server/definition/location_link/module_access_module_name_shared index 4288b0f55..b1a772439 100644 --- a/spec/language_server/definition/location_link/module_access_module_name_shared +++ b/spec/language_server/definition/location_link/module_access_module_name_shared @@ -50,39 +50,41 @@ component Test { -------------------------------------------------------------------------request { "jsonrpc": "2.0", - "result": { - "originSelectionRange": { - "start": { - "line": 3, - "character": 6 - }, - "end": { - "line": 3, - "character": 12 - } - }, - "targetUri": "file://#{root_path}/module.mint", - "targetRange": { - "start": { - "line": 0, - "character": 0 + "result": [ + { + "originSelectionRange": { + "start": { + "line": 3, + "character": 6 + }, + "end": { + "line": 3, + "character": 12 + } }, - "end": { - "line": 4, - "character": 1 - } - }, - "targetSelectionRange": { - "start": { - "line": 0, - "character": 7 + "targetUri": "file://#{root_path}/module.mint", + "targetRange": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 4, + "character": 1 + } }, - "end": { - "line": 0, - "character": 13 + "targetSelectionRange": { + "start": { + "line": 0, + "character": 7 + }, + "end": { + "line": 0, + "character": 13 + } } } - }, + ], "id": 1 } ------------------------------------------------------------------------response diff --git a/spec/language_server/definition/location_link/module_access_store_constant b/spec/language_server/definition/location_link/module_access_store_constant index 4fbb6fb7b..b0be3f73c 100644 --- a/spec/language_server/definition/location_link/module_access_store_constant +++ b/spec/language_server/definition/location_link/module_access_store_constant @@ -41,39 +41,41 @@ component Test { -------------------------------------------------------------------------request { "jsonrpc": "2.0", - "result": { - "originSelectionRange": { - "start": { - "line": 3, - "character": 16 - }, - "end": { - "line": 3, - "character": 21 - } - }, - "targetUri": "file://#{root_path}/store.mint", - "targetRange": { - "start": { - "line": 1, - "character": 2 + "result": [ + { + "originSelectionRange": { + "start": { + "line": 3, + "character": 16 + }, + "end": { + "line": 3, + "character": 21 + } }, - "end": { - "line": 1, - "character": 22 - } - }, - "targetSelectionRange": { - "start": { - "line": 1, - "character": 8 + "targetUri": "file://#{root_path}/store.mint", + "targetRange": { + "start": { + "line": 1, + "character": 2 + }, + "end": { + "line": 1, + "character": 22 + } }, - "end": { - "line": 1, - "character": 13 + "targetSelectionRange": { + "start": { + "line": 1, + "character": 8 + }, + "end": { + "line": 1, + "character": 13 + } } } - }, + ], "id": 1 } ------------------------------------------------------------------------response diff --git a/spec/language_server/definition/location_link/module_access_store_function b/spec/language_server/definition/location_link/module_access_store_function index 169011196..4a75b2732 100644 --- a/spec/language_server/definition/location_link/module_access_store_function +++ b/spec/language_server/definition/location_link/module_access_store_function @@ -43,39 +43,41 @@ component Test { -------------------------------------------------------------------------request { "jsonrpc": "2.0", - "result": { - "originSelectionRange": { - "start": { - "line": 3, - "character": 16 - }, - "end": { - "line": 3, - "character": 21 - } - }, - "targetUri": "file://#{root_path}/store.mint", - "targetRange": { - "start": { - "line": 1, - "character": 2 + "result": [ + { + "originSelectionRange": { + "start": { + "line": 3, + "character": 16 + }, + "end": { + "line": 3, + "character": 21 + } }, - "end": { - "line": 3, - "character": 3 - } - }, - "targetSelectionRange": { - "start": { - "line": 1, - "character": 6 + "targetUri": "file://#{root_path}/store.mint", + "targetRange": { + "start": { + "line": 1, + "character": 2 + }, + "end": { + "line": 3, + "character": 3 + } }, - "end": { - "line": 1, - "character": 11 + "targetSelectionRange": { + "start": { + "line": 1, + "character": 6 + }, + "end": { + "line": 1, + "character": 11 + } } } - }, + ], "id": 1 } ------------------------------------------------------------------------response diff --git a/spec/language_server/definition/location_link/module_access_store_gets b/spec/language_server/definition/location_link/module_access_store_gets index 15b5e99be..a1b18df36 100644 --- a/spec/language_server/definition/location_link/module_access_store_gets +++ b/spec/language_server/definition/location_link/module_access_store_gets @@ -43,39 +43,41 @@ component Test { -------------------------------------------------------------------------request { "jsonrpc": "2.0", - "result": { - "originSelectionRange": { - "start": { - "line": 3, - "character": 16 - }, - "end": { - "line": 3, - "character": 21 - } - }, - "targetUri": "file://#{root_path}/store.mint", - "targetRange": { - "start": { - "line": 1, - "character": 2 + "result": [ + { + "originSelectionRange": { + "start": { + "line": 3, + "character": 16 + }, + "end": { + "line": 3, + "character": 21 + } }, - "end": { - "line": 4, - "character": 0 - } - }, - "targetSelectionRange": { - "start": { - "line": 1, - "character": 6 + "targetUri": "file://#{root_path}/store.mint", + "targetRange": { + "start": { + "line": 1, + "character": 2 + }, + "end": { + "line": 4, + "character": 0 + } }, - "end": { - "line": 1, - "character": 11 + "targetSelectionRange": { + "start": { + "line": 1, + "character": 6 + }, + "end": { + "line": 1, + "character": 11 + } } } - }, + ], "id": 1 } ------------------------------------------------------------------------response diff --git a/spec/language_server/definition/location_link/module_access_store_name b/spec/language_server/definition/location_link/module_access_store_name index 96c9eb66e..78c2f4b68 100644 --- a/spec/language_server/definition/location_link/module_access_store_name +++ b/spec/language_server/definition/location_link/module_access_store_name @@ -43,39 +43,41 @@ component Test { -------------------------------------------------------------------------request { "jsonrpc": "2.0", - "result": { - "originSelectionRange": { - "start": { - "line": 3, - "character": 9 - }, - "end": { - "line": 3, - "character": 15 - } - }, - "targetUri": "file://#{root_path}/store.mint", - "targetRange": { - "start": { - "line": 0, - "character": 0 + "result": [ + { + "originSelectionRange": { + "start": { + "line": 3, + "character": 9 + }, + "end": { + "line": 3, + "character": 15 + } }, - "end": { - "line": 4, - "character": 1 - } - }, - "targetSelectionRange": { - "start": { - "line": 0, - "character": 6 + "targetUri": "file://#{root_path}/store.mint", + "targetRange": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 4, + "character": 1 + } }, - "end": { - "line": 0, - "character": 12 + "targetSelectionRange": { + "start": { + "line": 0, + "character": 6 + }, + "end": { + "line": 0, + "character": 12 + } } } - }, + ], "id": 1 } ------------------------------------------------------------------------response diff --git a/spec/language_server/definition/location_link/module_access_store_state b/spec/language_server/definition/location_link/module_access_store_state index b473d6795..4d9e4d2eb 100644 --- a/spec/language_server/definition/location_link/module_access_store_state +++ b/spec/language_server/definition/location_link/module_access_store_state @@ -41,39 +41,41 @@ component Test { -------------------------------------------------------------------------request { "jsonrpc": "2.0", - "result": { - "originSelectionRange": { - "start": { - "line": 3, - "character": 16 - }, - "end": { - "line": 3, - "character": 21 - } - }, - "targetUri": "file://#{root_path}/store.mint", - "targetRange": { - "start": { - "line": 1, - "character": 2 + "result": [ + { + "originSelectionRange": { + "start": { + "line": 3, + "character": 16 + }, + "end": { + "line": 3, + "character": 21 + } }, - "end": { - "line": 1, - "character": 22 - } - }, - "targetSelectionRange": { - "start": { - "line": 1, - "character": 8 + "targetUri": "file://#{root_path}/store.mint", + "targetRange": { + "start": { + "line": 1, + "character": 2 + }, + "end": { + "line": 1, + "character": 22 + } }, - "end": { - "line": 1, - "character": 13 + "targetSelectionRange": { + "start": { + "line": 1, + "character": 8 + }, + "end": { + "line": 1, + "character": 13 + } } } - }, + ], "id": 1 } ------------------------------------------------------------------------response diff --git a/spec/language_server/definition/location_link/type_enum b/spec/language_server/definition/location_link/type_enum index 2557b4ec8..d7c2d7913 100644 --- a/spec/language_server/definition/location_link/type_enum +++ b/spec/language_server/definition/location_link/type_enum @@ -40,39 +40,41 @@ module Status { -------------------------------------------------------------------------request { "jsonrpc": "2.0", - "result": { - "originSelectionRange": { - "start": { - "line": 1, - "character": 16 - }, - "end": { - "line": 1, - "character": 22 - } - }, - "targetUri": "file://#{root_path}/status.mint", - "targetRange": { - "start": { - "line": 0, - "character": 0 + "result": [ + { + "originSelectionRange": { + "start": { + "line": 1, + "character": 16 + }, + "end": { + "line": 1, + "character": 22 + } }, - "end": { - "line": 3, - "character": 1 - } - }, - "targetSelectionRange": { - "start": { - "line": 0, - "character": 5 + "targetUri": "file://#{root_path}/status.mint", + "targetRange": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 3, + "character": 1 + } }, - "end": { - "line": 0, - "character": 11 + "targetSelectionRange": { + "start": { + "line": 0, + "character": 5 + }, + "end": { + "line": 0, + "character": 11 + } } } - }, + ], "id": 1 } ------------------------------------------------------------------------response diff --git a/spec/language_server/definition/location_link/type_record b/spec/language_server/definition/location_link/type_record index 7f5540979..eb590b63f 100644 --- a/spec/language_server/definition/location_link/type_record +++ b/spec/language_server/definition/location_link/type_record @@ -45,39 +45,41 @@ module Article { -------------------------------------------------------------------------request { "jsonrpc": "2.0", - "result": { - "originSelectionRange": { - "start": { - "line": 1, - "character": 13 - }, - "end": { - "line": 1, - "character": 20 - } - }, - "targetUri": "file://#{root_path}/article.mint", - "targetRange": { - "start": { - "line": 0, - "character": 0 + "result": [ + { + "originSelectionRange": { + "start": { + "line": 1, + "character": 13 + }, + "end": { + "line": 1, + "character": 20 + } }, - "end": { - "line": 4, - "character": 1 - } - }, - "targetSelectionRange": { - "start": { - "line": 0, - "character": 7 + "targetUri": "file://#{root_path}/article.mint", + "targetRange": { + "start": { + "line": 0, + "character": 0 + }, + "end": { + "line": 4, + "character": 1 + } }, - "end": { - "line": 0, - "character": 14 + "targetSelectionRange": { + "start": { + "line": 0, + "character": 7 + }, + "end": { + "line": 0, + "character": 14 + } } } - }, + ], "id": 1 } ------------------------------------------------------------------------response diff --git a/spec/language_server/definition/location_link/variable_block_statement_target b/spec/language_server/definition/location_link/variable_block_statement_target index 07e7d96b5..6c853c207 100644 --- a/spec/language_server/definition/location_link/variable_block_statement_target +++ b/spec/language_server/definition/location_link/variable_block_statement_target @@ -37,39 +37,41 @@ module Test { -------------------------------------------------------------------------request { "jsonrpc": "2.0", - "result": { - "originSelectionRange": { - "start": { - "line": 5, - "character": 23 - }, - "end": { - "line": 5, - "character": 27 - } - }, - "targetUri": "file://#{root_path}/test.mint", - "targetRange": { - "start": { - "line": 2, - "character": 4 + "result": [ + { + "originSelectionRange": { + "start": { + "line": 5, + "character": 23 + }, + "end": { + "line": 5, + "character": 27 + } }, - "end": { - "line": 3, - "character": 12 - } - }, - "targetSelectionRange": { - "start": { - "line": 2, - "character": 8 + "targetUri": "file://#{root_path}/test.mint", + "targetRange": { + "start": { + "line": 2, + "character": 4 + }, + "end": { + "line": 3, + "character": 12 + } }, - "end": { - "line": 2, - "character": 12 + "targetSelectionRange": { + "start": { + "line": 2, + "character": 8 + }, + "end": { + "line": 2, + "character": 12 + } } } - }, + ], "id": 1 } ------------------------------------------------------------------------response diff --git a/spec/language_server/definition/location_link/variable_casebranch_enumdestructuring b/spec/language_server/definition/location_link/variable_casebranch_enumdestructuring index 4eba5aceb..6c7fd9298 100644 --- a/spec/language_server/definition/location_link/variable_casebranch_enumdestructuring +++ b/spec/language_server/definition/location_link/variable_casebranch_enumdestructuring @@ -43,39 +43,41 @@ module Test { -------------------------------------------------------------------------request { "jsonrpc": "2.0", - "result": { - "originSelectionRange": { - "start": { - "line": 8, - "character": 26 - }, - "end": { - "line": 8, - "character": 30 - } - }, - "targetUri": "file://#{root_path}/test.mint", - "targetRange": { - "start": { - "line": 8, - "character": 6 + "result": [ + { + "originSelectionRange": { + "start": { + "line": 8, + "character": 26 + }, + "end": { + "line": 8, + "character": 30 + } }, - "end": { - "line": 8, - "character": 22 - } - }, - "targetSelectionRange": { - "start": { - "line": 8, - "character": 17 + "targetUri": "file://#{root_path}/test.mint", + "targetRange": { + "start": { + "line": 8, + "character": 6 + }, + "end": { + "line": 8, + "character": 22 + } }, - "end": { - "line": 8, - "character": 21 + "targetSelectionRange": { + "start": { + "line": 8, + "character": 17 + }, + "end": { + "line": 8, + "character": 21 + } } } - }, + ], "id": 1 } ------------------------------------------------------------------------response diff --git a/spec/language_server/definition/location_link/variable_component_connect b/spec/language_server/definition/location_link/variable_component_connect index 1b2cef32f..b2c568230 100644 --- a/spec/language_server/definition/location_link/variable_component_connect +++ b/spec/language_server/definition/location_link/variable_component_connect @@ -42,39 +42,41 @@ store Theme { -------------------------------------------------------------------------request { "jsonrpc": "2.0", - "result": { - "originSelectionRange": { - "start": { - "line": 5, - "character": 9 - }, - "end": { - "line": 5, - "character": 16 - } - }, - "targetUri": "file://#{root_path}/test.mint", - "targetRange": { - "start": { - "line": 1, - "character": 2 + "result": [ + { + "originSelectionRange": { + "start": { + "line": 5, + "character": 9 + }, + "end": { + "line": 5, + "character": 16 + } }, - "end": { - "line": 1, - "character": 36 - } - }, - "targetSelectionRange": { - "start": { - "line": 1, - "character": 27 + "targetUri": "file://#{root_path}/test.mint", + "targetRange": { + "start": { + "line": 1, + "character": 2 + }, + "end": { + "line": 1, + "character": 36 + } }, - "end": { - "line": 1, - "character": 34 + "targetSelectionRange": { + "start": { + "line": 1, + "character": 27 + }, + "end": { + "line": 1, + "character": 34 + } } } - }, + ], "id": 1 } ------------------------------------------------------------------------response diff --git a/spec/language_server/definition/location_link/variable_component_connect_as b/spec/language_server/definition/location_link/variable_component_connect_as index 6effa0999..9b2b40057 100644 --- a/spec/language_server/definition/location_link/variable_component_connect_as +++ b/spec/language_server/definition/location_link/variable_component_connect_as @@ -42,39 +42,41 @@ store Theme { -------------------------------------------------------------------------request { "jsonrpc": "2.0", - "result": { - "originSelectionRange": { - "start": { - "line": 5, - "character": 9 - }, - "end": { - "line": 5, - "character": 21 - } - }, - "targetUri": "file://#{root_path}/test.mint", - "targetRange": { - "start": { - "line": 1, - "character": 2 + "result": [ + { + "originSelectionRange": { + "start": { + "line": 5, + "character": 9 + }, + "end": { + "line": 5, + "character": 21 + } }, - "end": { - "line": 1, - "character": 52 - } - }, - "targetSelectionRange": { - "start": { - "line": 1, - "character": 38 + "targetUri": "file://#{root_path}/test.mint", + "targetRange": { + "start": { + "line": 1, + "character": 2 + }, + "end": { + "line": 1, + "character": 52 + } }, - "end": { - "line": 1, - "character": 50 + "targetSelectionRange": { + "start": { + "line": 1, + "character": 38 + }, + "end": { + "line": 1, + "character": 50 + } } } - }, + ], "id": 1 } ------------------------------------------------------------------------response diff --git a/spec/language_server/definition/location_link/variable_component_constant b/spec/language_server/definition/location_link/variable_component_constant index 03022a727..615269a1e 100644 --- a/spec/language_server/definition/location_link/variable_component_constant +++ b/spec/language_server/definition/location_link/variable_component_constant @@ -39,39 +39,41 @@ component Test { -------------------------------------------------------------------------request { "jsonrpc": "2.0", - "result": { - "originSelectionRange": { - "start": { - "line": 5, - "character": 9 - }, - "end": { - "line": 5, - "character": 13 - } - }, - "targetUri": "file://#{root_path}/test.mint", - "targetRange": { - "start": { - "line": 1, - "character": 2 + "result": [ + { + "originSelectionRange": { + "start": { + "line": 5, + "character": 9 + }, + "end": { + "line": 5, + "character": 13 + } }, - "end": { - "line": 1, - "character": 21 - } - }, - "targetSelectionRange": { - "start": { - "line": 1, - "character": 8 + "targetUri": "file://#{root_path}/test.mint", + "targetRange": { + "start": { + "line": 1, + "character": 2 + }, + "end": { + "line": 1, + "character": 21 + } }, - "end": { - "line": 1, - "character": 12 + "targetSelectionRange": { + "start": { + "line": 1, + "character": 8 + }, + "end": { + "line": 1, + "character": 12 + } } } - }, + ], "id": 1 } ------------------------------------------------------------------------response diff --git a/spec/language_server/definition/location_link/variable_component_function b/spec/language_server/definition/location_link/variable_component_function index 00126bf09..614a2a0f5 100644 --- a/spec/language_server/definition/location_link/variable_component_function +++ b/spec/language_server/definition/location_link/variable_component_function @@ -41,39 +41,41 @@ component Test { -------------------------------------------------------------------------request { "jsonrpc": "2.0", - "result": { - "originSelectionRange": { - "start": { - "line": 7, - "character": 9 - }, - "end": { - "line": 7, - "character": 13 - } - }, - "targetUri": "file://#{root_path}/test.mint", - "targetRange": { - "start": { - "line": 1, - "character": 2 + "result": [ + { + "originSelectionRange": { + "start": { + "line": 7, + "character": 9 + }, + "end": { + "line": 7, + "character": 13 + } }, - "end": { - "line": 3, - "character": 3 - } - }, - "targetSelectionRange": { - "start": { - "line": 1, - "character": 6 + "targetUri": "file://#{root_path}/test.mint", + "targetRange": { + "start": { + "line": 1, + "character": 2 + }, + "end": { + "line": 3, + "character": 3 + } }, - "end": { - "line": 1, - "character": 10 + "targetSelectionRange": { + "start": { + "line": 1, + "character": 6 + }, + "end": { + "line": 1, + "character": 10 + } } } - }, + ], "id": 1 } ------------------------------------------------------------------------response diff --git a/spec/language_server/definition/location_link/variable_component_get b/spec/language_server/definition/location_link/variable_component_get index 1d5fcd4ca..2541d9838 100644 --- a/spec/language_server/definition/location_link/variable_component_get +++ b/spec/language_server/definition/location_link/variable_component_get @@ -41,39 +41,41 @@ component Test { -------------------------------------------------------------------------request { "jsonrpc": "2.0", - "result": { - "originSelectionRange": { - "start": { - "line": 7, - "character": 9 - }, - "end": { - "line": 7, - "character": 13 - } - }, - "targetUri": "file://#{root_path}/test.mint", - "targetRange": { - "start": { - "line": 1, - "character": 2 + "result": [ + { + "originSelectionRange": { + "start": { + "line": 7, + "character": 9 + }, + "end": { + "line": 7, + "character": 13 + } }, - "end": { - "line": 5, - "character": 2 - } - }, - "targetSelectionRange": { - "start": { - "line": 1, - "character": 6 + "targetUri": "file://#{root_path}/test.mint", + "targetRange": { + "start": { + "line": 1, + "character": 2 + }, + "end": { + "line": 5, + "character": 2 + } }, - "end": { - "line": 1, - "character": 10 + "targetSelectionRange": { + "start": { + "line": 1, + "character": 6 + }, + "end": { + "line": 1, + "character": 10 + } } } - }, + ], "id": 1 } ------------------------------------------------------------------------response diff --git a/spec/language_server/definition/location_link/variable_component_property b/spec/language_server/definition/location_link/variable_component_property index ce61b0357..6c500391e 100644 --- a/spec/language_server/definition/location_link/variable_component_property +++ b/spec/language_server/definition/location_link/variable_component_property @@ -39,39 +39,41 @@ component Test { -------------------------------------------------------------------------request { "jsonrpc": "2.0", - "result": { - "originSelectionRange": { - "start": { - "line": 5, - "character": 9 - }, - "end": { - "line": 5, - "character": 13 - } - }, - "targetUri": "file://#{root_path}/test.mint", - "targetRange": { - "start": { - "line": 1, - "character": 2 + "result": [ + { + "originSelectionRange": { + "start": { + "line": 5, + "character": 9 + }, + "end": { + "line": 5, + "character": 13 + } }, - "end": { - "line": 1, - "character": 33 - } - }, - "targetSelectionRange": { - "start": { - "line": 1, - "character": 11 + "targetUri": "file://#{root_path}/test.mint", + "targetRange": { + "start": { + "line": 1, + "character": 2 + }, + "end": { + "line": 1, + "character": 33 + } }, - "end": { - "line": 1, - "character": 15 + "targetSelectionRange": { + "start": { + "line": 1, + "character": 11 + }, + "end": { + "line": 1, + "character": 15 + } } } - }, + ], "id": 1 } ------------------------------------------------------------------------response diff --git a/spec/language_server/definition/location_link/variable_component_state b/spec/language_server/definition/location_link/variable_component_state index e8705f482..1b9fe77b9 100644 --- a/spec/language_server/definition/location_link/variable_component_state +++ b/spec/language_server/definition/location_link/variable_component_state @@ -39,39 +39,41 @@ component Test { -------------------------------------------------------------------------request { "jsonrpc": "2.0", - "result": { - "originSelectionRange": { - "start": { - "line": 5, - "character": 9 - }, - "end": { - "line": 5, - "character": 13 - } - }, - "targetUri": "file://#{root_path}/test.mint", - "targetRange": { - "start": { - "line": 1, - "character": 2 + "result": [ + { + "originSelectionRange": { + "start": { + "line": 5, + "character": 9 + }, + "end": { + "line": 5, + "character": 13 + } }, - "end": { - "line": 1, - "character": 30 - } - }, - "targetSelectionRange": { - "start": { - "line": 1, - "character": 8 + "targetUri": "file://#{root_path}/test.mint", + "targetRange": { + "start": { + "line": 1, + "character": 2 + }, + "end": { + "line": 1, + "character": 30 + } }, - "end": { - "line": 1, - "character": 12 + "targetSelectionRange": { + "start": { + "line": 1, + "character": 8 + }, + "end": { + "line": 1, + "character": 12 + } } } - }, + ], "id": 1 } ------------------------------------------------------------------------response diff --git a/spec/language_server/definition/location_link/variable_for b/spec/language_server/definition/location_link/variable_for index abd703d41..d2233ebe9 100644 --- a/spec/language_server/definition/location_link/variable_for +++ b/spec/language_server/definition/location_link/variable_for @@ -37,39 +37,41 @@ module Test { -------------------------------------------------------------------------request { "jsonrpc": "2.0", - "result": { - "originSelectionRange": { - "start": { - "line": 3, - "character": 25 - }, - "end": { - "line": 3, - "character": 30 - } - }, - "targetUri": "file://#{root_path}/test.mint", - "targetRange": { - "start": { - "line": 2, - "character": 4 + "result": [ + { + "originSelectionRange": { + "start": { + "line": 3, + "character": 25 + }, + "end": { + "line": 3, + "character": 30 + } }, - "end": { - "line": 5, - "character": 2 - } - }, - "targetSelectionRange": { - "start": { - "line": 2, - "character": 8 + "targetUri": "file://#{root_path}/test.mint", + "targetRange": { + "start": { + "line": 2, + "character": 4 + }, + "end": { + "line": 5, + "character": 2 + } }, - "end": { - "line": 2, - "character": 13 + "targetSelectionRange": { + "start": { + "line": 2, + "character": 8 + }, + "end": { + "line": 2, + "character": 13 + } } } - }, + ], "id": 1 } ------------------------------------------------------------------------response diff --git a/spec/language_server/definition/location_link/variable_for_subject b/spec/language_server/definition/location_link/variable_for_subject index 3c41c018e..28cd4e72d 100644 --- a/spec/language_server/definition/location_link/variable_for_subject +++ b/spec/language_server/definition/location_link/variable_for_subject @@ -37,39 +37,41 @@ module Test { -------------------------------------------------------------------------request { "jsonrpc": "2.0", - "result": { - "originSelectionRange": { - "start": { - "line": 2, - "character": 30 - }, - "end": { - "line": 2, - "character": 35 - } - }, - "targetUri": "file://#{root_path}/test.mint", - "targetRange": { - "start": { - "line": 1, - "character": 17 + "result": [ + { + "originSelectionRange": { + "start": { + "line": 2, + "character": 30 + }, + "end": { + "line": 2, + "character": 35 + } }, - "end": { - "line": 1, - "character": 31 - } - }, - "targetSelectionRange": { - "start": { - "line": 1, - "character": 17 + "targetUri": "file://#{root_path}/test.mint", + "targetRange": { + "start": { + "line": 1, + "character": 17 + }, + "end": { + "line": 1, + "character": 31 + } }, - "end": { - "line": 1, - "character": 22 + "targetSelectionRange": { + "start": { + "line": 1, + "character": 17 + }, + "end": { + "line": 1, + "character": 22 + } } } - }, + ], "id": 1 } ------------------------------------------------------------------------response diff --git a/spec/language_server/definition/location_link/variable_function_argument b/spec/language_server/definition/location_link/variable_function_argument index 78b9f72a3..398691e9f 100644 --- a/spec/language_server/definition/location_link/variable_function_argument +++ b/spec/language_server/definition/location_link/variable_function_argument @@ -35,39 +35,41 @@ module Test { -------------------------------------------------------------------------request { "jsonrpc": "2.0", - "result": { - "originSelectionRange": { - "start": { - "line": 2, - "character": 4 - }, - "end": { - "line": 2, - "character": 10 - } - }, - "targetUri": "file://#{root_path}/test.mint", - "targetRange": { - "start": { - "line": 1, - "character": 16 + "result": [ + { + "originSelectionRange": { + "start": { + "line": 2, + "character": 4 + }, + "end": { + "line": 2, + "character": 10 + } }, - "end": { - "line": 1, - "character": 31 - } - }, - "targetSelectionRange": { - "start": { - "line": 1, - "character": 16 + "targetUri": "file://#{root_path}/test.mint", + "targetRange": { + "start": { + "line": 1, + "character": 16 + }, + "end": { + "line": 1, + "character": 31 + } }, - "end": { - "line": 1, - "character": 22 + "targetSelectionRange": { + "start": { + "line": 1, + "character": 16 + }, + "end": { + "line": 1, + "character": 22 + } } } - }, + ], "id": 1 } ------------------------------------------------------------------------response diff --git a/spec/language_server/definition/location_link/variable_module_constant b/spec/language_server/definition/location_link/variable_module_constant index f9adb0c1b..efff8cad5 100644 --- a/spec/language_server/definition/location_link/variable_module_constant +++ b/spec/language_server/definition/location_link/variable_module_constant @@ -37,39 +37,41 @@ module Test { -------------------------------------------------------------------------request { "jsonrpc": "2.0", - "result": { - "originSelectionRange": { - "start": { - "line": 4, - "character": 4 - }, - "end": { - "line": 4, - "character": 9 - } - }, - "targetUri": "file://#{root_path}/test.mint", - "targetRange": { - "start": { - "line": 1, - "character": 2 + "result": [ + { + "originSelectionRange": { + "start": { + "line": 4, + "character": 4 + }, + "end": { + "line": 4, + "character": 9 + } }, - "end": { - "line": 1, - "character": 23 - } - }, - "targetSelectionRange": { - "start": { - "line": 1, - "character": 8 + "targetUri": "file://#{root_path}/test.mint", + "targetRange": { + "start": { + "line": 1, + "character": 2 + }, + "end": { + "line": 1, + "character": 23 + } }, - "end": { - "line": 1, - "character": 13 + "targetSelectionRange": { + "start": { + "line": 1, + "character": 8 + }, + "end": { + "line": 1, + "character": 13 + } } } - }, + ], "id": 1 } ------------------------------------------------------------------------response diff --git a/spec/language_server/definition/location_link/variable_nextcall_component b/spec/language_server/definition/location_link/variable_nextcall_component index 65bb1e6ff..511ce18fc 100644 --- a/spec/language_server/definition/location_link/variable_nextcall_component +++ b/spec/language_server/definition/location_link/variable_nextcall_component @@ -41,39 +41,41 @@ component Test { -------------------------------------------------------------------------request { "jsonrpc": "2.0", - "result": { - "originSelectionRange": { - "start": { - "line": 4, - "character": 11 - }, - "end": { - "line": 4, - "character": 15 - } - }, - "targetUri": "file://#{root_path}/test.mint", - "targetRange": { - "start": { - "line": 1, - "character": 2 + "result": [ + { + "originSelectionRange": { + "start": { + "line": 4, + "character": 11 + }, + "end": { + "line": 4, + "character": 15 + } }, - "end": { - "line": 1, - "character": 26 - } - }, - "targetSelectionRange": { - "start": { - "line": 1, - "character": 8 + "targetUri": "file://#{root_path}/test.mint", + "targetRange": { + "start": { + "line": 1, + "character": 2 + }, + "end": { + "line": 1, + "character": 26 + } }, - "end": { - "line": 1, - "character": 12 + "targetSelectionRange": { + "start": { + "line": 1, + "character": 8 + }, + "end": { + "line": 1, + "character": 12 + } } } - }, + ], "id": 1 } ------------------------------------------------------------------------response diff --git a/spec/language_server/definition/location_link/variable_nextcall_record b/spec/language_server/definition/location_link/variable_nextcall_record index b8a376929..334d0c98a 100644 --- a/spec/language_server/definition/location_link/variable_nextcall_record +++ b/spec/language_server/definition/location_link/variable_nextcall_record @@ -56,39 +56,41 @@ store Test { -------------------------------------------------------------------------request { "jsonrpc": "2.0", - "result": { - "originSelectionRange": { - "start": { - "line": 20, - "character": 12 - }, - "end": { - "line": 20, - "character": 23 - } - }, - "targetUri": "file://#{root_path}/test.mint", - "targetRange": { - "start": { - "line": 2, - "character": 2 + "result": [ + { + "originSelectionRange": { + "start": { + "line": 20, + "character": 12 + }, + "end": { + "line": 20, + "character": 23 + } }, - "end": { - "line": 2, - "character": 22 - } - }, - "targetSelectionRange": { - "start": { - "line": 2, - "character": 2 + "targetUri": "file://#{root_path}/test.mint", + "targetRange": { + "start": { + "line": 2, + "character": 2 + }, + "end": { + "line": 2, + "character": 22 + } }, - "end": { - "line": 2, - "character": 13 + "targetSelectionRange": { + "start": { + "line": 2, + "character": 2 + }, + "end": { + "line": 2, + "character": 13 + } } } - }, + ], "id": 1 } ------------------------------------------------------------------------response diff --git a/spec/language_server/definition/location_link/variable_nextcall_store b/spec/language_server/definition/location_link/variable_nextcall_store index 61de09f1c..93845f538 100644 --- a/spec/language_server/definition/location_link/variable_nextcall_store +++ b/spec/language_server/definition/location_link/variable_nextcall_store @@ -37,39 +37,41 @@ store Test { -------------------------------------------------------------------------request { "jsonrpc": "2.0", - "result": { - "originSelectionRange": { - "start": { - "line": 4, - "character": 11 - }, - "end": { - "line": 4, - "character": 15 - } - }, - "targetUri": "file://#{root_path}/test.mint", - "targetRange": { - "start": { - "line": 1, - "character": 2 + "result": [ + { + "originSelectionRange": { + "start": { + "line": 4, + "character": 11 + }, + "end": { + "line": 4, + "character": 15 + } }, - "end": { - "line": 1, - "character": 26 - } - }, - "targetSelectionRange": { - "start": { - "line": 1, - "character": 8 + "targetUri": "file://#{root_path}/test.mint", + "targetRange": { + "start": { + "line": 1, + "character": 2 + }, + "end": { + "line": 1, + "character": 26 + } }, - "end": { - "line": 1, - "character": 12 + "targetSelectionRange": { + "start": { + "line": 1, + "character": 8 + }, + "end": { + "line": 1, + "character": 12 + } } } - }, + ], "id": 1 } ------------------------------------------------------------------------response diff --git a/spec/language_server/definition/location_link/variable_nextcall_value b/spec/language_server/definition/location_link/variable_nextcall_value index bd00bd2e9..4a17bce8b 100644 --- a/spec/language_server/definition/location_link/variable_nextcall_value +++ b/spec/language_server/definition/location_link/variable_nextcall_value @@ -40,39 +40,41 @@ store Test { -------------------------------------------------------------------------request { "jsonrpc": "2.0", - "result": { - "originSelectionRange": { - "start": { - "line": 7, - "character": 17 - }, - "end": { - "line": 7, - "character": 24 - } - }, - "targetUri": "file://#{root_path}/test.mint", - "targetRange": { - "start": { - "line": 4, - "character": 4 + "result": [ + { + "originSelectionRange": { + "start": { + "line": 7, + "character": 17 + }, + "end": { + "line": 7, + "character": 24 + } }, - "end": { - "line": 5, - "character": 12 - } - }, - "targetSelectionRange": { - "start": { - "line": 4, - "character": 8 + "targetUri": "file://#{root_path}/test.mint", + "targetRange": { + "start": { + "line": 4, + "character": 4 + }, + "end": { + "line": 5, + "character": 12 + } }, - "end": { - "line": 4, - "character": 15 + "targetSelectionRange": { + "start": { + "line": 4, + "character": 8 + }, + "end": { + "line": 4, + "character": 15 + } } } - }, + ], "id": 1 } ------------------------------------------------------------------------response diff --git a/spec/language_server/definition/location_link/variable_provider_constant b/spec/language_server/definition/location_link/variable_provider_constant index 4f18c8a0a..d585dd65d 100644 --- a/spec/language_server/definition/location_link/variable_provider_constant +++ b/spec/language_server/definition/location_link/variable_provider_constant @@ -41,39 +41,41 @@ provider Provider : Subscription { -------------------------------------------------------------------------request { "jsonrpc": "2.0", - "result": { - "originSelectionRange": { - "start": { - "line": 8, - "character": 4 - }, - "end": { - "line": 8, - "character": 9 - } - }, - "targetUri": "file://#{root_path}/test.mint", - "targetRange": { - "start": { - "line": 5, - "character": 2 + "result": [ + { + "originSelectionRange": { + "start": { + "line": 8, + "character": 4 + }, + "end": { + "line": 8, + "character": 9 + } }, - "end": { - "line": 5, - "character": 23 - } - }, - "targetSelectionRange": { - "start": { - "line": 5, - "character": 8 + "targetUri": "file://#{root_path}/test.mint", + "targetRange": { + "start": { + "line": 5, + "character": 2 + }, + "end": { + "line": 5, + "character": 23 + } }, - "end": { - "line": 5, - "character": 13 + "targetSelectionRange": { + "start": { + "line": 5, + "character": 8 + }, + "end": { + "line": 5, + "character": 13 + } } } - }, + ], "id": 1 } ------------------------------------------------------------------------response diff --git a/spec/language_server/definition/location_link/variable_recordfield_key b/spec/language_server/definition/location_link/variable_recordfield_key index 5846bfacb..055d6ada5 100644 --- a/spec/language_server/definition/location_link/variable_recordfield_key +++ b/spec/language_server/definition/location_link/variable_recordfield_key @@ -45,39 +45,41 @@ module Test { -------------------------------------------------------------------------request { "jsonrpc": "2.0", - "result": { - "originSelectionRange": { - "start": { - "line": 9, - "character": 6 - }, - "end": { - "line": 9, - "character": 8 - } - }, - "targetUri": "file://#{root_path}/test.mint", - "targetRange": { - "start": { - "line": 1, - "character": 2 + "result": [ + { + "originSelectionRange": { + "start": { + "line": 9, + "character": 6 + }, + "end": { + "line": 9, + "character": 8 + } }, - "end": { - "line": 1, - "character": 13 - } - }, - "targetSelectionRange": { - "start": { - "line": 1, - "character": 2 + "targetUri": "file://#{root_path}/test.mint", + "targetRange": { + "start": { + "line": 1, + "character": 2 + }, + "end": { + "line": 1, + "character": 13 + } }, - "end": { - "line": 1, - "character": 4 + "targetSelectionRange": { + "start": { + "line": 1, + "character": 2 + }, + "end": { + "line": 1, + "character": 4 + } } } - }, + ], "id": 1 } ------------------------------------------------------------------------response diff --git a/spec/language_server/definition/location_link/variable_recordfield_value b/spec/language_server/definition/location_link/variable_recordfield_value index c80653428..a4ea37427 100644 --- a/spec/language_server/definition/location_link/variable_recordfield_value +++ b/spec/language_server/definition/location_link/variable_recordfield_value @@ -45,39 +45,41 @@ module Test { ------------------------------------------------------------------------request { "jsonrpc": "2.0", - "result": { - "originSelectionRange": { - "start": { - "line": 5, - "character": 13 - }, - "end": { - "line": 5, - "character": 18 - } - }, - "targetUri": "file://#{root_path}/test.mint", - "targetRange": { - "start": { - "line": 1, - "character": 19 + "result": [ + { + "originSelectionRange": { + "start": { + "line": 5, + "character": 13 + }, + "end": { + "line": 5, + "character": 18 + } }, - "end": { - "line": 1, - "character": 33 - } - }, - "targetSelectionRange": { - "start": { - "line": 1, - "character": 19 + "targetUri": "file://#{root_path}/test.mint", + "targetRange": { + "start": { + "line": 1, + "character": 19 + }, + "end": { + "line": 1, + "character": 33 + } }, - "end": { - "line": 1, - "character": 24 + "targetSelectionRange": { + "start": { + "line": 1, + "character": 19 + }, + "end": { + "line": 1, + "character": 24 + } } } - }, + ], "id": 1 } ------------------------------------------------------------------------response diff --git a/spec/language_server/definition/location_link/variable_store_constant b/spec/language_server/definition/location_link/variable_store_constant index 30d3dd4f7..2d8a6cf55 100644 --- a/spec/language_server/definition/location_link/variable_store_constant +++ b/spec/language_server/definition/location_link/variable_store_constant @@ -37,39 +37,41 @@ store Test { -------------------------------------------------------------------------request { "jsonrpc": "2.0", - "result": { - "originSelectionRange": { - "start": { - "line": 4, - "character": 4 - }, - "end": { - "line": 4, - "character": 9 - } - }, - "targetUri": "file://#{root_path}/test.mint", - "targetRange": { - "start": { - "line": 1, - "character": 2 + "result": [ + { + "originSelectionRange": { + "start": { + "line": 4, + "character": 4 + }, + "end": { + "line": 4, + "character": 9 + } }, - "end": { - "line": 1, - "character": 23 - } - }, - "targetSelectionRange": { - "start": { - "line": 1, - "character": 8 + "targetUri": "file://#{root_path}/test.mint", + "targetRange": { + "start": { + "line": 1, + "character": 2 + }, + "end": { + "line": 1, + "character": 23 + } }, - "end": { - "line": 1, - "character": 13 + "targetSelectionRange": { + "start": { + "line": 1, + "character": 8 + }, + "end": { + "line": 1, + "character": 13 + } } } - }, + ], "id": 1 } ------------------------------------------------------------------------response diff --git a/spec/language_server/definition/location_link/variable_store_function b/spec/language_server/definition/location_link/variable_store_function index fa4c95c04..40366e3c8 100644 --- a/spec/language_server/definition/location_link/variable_store_function +++ b/spec/language_server/definition/location_link/variable_store_function @@ -39,39 +39,41 @@ store Test { -------------------------------------------------------------------------request { "jsonrpc": "2.0", - "result": { - "originSelectionRange": { - "start": { - "line": 6, - "character": 10 - }, - "end": { - "line": 6, - "character": 14 - } - }, - "targetUri": "file://#{root_path}/test.mint", - "targetRange": { - "start": { - "line": 1, - "character": 2 + "result": [ + { + "originSelectionRange": { + "start": { + "line": 6, + "character": 10 + }, + "end": { + "line": 6, + "character": 14 + } }, - "end": { - "line": 3, - "character": 3 - } - }, - "targetSelectionRange": { - "start": { - "line": 1, - "character": 6 + "targetUri": "file://#{root_path}/test.mint", + "targetRange": { + "start": { + "line": 1, + "character": 2 + }, + "end": { + "line": 3, + "character": 3 + } }, - "end": { - "line": 1, - "character": 10 + "targetSelectionRange": { + "start": { + "line": 1, + "character": 6 + }, + "end": { + "line": 1, + "character": 10 + } } } - }, + ], "id": 1 } ------------------------------------------------------------------------response diff --git a/spec/language_server/definition/location_link/variable_store_get b/spec/language_server/definition/location_link/variable_store_get index 853222a93..070091f95 100644 --- a/spec/language_server/definition/location_link/variable_store_get +++ b/spec/language_server/definition/location_link/variable_store_get @@ -43,39 +43,41 @@ store Test { -------------------------------------------------------------------------request { "jsonrpc": "2.0", - "result": { - "originSelectionRange": { - "start": { - "line": 10, - "character": 15 - }, - "end": { - "line": 10, - "character": 26 - } - }, - "targetUri": "file://#{root_path}/test.mint", - "targetRange": { - "start": { - "line": 1, - "character": 2 + "result": [ + { + "originSelectionRange": { + "start": { + "line": 10, + "character": 15 + }, + "end": { + "line": 10, + "character": 26 + } }, - "end": { - "line": 5, - "character": 2 - } - }, - "targetSelectionRange": { - "start": { - "line": 1, - "character": 6 + "targetUri": "file://#{root_path}/test.mint", + "targetRange": { + "start": { + "line": 1, + "character": 2 + }, + "end": { + "line": 5, + "character": 2 + } }, - "end": { - "line": 1, - "character": 17 + "targetSelectionRange": { + "start": { + "line": 1, + "character": 6 + }, + "end": { + "line": 1, + "character": 17 + } } } - }, + ], "id": 1 } ------------------------------------------------------------------------response diff --git a/spec/language_server/definition/location_link/variable_store_state b/spec/language_server/definition/location_link/variable_store_state index 9c05f619f..2275d1d43 100644 --- a/spec/language_server/definition/location_link/variable_store_state +++ b/spec/language_server/definition/location_link/variable_store_state @@ -41,39 +41,41 @@ store Test { -------------------------------------------------------------------------request { "jsonrpc": "2.0", - "result": { - "originSelectionRange": { - "start": { - "line": 8, - "character": 15 - }, - "end": { - "line": 8, - "character": 20 - } - }, - "targetUri": "file://#{root_path}/test.mint", - "targetRange": { - "start": { - "line": 1, - "character": 2 + "result": [ + { + "originSelectionRange": { + "start": { + "line": 8, + "character": 15 + }, + "end": { + "line": 8, + "character": 20 + } }, - "end": { - "line": 1, - "character": 32 - } - }, - "targetSelectionRange": { - "start": { - "line": 1, - "character": 8 + "targetUri": "file://#{root_path}/test.mint", + "targetRange": { + "start": { + "line": 1, + "character": 2 + }, + "end": { + "line": 1, + "character": 32 + } }, - "end": { - "line": 1, - "character": 13 + "targetSelectionRange": { + "start": { + "line": 1, + "character": 8 + }, + "end": { + "line": 1, + "character": 13 + } } } - }, + ], "id": 1 } ------------------------------------------------------------------------response diff --git a/spec/language_server/definition/location_link/variable_suite_constant b/spec/language_server/definition/location_link/variable_suite_constant index cdc6aa815..9205a3028 100644 --- a/spec/language_server/definition/location_link/variable_suite_constant +++ b/spec/language_server/definition/location_link/variable_suite_constant @@ -37,39 +37,41 @@ suite "Test" { -------------------------------------------------------------------------request { "jsonrpc": "2.0", - "result": { - "originSelectionRange": { - "start": { - "line": 4, - "character": 4 - }, - "end": { - "line": 4, - "character": 9 - } - }, - "targetUri": "file://#{root_path}/test.mint", - "targetRange": { - "start": { - "line": 1, - "character": 2 + "result": [ + { + "originSelectionRange": { + "start": { + "line": 4, + "character": 4 + }, + "end": { + "line": 4, + "character": 9 + } }, - "end": { - "line": 1, - "character": 23 - } - }, - "targetSelectionRange": { - "start": { - "line": 1, - "character": 8 + "targetUri": "file://#{root_path}/test.mint", + "targetRange": { + "start": { + "line": 1, + "character": 2 + }, + "end": { + "line": 1, + "character": 23 + } }, - "end": { - "line": 1, - "character": 13 + "targetSelectionRange": { + "start": { + "line": 1, + "character": 8 + }, + "end": { + "line": 1, + "character": 13 + } } } - }, + ], "id": 1 } ------------------------------------------------------------------------response diff --git a/src/ls/definition.cr b/src/ls/definition.cr index 62422806a..301977b34 100644 --- a/src/ls/definition.cr +++ b/src/ls/definition.cr @@ -4,7 +4,7 @@ module Mint class Definition < LSP::RequestMessage property params : LSP::TextDocumentPositionParams - def execute(server) : Array(LSP::LocationLink | LSP::Location) | LSP::LocationLink | LSP::Location | Nil + def execute(server) : Array(LSP::LocationLink) | Array(LSP::Location) | LSP::Location | Nil uri = URI.parse(params.text_document.uri) @@ -15,13 +15,35 @@ module Mint stack = server.nodes_at_cursor(params) - if node = stack[0]? - definition(node, server, workspace, stack) + return unless node = stack[0]? + + has_link_support = + server + .params + .try(&.capabilities.text_document) + .try(&.definition) + .try(&.link_support) || false + + links = definition(node, workspace, stack) + + case links + when Array(LSP::LocationLink) + # Return a singular `LSP::Location` if possible + return to_lsp_location(links.first) if !has_link_support && links.size == 1 + + return links.map { |link| to_lsp_location(link) } if !has_link_support + + # Prefer nil rather than an empty array + links unless links.empty? + when LSP::LocationLink + return to_lsp_location(links) if !has_link_support + + [links] end end end - def definition(node : Ast::Node, server : Server, workspace : Workspace, stack : Array(Ast::Node)) + def definition(node : Ast::Node, workspace : Workspace, stack : Array(Ast::Node)) nil end @@ -44,10 +66,6 @@ module Mint workspace.ast.components.find(&.name.value.== name) end - def has_link_support?(server : Server) - !!(server.params.try &.capabilities.try &.text_document.try &.definition.try &.link_support) - end - def to_lsp_range(location : Ast::Node::Location) : LSP::Range LSP::Range.new( start: LSP::Position.new( @@ -61,26 +79,25 @@ module Mint ) end + def to_lsp_location(location_link : LSP::LocationLink) : LSP::Location + LSP::Location.new( + range: location_link.target_selection_range, + uri: location_link.target_uri, + ) + end + # Returns a `LSP::LocationLink` that links from *source* to the *target* node - # if the language server client has link support, otherwise it returns `LSP::Location`. # - # When returning a `LSP::LocationLink`, *parent* is used to provide the full range - # for the *target* node. For example, for a function, *target* would be the function name, - # and *parent* would be the whole node, including function body and any comments - def location_link(server : Server, source : Ast::Node, target : Ast::Node, parent : Ast::Node) : LSP::LocationLink | LSP::Location - if has_link_support?(server) - LSP::LocationLink.new( - origin_selection_range: to_lsp_range(source.location), - target_uri: "file://#{target.location.filename}", - target_range: to_lsp_range(parent.location), - target_selection_range: to_lsp_range(target.location) - ) - else - LSP::Location.new( - range: to_lsp_range(target.location), - uri: "file://#{target.location.filename}", - ) - end + # The *parent* node is used to provide the full range for the *target* node. + # For example, for a function, *target* would be the function name, and *parent* + # would be the whole node, including function body and any comments + def location_link(source : Ast::Node, target : Ast::Node, parent : Ast::Node) : LSP::LocationLink + LSP::LocationLink.new( + origin_selection_range: to_lsp_range(source.location), + target_uri: "file://#{target.location.filename}", + target_range: to_lsp_range(parent.location), + target_selection_range: to_lsp_range(target.location) + ) end end end diff --git a/src/ls/definition/connect.cr b/src/ls/definition/connect.cr index d8f659d2e..23df69be4 100644 --- a/src/ls/definition/connect.cr +++ b/src/ls/definition/connect.cr @@ -1,13 +1,13 @@ module Mint module LS class Definition < LSP::RequestMessage - def definition(node : Ast::Connect, server : Server, workspace : Workspace, stack : Array(Ast::Node)) + def definition(node : Ast::Connect, workspace : Workspace, stack : Array(Ast::Node)) return unless cursor_intersects?(node.store) return unless store = workspace.ast.stores.find(&.name.value.==(node.store.value)) - location_link server, node.store, store.name, store + location_link node.store, store.name, store end end end diff --git a/src/ls/definition/connect_variable.cr b/src/ls/definition/connect_variable.cr index 87da6e539..db055da69 100644 --- a/src/ls/definition/connect_variable.cr +++ b/src/ls/definition/connect_variable.cr @@ -1,7 +1,7 @@ module Mint module LS class Definition < LSP::RequestMessage - def definition(node : Ast::ConnectVariable, server : Server, workspace : Workspace, stack : Array(Ast::Node)) + def definition(node : Ast::ConnectVariable, workspace : Workspace, stack : Array(Ast::Node)) return unless cursor_intersects?(node.variable) return unless connect = stack[1]?.as?(Ast::Connect) @@ -16,7 +16,7 @@ module Mint case target when Ast::Function, Ast::State, Ast::Get, Ast::Constant - location_link server, node.variable, target.name, target + location_link node.variable, target.name, target end end end diff --git a/src/ls/definition/enum_destructuring.cr b/src/ls/definition/enum_destructuring.cr index c1668b3b2..2ec266064 100644 --- a/src/ls/definition/enum_destructuring.cr +++ b/src/ls/definition/enum_destructuring.cr @@ -1,7 +1,7 @@ module Mint module LS class Definition < LSP::RequestMessage - def definition(node : Ast::EnumDestructuring, server : Server, workspace : Workspace, stack : Array(Ast::Node)) + def definition(node : Ast::EnumDestructuring, workspace : Workspace, stack : Array(Ast::Node)) return unless name = node.name return unless enum_node = workspace.ast.enums.find(&.name.value.==(name.value)) @@ -10,12 +10,12 @@ module Mint case when cursor_intersects?(name) - location_link server, name, enum_node.name, enum_node + location_link name, enum_node.name, enum_node when cursor_intersects?(node.option) return unless option = enum_node.try &.options.find(&.value.value.==(node.option.value)) - location_link server, node.option, option.value, option + location_link node.option, option.value, option end end end diff --git a/src/ls/definition/enum_id.cr b/src/ls/definition/enum_id.cr index 0b4c91b91..7396c2caa 100644 --- a/src/ls/definition/enum_id.cr +++ b/src/ls/definition/enum_id.cr @@ -1,7 +1,7 @@ module Mint module LS class Definition < LSP::RequestMessage - def definition(node : Ast::EnumId, server : Server, workspace : Workspace, stack : Array(Ast::Node)) + def definition(node : Ast::EnumId, workspace : Workspace, stack : Array(Ast::Node)) name = node.name # When `.name` is nil the node is used as a CONSTANT @@ -15,7 +15,7 @@ module Mint Ast::Provider parent.constants.each do |constant| if node.option.value == constant.name.value - return location_link server, node.option, constant.name, constant + return location_link node.option, constant.name, constant end end end @@ -28,12 +28,12 @@ module Mint case when cursor_intersects?(name) - location_link server, name, enum_node.name, enum_node + location_link name, enum_node.name, enum_node when cursor_intersects?(node.option) return unless option = enum_node.try &.options.find(&.value.value.==(node.option.value)) - location_link server, node.option, option.value, option + location_link node.option, option.value, option end end end diff --git a/src/ls/definition/html_attribute.cr b/src/ls/definition/html_attribute.cr index 8421671ec..7275a1e81 100644 --- a/src/ls/definition/html_attribute.cr +++ b/src/ls/definition/html_attribute.cr @@ -1,7 +1,7 @@ module Mint module LS class Definition < LSP::RequestMessage - def definition(node : Ast::HtmlAttribute, server : Server, workspace : Workspace, stack : Array(Ast::Node)) + def definition(node : Ast::HtmlAttribute, workspace : Workspace, stack : Array(Ast::Node)) return unless cursor_intersects?(node.name) return unless html_component = stack.find(&.is_a?(Ast::HtmlComponent)).as?(Ast::HtmlComponent) @@ -12,7 +12,7 @@ module Mint return unless component_property = component.properties.find(&.name.value.== node.name.value) - location_link server, node.name, component_property.name, component_property + location_link node.name, component_property.name, component_property end end end diff --git a/src/ls/definition/html_component.cr b/src/ls/definition/html_component.cr index f2e4956f8..63a61d75a 100644 --- a/src/ls/definition/html_component.cr +++ b/src/ls/definition/html_component.cr @@ -1,13 +1,13 @@ module Mint module LS class Definition < LSP::RequestMessage - def definition(node : Ast::HtmlComponent, server : Server, workspace : Workspace, stack : Array(Ast::Node)) + def definition(node : Ast::HtmlComponent, workspace : Workspace, stack : Array(Ast::Node)) return unless cursor_intersects?(node.component) return unless component = find_component(workspace, node.component.value) - location_link server, node.component, component.name, component + location_link node.component, component.name, component end end end diff --git a/src/ls/definition/html_element.cr b/src/ls/definition/html_element.cr index cf2b1e671..aa43a0c5a 100644 --- a/src/ls/definition/html_element.cr +++ b/src/ls/definition/html_element.cr @@ -1,11 +1,11 @@ module Mint module LS class Definition < LSP::RequestMessage - def definition(node : Ast::HtmlElement, server : Server, workspace : Workspace, stack : Array(Ast::Node)) + def definition(node : Ast::HtmlElement, workspace : Workspace, stack : Array(Ast::Node)) node.styles.each do |style| next unless cursor_intersects?(style) - return definition(style, server, workspace, stack) + return definition(style, workspace, stack) end end end diff --git a/src/ls/definition/html_style.cr b/src/ls/definition/html_style.cr index c837af679..2e62b9667 100644 --- a/src/ls/definition/html_style.cr +++ b/src/ls/definition/html_style.cr @@ -1,7 +1,7 @@ module Mint module LS class Definition < LSP::RequestMessage - def definition(node : Ast::HtmlStyle, server : Server, workspace : Workspace, stack : Array(Ast::Node)) + def definition(node : Ast::HtmlStyle, workspace : Workspace, stack : Array(Ast::Node)) return unless cursor_intersects?(node.name) return unless component = stack.find(&.is_a?(Ast::Component)).as?(Ast::Component) @@ -9,7 +9,7 @@ module Mint return unless component_style = component.styles.find(&.name.value.== node.name.value) - location_link server, node.name, component_style.name, component_style + location_link node.name, component_style.name, component_style end end end diff --git a/src/ls/definition/module_access.cr b/src/ls/definition/module_access.cr index 6a67c510d..e4314ccdd 100644 --- a/src/ls/definition/module_access.cr +++ b/src/ls/definition/module_access.cr @@ -1,7 +1,7 @@ module Mint module LS class Definition < LSP::RequestMessage - def definition(node : Ast::ModuleAccess, server : Server, workspace : Workspace, stack : Array(Ast::Node)) + def definition(node : Ast::ModuleAccess, workspace : Workspace, stack : Array(Ast::Node)) lookup = workspace.type_checker.lookups[node.variable]? if lookup @@ -11,7 +11,7 @@ module Mint Ast::Function, Ast::State, Ast::Get - location_link server, node.variable, lookup.name, lookup + location_link node.variable, lookup.name, lookup end end end diff --git a/src/ls/definition/type.cr b/src/ls/definition/type.cr index dc6d3fa39..321c95d3f 100644 --- a/src/ls/definition/type.cr +++ b/src/ls/definition/type.cr @@ -1,7 +1,7 @@ module Mint module LS class Definition < LSP::RequestMessage - def definition(node : Ast::Type, server : Server, workspace : Workspace, stack : Array(Ast::Node)) + def definition(node : Ast::Type, workspace : Workspace, stack : Array(Ast::Node)) return unless cursor_intersects?(node.name) enum_node = @@ -10,14 +10,14 @@ module Mint if enum_node return if Core.ast.enums.includes?(enum_node) - location_link server, node.name, enum_node.name, enum_node + location_link node.name, enum_node.name, enum_node else return unless record = workspace.ast.records.find(&.name.value.==(node.name.value)) return if Core.ast.records.includes?(record) - location_link server, node.name, record.name, record + location_link node.name, record.name, record end end end diff --git a/src/ls/definition/type_id.cr b/src/ls/definition/type_id.cr index ad74293d1..2398df353 100644 --- a/src/ls/definition/type_id.cr +++ b/src/ls/definition/type_id.cr @@ -1,7 +1,7 @@ module Mint module LS class Definition < LSP::RequestMessage - def definition(node : Ast::TypeId, server : Server, workspace : Workspace, stack : Array(Ast::Node)) + def definition(node : Ast::TypeId, workspace : Workspace, stack : Array(Ast::Node)) case stack[1]? when Ast::ModuleAccess links = workspace.ast.modules @@ -9,10 +9,9 @@ module Mint .reject(&.in?(Core.ast.nodes)) .sort_by!(&.input.file) .map do |mod| - location_link server, node, mod.name, mod + location_link node, mod.name, mod end - return links.first if links.size == 1 return links unless links.empty? end @@ -23,14 +22,14 @@ module Mint find_component(workspace, node.value) if found.nil? && (next_node = stack[1]) - return definition(next_node, server, workspace, stack) + return definition(next_node, workspace, stack) end return if Core.ast.nodes.includes?(found) case found when Ast::Store, Ast::Enum, Ast::Component, Ast::RecordDefinition - location_link server, node, found.name, found + location_link node, found.name, found end end end diff --git a/src/ls/definition/variable.cr b/src/ls/definition/variable.cr index 8894f9bb8..d2fe55243 100644 --- a/src/ls/definition/variable.cr +++ b/src/ls/definition/variable.cr @@ -1,20 +1,20 @@ module Mint module LS class Definition < LSP::RequestMessage - def definition(node : Ast::Variable, server : Server, workspace : Workspace, stack : Array(Ast::Node)) + def definition(node : Ast::Variable, workspace : Workspace, stack : Array(Ast::Node)) lookup = workspace.type_checker.variables[node]? if lookup - variable_lookup_parent(node, lookup[1], server, workspace) || - variable_connect(node, lookup[2], server) || - variable_lookup(node, lookup[0], server) + variable_lookup_parent(node, lookup[1], workspace) || + variable_connect(node, lookup[2]) || + variable_lookup(node, lookup[0]) else - variable_record_key(node, server, workspace, stack) || - variable_next_key(node, server, workspace, stack) + variable_record_key(node, workspace, stack) || + variable_next_key(node, workspace, stack) end end - def variable_connect(node : Ast::Variable, parents : Array(TypeChecker::Scope::Node), server : Server) + def variable_connect(node : Ast::Variable, parents : Array(TypeChecker::Scope::Node)) # Check to see if this variable is defined as an Ast::ConnectVariable # as the `.variables` cache links directly to the stores state/function etc return unless component = parents.select(Ast::Component).first? @@ -24,13 +24,13 @@ module Mint variable = key.name || key.variable if variable.value == node.value - return location_link server, node, variable, connect + return location_link node, variable, connect end end end end - def variable_lookup_parent(node : Ast::Variable, target : TypeChecker::Scope::Node, server : Server, workspace : Workspace) + def variable_lookup_parent(node : Ast::Variable, target : TypeChecker::Scope::Node, workspace : Workspace) case target when Tuple(String, TypeChecker::Checkable, Ast::Node) case variable = target[2] @@ -44,12 +44,12 @@ module Mint .select(&.input.file.==(variable.input.file)) .find { |other| other.from < variable.from && other.to > variable.to } - location_link server, node, variable, parent + location_link node, variable, parent end end end - def variable_lookup(node : Ast::Variable, target : Ast::Node | TypeChecker::Checkable, server : Server) + def variable_lookup(node : Ast::Variable, target : Ast::Node | TypeChecker::Checkable) case item = target when Ast::Node name = case item @@ -64,11 +64,11 @@ module Mint item end - location_link server, node, name, item + location_link node, name, item end end - def variable_record_key(node : Ast::Variable, server : Server, workspace : Workspace, stack : Array(Ast::Node)) + def variable_record_key(node : Ast::Variable, workspace : Workspace, stack : Array(Ast::Node)) case field = stack[1]? when Ast::RecordField return unless record_name = workspace.type_checker.record_field_lookup[field]? @@ -79,11 +79,11 @@ module Mint .find(&.name.value.==(record_name)) .try(&.fields.find(&.key.value.==(node.value))) - location_link server, node, record_definition_field.key, record_definition_field + location_link node, record_definition_field.key, record_definition_field end end - def variable_next_key(node : Ast::Variable, server : Server, workspace : Workspace, stack : Array(Ast::Node)) + def variable_next_key(node : Ast::Variable, workspace : Workspace, stack : Array(Ast::Node)) case next_call = stack[3]? when Ast::NextCall return unless parent = workspace.type_checker.lookups[next_call] @@ -93,7 +93,7 @@ module Mint parent.states.find(&.name.value.==(node.value)) end - location_link server, node, state.name, state + location_link node, state.name, state end end end