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