vscode-pbkit icon indicating copy to clipboard operation
vscode-pbkit copied to clipboard

Go to Definition doesn't work?

Open moxley opened this issue 1 year ago • 7 comments

When I run the command "Go to definition", there are no results. There is a message below the search box that says, "The active editor does not provide symbol information".

CleanShot 2024-01-31 at 14 16 11@2x

Am I doing something wrong, or is there a setup step I missed, or do I misunderstand what "Go to Definition" means for this package?


vscode-pbkit 0.0.7v VS Code 1.85.2 Mac OS 14.1.2

moxley avatar Jan 31 '24 22:01 moxley

Can you create a minimal reproducible repository so I can test it out?

disjukr avatar Feb 02 '24 12:02 disjukr

@disjukr same problem on the latest versions of macos and vscode

kononovk avatar Aug 07 '24 15:08 kononovk

@kononovk Was it working well before and then the problem occurred? Or did you just install it for the first time and it’s not working? Can you provide a repository link where I can reproduce the issue?

disjukr avatar Aug 07 '24 16:08 disjukr

I just have installed it for the first time. The issue reproduce when the protobuf repository included in. main repo as a sumbodule an any proto files my file structure:

protos (submodule):
-- dir1
    a.proto
 -- dir2
    b.proto

In the a.proto I created a proto-message that uses a type from b.proto and try to go to definition to this type.

kononovk avatar Aug 07 '24 23:08 kononovk

Can you let me know what’s working and what’s not? Is 'Go to Definition' not working at all? I'm curious if 'Go to Definition' works within the same file, for example.

If it works within the same file but not when trying to go to a definition in another file, it might be because pbkit doesn’t know how to understand your project structure.

Check where the VSCode workspace root is and how the import statements are structured. Since pbkit supports buf workspace, creating a buf.work.yaml file might solve the issue.

disjukr avatar Aug 09 '24 00:08 disjukr

It doesn't work for me either. But I think it stopped working after we've migrated to buf.yaml v2 where the buf.work.yaml is no longer needed.

Buf now has a v2 configuration available, where this file is no longer used. See the v2 buf.yaml reference and the v1 to v2 migration guide for details about the new configuration and migration instructions.

EDIT: I did further testing and it only works within the same file, as in, if a struct is referenced within the same file it was defined. I'm not able to use "Go to Definition" over a type that's defined in another file.

pablospizzamiglio avatar Sep 30 '24 16:09 pablospizzamiglio

Oh, thank you. I wasn't aware that buf config v2 had been released and that it had broken workspace backward compatibility. That seems to be the cause of the issue. I'll quickly try adding buf config v2 support to pbkit.

disjukr avatar Oct 01 '24 03:10 disjukr

fixed at

  • vscode-pbkit: v0.0.8
  • pbkit: v0.0.72

https://github.com/pbkit/vscode-pbkit/commit/d27a69be600a92acd801e9ddaf6c2c8167df1af6

disjukr avatar Oct 05 '24 18:10 disjukr