From 767cdb7f9624697f8de8e73d6351f11f2e899356 Mon Sep 17 00:00:00 2001 From: zhihaopan Date: Tue, 11 Jun 2024 19:47:21 +0800 Subject: [PATCH] up --- components/jump_definition.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/components/jump_definition.go b/components/jump_definition.go index ac4a8fa..09ee7e9 100644 --- a/components/jump_definition.go +++ b/components/jump_definition.go @@ -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) {