I'm sure CLion support is ongoing (I see code in the repo). Just wanted to make this ticket to track when it might show up.
We're not yet ready to claim to support CLion, or to upload that version of the plugin to JetBrains' repository, but we are working on it and using it ourselves.
It you want to try it out, you can build the plugin manually -- "bazel build //clwb:clwb_bazel --define=ij_product=clion-latest". We'd be happy to get any feedback or suggestions you might have.
This work is fantastic. Thank you for doing it.
Unfortunately the plugin indexes quite slowly for large projects. My repo includes Boost source and is impossible to index even when no target depends on those files. Including them in "directories" is sufficient to kill the project.
Hi @kayasoze, yes that is a problem. There's not much we can do about it -- CLion 2016.2 builds symbol tables up front for all source files in the project.
The only current workaround is to remove unnecessary items from 'directories' (e.g. anything you're not directly editing).
Symbol building has changed a lot in 2016.3 -- it's no longer done up front for all files in the project. Instead it's done on demand when you open source files. Unfortunately at the moment this just replaces the one-time cost with lengthy hangs whenever you open a new source file (https://youtrack.jetbrains.com/issue/CPP-7988). Still, that's probably preferable for your situation.
We're very interested in improving sync times, but it's unlikely to happen soon -- it's largely a case of waiting for the underlying CLion model to either improve or stabilize.
Would it be possible to index files/directories that are only in the transitive closure of explicitly named targets? That's what my homegrown Bazel-to-CMakeLists.txt converter does, and it really helps for the Boost case, where you may reference only a few headers and don't want to index 15,000.
When you specify the project via CMake, do you see the entire Boost directories showing up in the project view (and can you navigate to those files, etc.)? If so, then that would imply there is a way to suppress indexing files in the project.
Do you have a sample project I could look at?
I'm really happy to find this thread! We desperately want CLion/Bazel integration over at RobotLocomotion/drake, and are willing to give experimental code a try. Thanks for developing in the open!
With that, of course, I have a trouble report. I built your plugin following the instructions above (https://github.com/bazelbuild/intellij/issues/26#issuecomment-255737553) and installed the resulting bazel-genfiles/clwb/clwb_bazel.jar into CLion. I can go through the motions of importing a Bazel project into CLion, generating from a Drake BUILD file, but CLion doesn't actually become aware of any source files or build targets. I just get an empty, gray drake-distro directory, and instantaneous no-op builds. Any hints anyone can offer?
Hi, thanks for trying it out! I'm seeing some issues with unrecognized options in your bazel.rc, but after temporarily removing the bazel.rc file it seems to work OK.
Which version of bazel are you using?
$ bazel info release
release 0.4.2
Thanks for the quick reply! I'll give it a try without bazel.rc shortly.
I'll give it a try without bazel.rc shortly.
Same results. Could you tell me more about where the unrecognized option issues manifest themselves? I suspect I'm not even getting that far.
OK, that does sound like something completely different. Which version of CLion are you using? (we only support 2016.2 at the moment)
When you import the bazel project, and run the 'Sync project with BUILD files' action, do you see any output in the Bazel console view, or any errors in the CLion logs? (you can access the logs via 'Help > Show Log in Files')
Which version of CLion are you using? (we only support 2016.2 at the moment)
That's the ticket! I was using 2016.3.2. I downgraded to 2016.2.3 from https://download.jetbrains.com/cpp/CLion-2016.2.3.tar.gz, reinstalled the plugin, and CLion is now happily indexing symbols. Woohoo!
When you import the bazel project, and run the 'Sync project with BUILD files' action, do you see any output in the Bazel console view, or any errors in the CLion logs? (you can access the logs via 'Help > Show Log in Files')
For the archives, no. On 2016.3.2, the Bazel console output just reported Sync: 1ms. The CLion logs contained no Bazel plugin messages at all, and no CLion core messages above WARN.
Having lived with it for a half-day, this is really fantastic! I'm going to roll it out to our developers with https://github.com/RobotLocomotion/drake/pull/4814.
Would you like questions and bug reports on this thread, on separate issues, or not at all? My top question at the moment is how to get CLion to index the WORKSPACE externals. Right now it just can't find the header files, e.g. <Eigen/Dense> :arrow_right: "Cannot find Eigen".
Great, glad to hear it's working! Could you raise separate issues for any questions / bug reports?
We've now uploaded CLion-with-Bazel to JetBrains' plugin repo (https://plugins.jetbrains.com/plugin/9554-clion-with-bazel). The uploaded version supports CLion 2016.3 only at the moment -- we'll continue to update it every two weeks or so.
I'll update the website, and github readme in the next code drop.
Most helpful comment
We've now uploaded CLion-with-Bazel to JetBrains' plugin repo (https://plugins.jetbrains.com/plugin/9554-clion-with-bazel). The uploaded version supports CLion 2016.3 only at the moment -- we'll continue to update it every two weeks or so.
I'll update the website, and github readme in the next code drop.