-
-
Notifications
You must be signed in to change notification settings - Fork 143
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
LSP: Add Go To Definition support for
Ast::Access
(#636)
- Loading branch information
Showing
10 changed files
with
589 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
record Header { | ||
titles : Array(String) | ||
} | ||
----------------------------------------------------------------file record.mint | ||
module Test { | ||
fun getFirstTitle (header : Header) : Maybe(String) { | ||
header.titles[0] | ||
} | ||
} | ||
------------------------------------------------------------------file test.mint | ||
{ | ||
"id": 0, | ||
"method": "initialize", | ||
"params": { | ||
"capabilities": { | ||
"textDocument": { | ||
"definition": { | ||
"linkSupport": false | ||
} | ||
} | ||
} | ||
} | ||
} | ||
-------------------------------------------------------------------------request | ||
{ | ||
"jsonrpc": "2.0", | ||
"id": 1, | ||
"params": { | ||
"textDocument": { | ||
"uri": "file://#{root_path}/test.mint" | ||
}, | ||
"position": { | ||
"line": 2, | ||
"character": 11 | ||
} | ||
}, | ||
"method": "textDocument/definition" | ||
} | ||
-------------------------------------------------------------------------request | ||
{ | ||
"jsonrpc": "2.0", | ||
"result": { | ||
"range": { | ||
"start": { | ||
"line": 1, | ||
"character": 2 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"character": 8 | ||
} | ||
}, | ||
"uri": "file://#{root_path}/record.mint" | ||
}, | ||
"id": 1 | ||
} | ||
------------------------------------------------------------------------response |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
record Header { | ||
hide : Function(Void) | ||
} | ||
----------------------------------------------------------------file record.mint | ||
module Test { | ||
fun hideHeader (header : Header) : Void { | ||
header.hide() | ||
} | ||
} | ||
------------------------------------------------------------------file test.mint | ||
{ | ||
"id": 0, | ||
"method": "initialize", | ||
"params": { | ||
"capabilities": { | ||
"textDocument": { | ||
"definition": { | ||
"linkSupport": false | ||
} | ||
} | ||
} | ||
} | ||
} | ||
-------------------------------------------------------------------------request | ||
{ | ||
"jsonrpc": "2.0", | ||
"id": 1, | ||
"params": { | ||
"textDocument": { | ||
"uri": "file://#{root_path}/test.mint" | ||
}, | ||
"position": { | ||
"line": 2, | ||
"character": 11 | ||
} | ||
}, | ||
"method": "textDocument/definition" | ||
} | ||
-------------------------------------------------------------------------request | ||
{ | ||
"jsonrpc": "2.0", | ||
"result": { | ||
"range": { | ||
"start": { | ||
"line": 1, | ||
"character": 2 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"character": 6 | ||
} | ||
}, | ||
"uri": "file://#{root_path}/record.mint" | ||
}, | ||
"id": 1 | ||
} | ||
------------------------------------------------------------------------response |
65 changes: 65 additions & 0 deletions
65
spec/language_server/definition/location/access_record_multiple
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
record Nested3 { | ||
field3 : String | ||
} | ||
---------------------------------------------------------------file nested3.mint | ||
record Nested2 { | ||
field2 : Nested3 | ||
} | ||
---------------------------------------------------------------file nested2.mint | ||
record Nested { | ||
field1 : Nested2 | ||
} | ||
---------------------------------------------------------------file nested1.mint | ||
module Test { | ||
fun getNestedField (nested : Nested) : String { | ||
nested.field1.field2.field3 | ||
} | ||
} | ||
------------------------------------------------------------------file test.mint | ||
{ | ||
"id": 0, | ||
"method": "initialize", | ||
"params": { | ||
"capabilities": { | ||
"textDocument": { | ||
"definition": { | ||
"linkSupport": false | ||
} | ||
} | ||
} | ||
} | ||
} | ||
-------------------------------------------------------------------------request | ||
{ | ||
"jsonrpc": "2.0", | ||
"id": 1, | ||
"params": { | ||
"textDocument": { | ||
"uri": "file://#{root_path}/test.mint" | ||
}, | ||
"position": { | ||
"line": 2, | ||
"character": 18 | ||
} | ||
}, | ||
"method": "textDocument/definition" | ||
} | ||
-------------------------------------------------------------------------request | ||
{ | ||
"jsonrpc": "2.0", | ||
"result": { | ||
"range": { | ||
"start": { | ||
"line": 1, | ||
"character": 2 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"character": 8 | ||
} | ||
}, | ||
"uri": "file://#{root_path}/nested2.mint" | ||
}, | ||
"id": 1 | ||
} | ||
------------------------------------------------------------------------response |
57 changes: 57 additions & 0 deletions
57
spec/language_server/definition/location/access_record_single
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
record Header { | ||
title : String | ||
} | ||
----------------------------------------------------------------file record.mint | ||
module Test { | ||
fun getTitle (header : Header) : String { | ||
header.title | ||
} | ||
} | ||
------------------------------------------------------------------file test.mint | ||
{ | ||
"id": 0, | ||
"method": "initialize", | ||
"params": { | ||
"capabilities": { | ||
"textDocument": { | ||
"definition": { | ||
"linkSupport": false | ||
} | ||
} | ||
} | ||
} | ||
} | ||
-------------------------------------------------------------------------request | ||
{ | ||
"jsonrpc": "2.0", | ||
"id": 1, | ||
"params": { | ||
"textDocument": { | ||
"uri": "file://#{root_path}/test.mint" | ||
}, | ||
"position": { | ||
"line": 2, | ||
"character": 11 | ||
} | ||
}, | ||
"method": "textDocument/definition" | ||
} | ||
-------------------------------------------------------------------------request | ||
{ | ||
"jsonrpc": "2.0", | ||
"result": { | ||
"range": { | ||
"start": { | ||
"line": 1, | ||
"character": 2 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"character": 7 | ||
} | ||
}, | ||
"uri": "file://#{root_path}/record.mint" | ||
}, | ||
"id": 1 | ||
} | ||
------------------------------------------------------------------------response |
79 changes: 79 additions & 0 deletions
79
spec/language_server/definition/location_link/access_array
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
record Header { | ||
titles : Array(String) | ||
} | ||
----------------------------------------------------------------file record.mint | ||
module Test { | ||
fun getFirstTitle (header : Header) : Maybe(String) { | ||
header.titles[0] | ||
} | ||
} | ||
------------------------------------------------------------------file test.mint | ||
{ | ||
"id": 0, | ||
"method": "initialize", | ||
"params": { | ||
"capabilities": { | ||
"textDocument": { | ||
"definition": { | ||
"linkSupport": true | ||
} | ||
} | ||
} | ||
} | ||
} | ||
-------------------------------------------------------------------------request | ||
{ | ||
"jsonrpc": "2.0", | ||
"id": 1, | ||
"params": { | ||
"textDocument": { | ||
"uri": "file://#{root_path}/test.mint" | ||
}, | ||
"position": { | ||
"line": 2, | ||
"character": 11 | ||
} | ||
}, | ||
"method": "textDocument/definition" | ||
} | ||
-------------------------------------------------------------------------request | ||
{ | ||
"jsonrpc": "2.0", | ||
"result": [ | ||
{ | ||
"originSelectionRange": { | ||
"start": { | ||
"line": 2, | ||
"character": 11 | ||
}, | ||
"end": { | ||
"line": 2, | ||
"character": 17 | ||
} | ||
}, | ||
"targetUri": "file://#{root_path}/record.mint", | ||
"targetRange": { | ||
"start": { | ||
"line": 1, | ||
"character": 2 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"character": 24 | ||
} | ||
}, | ||
"targetSelectionRange": { | ||
"start": { | ||
"line": 1, | ||
"character": 2 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"character": 8 | ||
} | ||
} | ||
} | ||
], | ||
"id": 1 | ||
} | ||
------------------------------------------------------------------------response |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
record Header { | ||
hide : Function(Void) | ||
} | ||
----------------------------------------------------------------file record.mint | ||
module Test { | ||
fun hideHeader (header : Header) : Void { | ||
header.hide() | ||
} | ||
} | ||
------------------------------------------------------------------file test.mint | ||
{ | ||
"id": 0, | ||
"method": "initialize", | ||
"params": { | ||
"capabilities": { | ||
"textDocument": { | ||
"definition": { | ||
"linkSupport": true | ||
} | ||
} | ||
} | ||
} | ||
} | ||
-------------------------------------------------------------------------request | ||
{ | ||
"jsonrpc": "2.0", | ||
"id": 1, | ||
"params": { | ||
"textDocument": { | ||
"uri": "file://#{root_path}/test.mint" | ||
}, | ||
"position": { | ||
"line": 2, | ||
"character": 11 | ||
} | ||
}, | ||
"method": "textDocument/definition" | ||
} | ||
-------------------------------------------------------------------------request | ||
{ | ||
"jsonrpc": "2.0", | ||
"result": [ | ||
{ | ||
"originSelectionRange": { | ||
"start": { | ||
"line": 2, | ||
"character": 11 | ||
}, | ||
"end": { | ||
"line": 2, | ||
"character": 15 | ||
} | ||
}, | ||
"targetUri": "file://#{root_path}/record.mint", | ||
"targetRange": { | ||
"start": { | ||
"line": 1, | ||
"character": 2 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"character": 23 | ||
} | ||
}, | ||
"targetSelectionRange": { | ||
"start": { | ||
"line": 1, | ||
"character": 2 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"character": 6 | ||
} | ||
} | ||
} | ||
], | ||
"id": 1 | ||
} | ||
------------------------------------------------------------------------response |
Oops, something went wrong.