Merge pull request #2911 from continuedev/tomasz/go-definitions

Go context (extend + test)
This commit is contained in:
Nate Sesti 2024-11-13 17:03:25 -08:00 • committed by GitHub
commit 72b95c8677
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 32 additions and 1 deletions

View file

@ -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", () => {

View file

@ -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
}

View file

@ -0,0 +1,12 @@
(
(function_declaration
(parameter_list
(parameter_declaration
type: (_) @param_type
)*
)
; Optional return type node before the block
([_] @return_type)?
(block)
)
)