feat: go definitions

This commit is contained in:
tomasz-io 2024-11-13 11:33:09 -08:00
parent e0ae4ceb56
commit bf65b1ebbd
2 changed files with 23 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,12 @@
(
(function_declaration
(parameter_list
(parameter_declaration
type: (_) @param_type
)*
)
; Optional return type node before the block
([_] @return_type)?
(block)
)
)