From d9a9c9cbd6da40eb22eb3d6087ad16c1174257ec Mon Sep 17 00:00:00 2001 From: Shawn Hurley Date: Wed, 6 Sep 2023 14:30:00 -0400 Subject: [PATCH] :sparkles: adding ability to look for packages --- provider/internal/java/provider.go | 1 + provider/internal/java/service_client.go | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/provider/internal/java/provider.go b/provider/internal/java/provider.go index 016346d5..c2d585f4 100644 --- a/provider/internal/java/provider.go +++ b/provider/internal/java/provider.go @@ -45,6 +45,7 @@ var locationToCode = map[string]int{ "import": 8, "variable_declaration": 9, "type": 10, + "package": 11, } type javaProvider struct { diff --git a/provider/internal/java/service_client.go b/provider/internal/java/service_client.go index 13f87c84..5b3efd29 100644 --- a/provider/internal/java/service_client.go +++ b/provider/internal/java/service_client.go @@ -51,6 +51,8 @@ func (p *javaServiceClient) Evaluate(cap string, conditionInfo []byte) (provider symbols := p.GetAllSymbols(cond.Referenced.Pattern, cond.Referenced.Location) + fmt.Printf("\n\n\n%#v\n\n\n", symbols) + incidents := []provider.IncidentContext{} switch locationToCode[strings.ToLower(cond.Referenced.Location)] { case 0: @@ -72,6 +74,8 @@ func (p *javaServiceClient) Evaluate(cap string, conditionInfo []byte) (provider incidents, err = p.filterVariableDeclaration(symbols) case 10: incidents, err = p.filterTypeReferences(symbols) + case 11: + incidents, err = p.filterDefault(symbols) default: } @@ -196,7 +200,7 @@ func (p *javaServiceClient) initialization() { } var result protocol.InitializeResult - for i:=0; i < 10; i++ { + for i := 0; i < 10; i++ { if err := p.rpc.Call(p.ctx, "initialize", params, &result); err != nil { p.log.Error(err, "initialize failed") continue