Skip to content

Commit

Permalink
src/goGenerateTests: fix method can not generate test in gopls docume…
Browse files Browse the repository at this point in the history
…nt symbol

Gopls's document symbol provider classifies methods correctly, while `go-outline`-based document symbol provider marks them as "function". The difference caused regression after change for golang#1020.

Fixes golang#2091

Change-Id: I1b92753132be26b528f994ae42af32c723dd7ce2
GitHub-Last-Rev: 6483108
GitHub-Pull-Request: golang#2090
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/389994
Reviewed-by: Hyang-Ah Hana Kim <[email protected]>
Run-TryBot: Hyang-Ah Hana Kim <[email protected]>
Trust: Suzy Mueller <[email protected]>
  • Loading branch information
Pavle Lee authored and hyangah committed Mar 4, 2022
1 parent aca26c6 commit 1cc1b7c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/goGenerateTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -227,5 +227,5 @@ function generateTests(conf: Config, goConfig: vscode.WorkspaceConfiguration): P
async function getFunctions(doc: vscode.TextDocument): Promise<vscode.DocumentSymbol[]> {
const documentSymbolProvider = new GoDocumentSymbolProvider();
const symbols = await documentSymbolProvider.provideDocumentSymbols(doc, null);
return symbols[0].children.filter((sym) => sym.kind === vscode.SymbolKind.Function);
return symbols[0].children.filter((sym) => [vscode.SymbolKind.Function, vscode.SymbolKind.Method].includes(sym.kind));
}

0 comments on commit 1cc1b7c

Please sign in to comment.