Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support to configure proto plugin import paths. #384

Open
hsyed opened this issue Aug 6, 2018 · 5 comments
Open

Add support to configure proto plugin import paths. #384

hsyed opened this issue Aug 6, 2018 · 5 comments
Assignees
Labels
awaiting-maintainer Awaiting review from Bazel team on issues product: IntelliJ IntelliJ plugin topic: protobuf Protobuf rules integration type: feature request

Comments

@hsyed
Copy link

hsyed commented Aug 6, 2018

Real world mono-repos need to setup proto imports when using the Intellij proto plugin. The import paths are usually local workspace relative / in external repos. Some example of core proto imports are:

  1. The WKT's from Protobuf core.
  2. Plugin and descriptors for code generations from Protobuf core.
  3. Google HTTP annotations used by grpc-gateway and for building google api's.
  4. Gogo annotations for go projects.
@hsyed
Copy link
Author

hsyed commented Aug 6, 2018

I had a PR open that implemented support but since it was not getting any traction I closed it.

The PR added support to add import paths to the project views which then then configure the proto plugin with the correct file system paths on sync.

The PR implements this in a separate directory called contrib which Is modelled as a distinct plugin, the dependency on the proto plugin is optional.

I'm happy to reopen this PR as I have some time on my hands at the moment.

@ittaiz
Copy link
Member

ittaiz commented Aug 6, 2018 via email

@hsyed
Copy link
Author

hsyed commented Aug 6, 2018

@ittaiz No I didn't look into harvesting anything from the sync model built by the plugin I kept it simple. There is a simple syntax for declaring the directory to add to the import path - it uses bazel labelling syntax to declare the directory to add to the path see.

This approach just works for most use-cases I have worked with (includes all of those mentioned above). Vendored go code directories can be easily picked up with a local workspace reference (gogo / kubernetes, grpc-gateway), the WKT's from com_google_protobuf can be easily added when working in exclusively a non-go project.

If we automate the population of the plugin collisions will be quite numerous in sizeable mono repos I suspect. Keeping in mind that the plugin is configured project wide -- we would need to write heuristics to break ties -- not that hard to do as in most cases selecting either of the import paths from a collision should be fine for code completion purposes, we will probably find use-cases where we need to override the collision resolution and this would be overkill.

@efeller
Copy link

efeller commented Oct 12, 2018

@hsyed @ittaiz Thanks for contributing this. We would find it useful to merge this PR as well here.

@jin jin added topic: protobuf Protobuf rules integration type: feature request labels May 1, 2019
@sgowroji sgowroji added the product: IntelliJ IntelliJ plugin label Oct 18, 2022
@sgowroji sgowroji added the awaiting-maintainer Awaiting review from Bazel team on issues label Oct 31, 2022
@liucijus
Copy link
Collaborator

Related issue #2979

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting-maintainer Awaiting review from Bazel team on issues product: IntelliJ IntelliJ plugin topic: protobuf Protobuf rules integration type: feature request
Projects
None yet
Development

No branches or pull requests

6 participants