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 config toturial for CLion and WebStorm #9

Open
himself65 opened this issue Jul 7, 2021 · 11 comments · May be fixed by #10
Open

Add config toturial for CLion and WebStorm #9

himself65 opened this issue Jul 7, 2021 · 11 comments · May be fixed by #10

Comments

@himself65
Copy link
Member

No description provided.

@chriskilding
Copy link

I'm looking at this a little bit at the moment, this is how far I've got with the Jetbrains suite (version 2021.2)...

I tried:

  • IntelliJ IDEA Ultimate (which is 'supposed' to be the equivalent of Webstorm or Clion)
  • Webstorm + Clion

@chriskilding
Copy link

First I tried opening the overall node project in IDEA Ultimate. I had assumed this would be the better option for a polyglot project since IDEA Ultimate has some support for all the languages:

  • It indexes the project (although it's chunky - you may have to increase IDEA's max heap size + restart to get indexing to complete)
  • It notices executable targets in the Makefile (you might have to run ./configure first to make them work though)
  • It can run those targets - but building Node produces so much output that it may overwhelm the embedded terminal. You're probably better off doing at least the first make out in the OS terminal instead.

Unfortunately after that point, IDEA doesn't seem to know what to do with the C++ bit of node in src/. It can syntax highlight the files, but is not deeply aware of the contents like Clion is, so for example you can't Cmd-Click to jump to method definitions, or use 'go to super method' or 'go to definition' to jump from .cc to .h declaration. So it's not really much more than an editor at this point.

I then tried opening the src/ directory specifically in IDEA, thinking this might prompt it to treat it as a C++ project. There was no difference.

@chriskilding
Copy link

Then I tried opening the whole node project with CLion.

(CLion comes with Javascript support bundled, I assume this is meant to make it as functional as Webstorm for any secondary Javascript in a primarily C/C++ project.)

Same steps as before - increase CLion max heap size for indexing, run ./configure manually, then make in the OS terminal.

Opening up an arbitrary .cc or .h file under src/, CLion does at least seem to have full awareness of the C++ code like an IDE is supposed to, so it'll warn about variables being unused, collapse sections enclosed by macros, let you Cmd-Click to jump to functions etc. Not all of the warnings are correct though - it warned about unused variables that were clearly in use within the same function. I'm thinking this is probably something going wrong in the project setup rather than a bug in CLion.

CLion prefers to use CMake when available, so it may show its banner that says "CMake project is not loaded". This might be because some of node's dependencies in the deps folder, like uv, do use CMake and CLion has somehow detected them. As far as I can tell node is just a plain-old Make project, not CMake, so I'm not sure what to do about that yet.

That's as far as I've got for now. I notice a lot of the tests are split up like this: [1 .js file, 1 .c file, 1 binding.gyp]. So those will be... 'interesting' to get running.

@chriskilding
Copy link

chriskilding commented Aug 12, 2021

An important consideration for the Jetbrains stack is that they are Java-based, so they don't have an embedded Node interpreter for analysing the JS part of the Node codebase. You have to set the path for node and the path for a package manager (either npm, yarn, or pnpm) in the settings dialog (see attached screenshot).

One way is to make CLion use a self-hosted approach: use the project's compiled node executable as the project's Node interpreter.

This can be done by setting the node path to the built node executable in the Release directory:

Self-hosted node

(The node project doesn't say anything about an NPM executable so I've had to leave that part blank.)

Although convenient, the self-hosted approach is fragile because:

  • if you run make clean the node executable will disappear
  • if you make significant changes to Node, this could break the parts that CLion uses

Therefore the self-hosted approach would need more thought if it is indeed the way to go (for example, building a stable copy of node source that CLion can depend on, before the developer goes changing node source and recompiling it).

@anonrig
Copy link
Member

anonrig commented Aug 17, 2022

Did anybody successfully have auto-completion and proper type checking with C++ on Clion, Webstorm, or VSCode?

Clion is really bad at the moment.

Screen Shot 2022-08-17 at 10 38 00 AM

@himself65
Copy link
Member Author

Did anybody successfully have auto-completion and proper type checking with C++ on Clion, Webstorm, or VSCode?

Clion is really bad at the moment.

Screen Shot 2022-08-17 at 10 38 00 AM

https://blog.actorsfit.com/a?ID=00001-6eb92d18-01ad-4a2e-aa98-68b61795ceb2

@himself65
Copy link
Member Author

I ran successfully about two years ago on my old ubuntu machine. Let me record the whole process today to let people know how-to

@himself65
Copy link
Member Author

himself65 commented Sep 6, 2022

I ran ./configure && make -j32 before enter CLion. then make out as root dir in makefile configure panel

Screenshot from 2022-09-05 22-59-27

@himself65
Copy link
Member Author

Screencast.from.09-05-2022.11.01.11.PM.webm

and everything looks good for my workspace

@himself65
Copy link
Member Author

https://youtu.be/0YCDRS0AdXM

@himself65 himself65 linked a pull request Sep 6, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants