-
-
Notifications
You must be signed in to change notification settings - Fork 141
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::Variable
- Loading branch information
Showing
50 changed files
with
3,295 additions
and
11 deletions.
There are no files selected for viewing
55 changes: 55 additions & 0 deletions
55
spec/language_server/definition/location/variable_block_statement_target
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,55 @@ | ||
module Test { | ||
fun upperCaseMint : String { | ||
let test = | ||
"Mint" | ||
|
||
String.toUpperCase(test) | ||
} | ||
} | ||
------------------------------------------------------------------file test.mint | ||
{ | ||
"id": 0, | ||
"method": "initialize", | ||
"params": { | ||
"capabilities": { | ||
"textDocument": { | ||
"definition": { | ||
"linkSupport": false | ||
} | ||
} | ||
} | ||
} | ||
} | ||
-------------------------------------------------------------------------request | ||
{ | ||
"id": 1, | ||
"params": { | ||
"textDocument": { | ||
"uri": "file://#{root_path}/test.mint" | ||
}, | ||
"position": { | ||
"line": 5, | ||
"character": 23 | ||
} | ||
}, | ||
"method": "textDocument/definition" | ||
} | ||
-------------------------------------------------------------------------request | ||
{ | ||
"jsonrpc": "2.0", | ||
"result": { | ||
"range": { | ||
"start": { | ||
"line": 2, | ||
"character": 8 | ||
}, | ||
"end": { | ||
"line": 2, | ||
"character": 12 | ||
} | ||
}, | ||
"uri": "file://#{root_path}/test.mint" | ||
}, | ||
"id": 1 | ||
} | ||
------------------------------------------------------------------------response |
61 changes: 61 additions & 0 deletions
61
spec/language_server/definition/location/variable_casebranch_enumdestructuring
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,61 @@ | ||
enum Status { | ||
Error | ||
Ok(text : String) | ||
} | ||
|
||
module Test { | ||
fun toString (status : Status) : String { | ||
case status { | ||
Status::Ok(text) => text | ||
Status::Error => "error" | ||
} | ||
} | ||
} | ||
------------------------------------------------------------------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": 8, | ||
"character": 26 | ||
} | ||
}, | ||
"method": "textDocument/definition" | ||
} | ||
-------------------------------------------------------------------------request | ||
{ | ||
"jsonrpc": "2.0", | ||
"result": { | ||
"range": { | ||
"start": { | ||
"line": 8, | ||
"character": 17 | ||
}, | ||
"end": { | ||
"line": 8, | ||
"character": 21 | ||
} | ||
}, | ||
"uri": "file://#{root_path}/test.mint" | ||
}, | ||
"id": 1 | ||
} | ||
------------------------------------------------------------------------response |
60 changes: 60 additions & 0 deletions
60
spec/language_server/definition/location/variable_component_connect
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,60 @@ | ||
component Test { | ||
connect Theme exposing { primary } | ||
|
||
fun render : Html { | ||
<div> | ||
<{ primary }> | ||
</div> | ||
} | ||
} | ||
------------------------------------------------------------------file test.mint | ||
store Theme { | ||
state primary : String = "#00a0e8" | ||
} | ||
-----------------------------------------------------------------file store.mint | ||
{ | ||
"id": 0, | ||
"method": "initialize", | ||
"params": { | ||
"capabilities": { | ||
"textDocument": { | ||
"definition": { | ||
"linkSupport": false | ||
} | ||
} | ||
} | ||
} | ||
} | ||
-------------------------------------------------------------------------request | ||
{ | ||
"id": 1, | ||
"params": { | ||
"textDocument": { | ||
"uri": "file://#{root_path}/test.mint" | ||
}, | ||
"position": { | ||
"line": 5, | ||
"character": 9 | ||
} | ||
}, | ||
"method": "textDocument/definition" | ||
} | ||
-------------------------------------------------------------------------request | ||
{ | ||
"jsonrpc": "2.0", | ||
"result": { | ||
"range": { | ||
"start": { | ||
"line": 1, | ||
"character": 27 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"character": 34 | ||
} | ||
}, | ||
"uri": "file://#{root_path}/test.mint" | ||
}, | ||
"id": 1 | ||
} | ||
------------------------------------------------------------------------response |
60 changes: 60 additions & 0 deletions
60
spec/language_server/definition/location/variable_component_connect_as
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,60 @@ | ||
component Test { | ||
connect Theme exposing { primary as primaryColor } | ||
|
||
fun render : Html { | ||
<div> | ||
<{ primaryColor }> | ||
</div> | ||
} | ||
} | ||
------------------------------------------------------------------file test.mint | ||
store Theme { | ||
state primary : String = "#00a0e8" | ||
} | ||
-----------------------------------------------------------------file store.mint | ||
{ | ||
"id": 0, | ||
"method": "initialize", | ||
"params": { | ||
"capabilities": { | ||
"textDocument": { | ||
"definition": { | ||
"linkSupport": false | ||
} | ||
} | ||
} | ||
} | ||
} | ||
-------------------------------------------------------------------------request | ||
{ | ||
"id": 1, | ||
"params": { | ||
"textDocument": { | ||
"uri": "file://#{root_path}/test.mint" | ||
}, | ||
"position": { | ||
"line": 5, | ||
"character": 9 | ||
} | ||
}, | ||
"method": "textDocument/definition" | ||
} | ||
-------------------------------------------------------------------------request | ||
{ | ||
"jsonrpc": "2.0", | ||
"result": { | ||
"range": { | ||
"start": { | ||
"line": 1, | ||
"character": 38 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"character": 50 | ||
} | ||
}, | ||
"uri": "file://#{root_path}/test.mint" | ||
}, | ||
"id": 1 | ||
} | ||
------------------------------------------------------------------------response |
57 changes: 57 additions & 0 deletions
57
spec/language_server/definition/location/variable_component_constant
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 @@ | ||
component Test { | ||
const TEXT = "Mint" | ||
|
||
fun render : Html { | ||
<div> | ||
<{ TEXT }> | ||
</div> | ||
} | ||
} | ||
------------------------------------------------------------------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": 5, | ||
"character": 9 | ||
} | ||
}, | ||
"method": "textDocument/definition" | ||
} | ||
-------------------------------------------------------------------------request | ||
{ | ||
"jsonrpc": "2.0", | ||
"result": { | ||
"range": { | ||
"start": { | ||
"line": 1, | ||
"character": 8 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"character": 12 | ||
} | ||
}, | ||
"uri": "file://#{root_path}/test.mint" | ||
}, | ||
"id": 1 | ||
} | ||
------------------------------------------------------------------------response |
59 changes: 59 additions & 0 deletions
59
spec/language_server/definition/location/variable_component_function
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,59 @@ | ||
component Test { | ||
fun text : String { | ||
"Mint" | ||
} | ||
|
||
fun render : Html { | ||
<div> | ||
<{ text() }> | ||
</div> | ||
} | ||
} | ||
------------------------------------------------------------------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": 7, | ||
"character": 9 | ||
} | ||
}, | ||
"method": "textDocument/definition" | ||
} | ||
-------------------------------------------------------------------------request | ||
{ | ||
"jsonrpc": "2.0", | ||
"result": { | ||
"range": { | ||
"start": { | ||
"line": 1, | ||
"character": 6 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"character": 10 | ||
} | ||
}, | ||
"uri": "file://#{root_path}/test.mint" | ||
}, | ||
"id": 1 | ||
} | ||
------------------------------------------------------------------------response |
Oops, something went wrong.