1 % IDE support in the JDK
   2 
   3 ## Introduction
   4 
   5 When you are familiar with building and testing the JDK, you may want to
   6 configure an IDE to work with the source code. The instructions differ a bit
   7 depending on whether you are interested in working with the native (C/C++) or
   8 the Java code.
   9 
  10 ### IDE support for native code
  11 
  12 There are a few ways to generate IDE configuration for the native sources,
  13 depending on which IDE to use.
  14 
  15 #### Visual Studio Code
  16 
  17 The make system can generate a [Visual Studio Code](https://code.visualstudio.com)
  18 workspace that has C/C++ source indexing configured correctly, as well as
  19 launcher targets for tests and the Java launcher. After configuring, a workspace
  20 for the configuration can be generated using:
  21 
  22 ```shell
  23 make vscode-project
  24 ```
  25 
  26 This creates a file called `jdk.code-workspace` in the build output folder. The
  27 full location will be printed after the workspace has been generated. To use it,
  28 choose `File -> Open Workspace...` in Visual Studio Code.
  29 
  30 ##### Alternative indexers
  31 
  32 The main `vscode-project` target configures the default C++ support in Visual
  33 Studio Code. There are also other source indexers that can be installed, that
  34 may provide additional features. It's currently possible to generate
  35 configuration for two such indexers, [clangd](https://clang.llvm.org/extra/clangd/)
  36 and [rtags](https://github.com/Andersbakken/rtags). These can be configured by
  37 appending the name of the indexer to the make target, such as:
  38 
  39 ```shell
  40 make vscode-project-clangd
  41 ```
  42 
  43 Additional instructions for configuring the given indexer will be displayed
  44 after the workspace has been generated.
  45 
  46 #### Visual Studio
  47 
  48 This section is a work in progress.
  49 
  50 ```shell
  51 make ide-project
  52 ```
  53 
  54 #### Compilation Database
  55 
  56 The make system can generate generic native code indexing support in the form of
  57 a [Compilation Database](https://clang.llvm.org/docs/JSONCompilationDatabase.html)
  58 that can be used by many different IDEs and source code indexers.
  59 
  60 ```shell
  61 make compile-commands
  62 ```
  63 
  64 It's also possible to generate the Compilation Database for the HotSpot source
  65 code only, which is a bit faster as it includes less information.
  66 
  67 ```shell
  68 make compile-commands-hotspot
  69 ```
  70 
  71 ### IDE support for Java code
  72 
  73 This section is a work in progress.