Merge pull request #2911 from continuedev/tomasz/go-definitions
Go context (extend + test)
This commit is contained in:
commit
72b95c8677
3 changed files with 32 additions and 1 deletions
|
|
@ -57,7 +57,7 @@ const TEST_CASES = [
|
|||
],
|
||||
},
|
||||
{
|
||||
nodeType: "function_definition (inside a class)",
|
||||
nodeType: "method_declaration",
|
||||
fileName: "file1.php",
|
||||
language: "PHP",
|
||||
cursorPosition: { line: 26, character: 35 },
|
||||
|
|
@ -69,6 +69,16 @@ const TEST_CASES = [
|
|||
{ row: 25, column: 61 }, // Address
|
||||
],
|
||||
},
|
||||
{
|
||||
nodeType: "function_declaration",
|
||||
fileName: "file1.go",
|
||||
language: "Go",
|
||||
cursorPosition: { line: 7, character: 21 },
|
||||
definitionPositions: [
|
||||
{ row: 6, column: 33 }, // models.User
|
||||
{ row: 6, column: 50 }, // models.Address
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
describe("RootPathContextService", () => {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,9 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"core/autocomplete/context/root-path-context/test/files/models"
|
||||
)
|
||||
|
||||
func getAddress(user *models.User) *models.Address {
|
||||
return user.Address
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
(
|
||||
(function_declaration
|
||||
(parameter_list
|
||||
(parameter_declaration
|
||||
type: (_) @param_type
|
||||
)*
|
||||
)
|
||||
; Optional return type node before the block
|
||||
([_] @return_type)?
|
||||
(block)
|
||||
)
|
||||
)
|
||||
Loading…
Add table
Reference in a new issue