Skip to content

Commit

Permalink
Merge pull request #12 from lasorda/pzh
Browse files Browse the repository at this point in the history
up
  • Loading branch information
lasorda authored Jun 11, 2024
2 parents e67500d + 767cdb7 commit cccf1a2
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion components/jump_definition.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,15 @@ func JumpPbHeaderDefine(ctx context.Context, req *defines.DefinitionParams) (res
line := view.ViewManager.GetPbHeaderLine(req.TextDocument.Uri, int(req.Position.Line))
word := getWord(line, int(req.Position.Character), false)
logs.Printf("line %v, word %v", line, word)
return searchType(proto_file, word)
res, err := searchType(proto_file, word)
// better than nothing
if (res == nil || len(*res) == 0) && strings.Contains(word, "_") {
split_res := strings.Split(word, "_")
if len(split_res) > 0 {
res, err = searchType(proto_file, split_res[0])
}
}
return res, err
}

func JumpProtoDefine(ctx context.Context, req *defines.DefinitionParams) (result *[]defines.LocationLink, err error) {
Expand Down

0 comments on commit cccf1a2

Please sign in to comment.