buf icon indicating copy to clipboard operation
buf copied to clipboard

IntelliJ IDEA integration

Open listepo opened this issue 3 years ago • 15 comments

Any plans to support developers with IntelliJ IDEA?

listepo avatar Jan 02 '21 03:01 listepo

No particular plans, we could look into it in the future though

bufdev avatar Jan 02 '21 14:01 bufdev

+1 to this

AlexeiZenin avatar May 17 '21 18:05 AlexeiZenin

+1

musufyian avatar Jun 06 '21 21:06 musufyian

What kind of integration are we talking about here? I would love to work on it

asahasrabuddhe avatar Jul 27 '21 08:07 asahasrabuddhe

I think we can build over https://plugins.jetbrains.com/plugin/14004-protocol-buffers/

listepo avatar Aug 10 '21 15:08 listepo

Big things that would be helpful from this:

  1. Buf lint integration
  2. Buf breaking integration
  3. Option to auto-generate on save

commure-stabai avatar Nov 03 '21 21:11 commure-stabai

I will be happy to see a general solution for external tools for editing .proto files, these tools (like IDEA) know nothing about buf dependencies (like googleapis), so .proto files with such includes are incorrect from their point of view, also go to the definition doesn't work either

nordicdyno avatar Nov 23 '21 17:11 nordicdyno

@nordicdyno I agree with you that there are lots of ways a Buf plugin could improve on the proto editing experience, but you might have a slightly better time if you use the HIGAN protobuf plugin rather than the bundled one.

Also, both plugins allow you to specify additional folders where they should look for protos. If you point them at the a local copy of grpc/etc, you should be able to get rid of the import errors. It will still dumbly assume that they're included even if they're not, but it's better than it just showing errors all the time.

commure-stabai avatar Nov 23 '21 23:11 commure-stabai

A better story around IDE integration (including IntelliJ) is on our roadmap, but it's not our primary focus right now.

Like the roadmap describes, we're very interested in LSP since it would give us a solution for so many editors without needing to tailor a solution to each editor independently (like vim-buf and vscode-buf).

I don't have much familiarity with IntelliJ, but it looks like IntelliJ doesn't support LSP.

We'll eventually develop a solution that will work for our IntelliJ users (regardless of LSP support), but we don't have a timeline for this just yet.

amckinney avatar Nov 24 '21 00:11 amckinney

One very simple workaround is to just add buf's cache directories as extra search paths:

image

leoluk avatar Nov 24 '21 16:11 leoluk

Thanks @leoluk, more docs on the module cache can be found here. I should have also mentioned that you can set up buf lint to run on a save with a couple configurations described here.

amckinney avatar Nov 24 '21 16:11 amckinney

One very simple workaround is to just add buf's cache directories as extra search paths:

I've thought about it. I think it would be handy if buf had some command which prints all cache paths for a lock file, so it would be easy just copy&paste them.

nordicdyno avatar Nov 25 '21 12:11 nordicdyno

So, I've solved my problem by just putting googleapi's files which are used as includes into third-party directory, which is not in build/roots list. I suppose that in a new 1.x buf version I will be forced to use excludes option because roots have been removed.

nordicdyno avatar Nov 29 '21 12:11 nordicdyno

Hello folks, I am happy to inform you that the first version of Buf integration for JetBrains IDEs has been released (community support).

There are some highlight features for Buf:

  1. Code completion and documentation for buf configuration files (only for v1).
  2. Auto config protobuf import roots from buf.yaml and buf.work.yaml, it support locked deps and workspace local module.
  3. Execute buf command like buf build , buf mod update and view the module deps tree in Buf Tool Window.
  4. Code annotator by buf lint.

Explore more editing features of protobuf:

  1. Smarter import management, auto import and import optimization.
  2. Smarter import path management, auto config from libraries.
  3. Protobuf decompile for golang.
  4. Import fix suggestion.

Search and install protobuf in plugin page or download it from JetBrains Marketplace.

If you feel usable for this plugin, you can comment and rating it, share it to your workmate. If you have trouble using this plugin, feel free to create Github Issue.

image image image image

devkanro avatar Apr 24 '22 03:04 devkanro

We're going to be releasing bufbuild/intellij-buf in the next week or so as well.

bufdev avatar Apr 24 '22 15:04 bufdev

This was released https://github.com/bufbuild/intellij-buf 🎉

amckinney avatar Aug 11 '22 18:08 amckinney