Java compiled code extension

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

Java Language Support for Visual Studio Code

License

redhat-developer/vscode-java

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Sign In Required

Please sign in to use Codespaces.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching Xcode

If nothing happens, download Xcode and try again.

Launching Visual Studio Code

Your codespace will open once ready.

There was a problem preparing your codespace, please try again.

Latest commit

…ated for them (#3207) * Reload the cached classfile sources when new source attachment is updated for them Signed-off-by: Jinbo Wang

Git stats

Files

Failed to load latest commit information.

README.md

Language support for Java ™ for Visual Studio Code

Provides Java ™ language support via Eclipse ™ JDT Language Server, which utilizes Eclipse ™ JDT, M2Eclipse and Buildship.

  1. Install the Extension
  2. On the following platforms, the extension should activate without any setup : win32-x64 , darwin-x64 , darwin-arm64 , linux-x64 , linux-arm64 .
    If on another platform, or using the «universal» version, you can set a Java Development Kit. It must be Java 17 or above.
  3. Optionally, download and install a Java Development Kit for your project (Java 1.5 or above is supported). See Project JDKs for more details
  4. Extension is activated when you first access a Java file
    • Recognizes projects with Maven or Gradle build files in the directory hierarchy.
  • Supports code from Java 1.5 to Java 20
  • Maven pom.xml project support
  • Gradle project support (with experimental Android project import support)
  • Standalone Java files support
  • As-you-type reporting of parsing and compilation errors
  • Code completion
  • Code/Source actions / Refactoring
  • Javadoc hovers
  • Organize imports
    • triggered manually or on save
    • when pasting code into a java file with Ctrl+Shift+v ( Cmd+Shift+v on Mac).

    To launch and debug your Java programs, it’s recommended you install Java Debug Extension for Visual Studio Code.

    See the changelog for the latest release. You might also find useful information in the project Wiki.

    Now that Java extension will publish platform specific versions, it will embed a JRE for supported platforms such as win32-x64 , linux-x64 , linux-arm64 , darwin-x64 , darwin-arm64 . The embedded JRE is used to launch the Language Server for Java. Users are only responsible for configuring Project JDKs to compile your Java projects.

    The following part is only kept for the universal version without embedded JRE.

    The tooling JDK will be used to launch the Language Server for Java. And by default, will also be used to compile your projects. Java 17 is the minimum required version.

    • the JDK_HOME environment variable
    • the JAVA_HOME environment variable
    • on the current system path

    If you need to compile your projects against a different JDK version, it’s recommended you configure the java.configuration.runtimes property in your user settings, eg:

    "java.configuration.runtimes": [ < "name": "JavaSE-1.8", "path": "/path/to/jdk-8", >, < "name": "JavaSE-11", "path": "/path/to/jdk-11", >, < "name": "JavaSE-20", "path": "/path/to/jdk-20", "default": true >, ]

    The default runtime will be used when you open standalone Java files.

    The following commands are available:

    • Switch to Standard Mode : switches the Java Language Server to Standard mode. This command is only available when the Java Language Server is in LightWeight mode.
    • Java: Reload Projects ( Shift+Alt+U ): It forces project configuration / classpath updates (eg. dependency changes or Java compilation level), according to the project build descriptor.
    • Java: Import Java Projects into Workspace : detects and imports all the Java projects into the Java Language Server workspace.
    • Java: Open Java Language Server Log File : opens the Java Language Server log file, useful for troubleshooting problems.
    • Java: Open Java Extension Log File : opens the Java extension log file, useful for troubleshooting problems.
    • Java: Open All Log Files : opens both the Java Language Server log file and the Java extension log file.
    • Java: Force Java Compilation ( Shift+Alt+B ): manually triggers compilation of the workspace.
    • Java: Rebuild Projects : manually triggers a full build of the selected projects.
    • Java: Open Java Formatter Settings : opens the Eclipse formatter settings. Creates a new settings file if none exists.
    • Java: Clean Java Language Server Workspace : cleans the Java language server workspace.
    • Java: Attach Source : attaches a jar/zip source to the currently opened binary class file. This command is only available in the editor context menu.
    • Java: Add Folder to Java Source Path : adds the selected folder to its project source path. This command is only available in the file explorer context menu and only works for unmanaged folders.
    • Java: Remove Folder from Java Source Path : removes the selected folder from its project source path. This command is only available in the file explorer context menu and only works for unmanaged folders.
    • Java: List All Java Source Paths : lists all the Java source paths recognized by the Java Language Server workspace.
    • Java: Show Build Job Status : shows the Java Language Server job status in Visual Studio Code terminal.
    • Java: Go to Super Implementation : goes to the super implementation for the current selected symbol in editor.
    • Java: Restart Java Language Server : restarts the Java language server.

    Supported VS Code settings

    The following settings are supported:

    • java.home : Deprecated, please use ‘java.jdt.ls.java.home’ instead. Absolute path to JDK home folder used to launch the Java Language Server. Requires VS Code restart.
    • java.jdt.ls.lombokSupport.enabled : Whether to enable lombok support. Defaults to true .
    • java.jdt.ls.vmargs : Extra VM arguments used to launch the Java Language Server. Requires VS Code restart.
    • java.errors.incompleteClasspath.severity : Specifies the severity of the message when the classpath is incomplete for a Java file. Supported values are ignore , info , warning , error .
    • java.trace.server : Traces the communication between VS Code and the Java language server.
    • java.configuration.updateBuildConfiguration : Specifies how modifications on build files update the Java classpath/configuration. Supported values are disabled (nothing happens), interactive (asks about updating on every modification), automatic (updating is automatically triggered).
    • java.configuration.maven.userSettings : Path to Maven’s user settings.xml.
    • java.configuration.checkProjectSettingsExclusions : Deprecated, please use ‘java.import.generatesMetadataFilesAtProjectRoot’ to control whether to generate the project metadata files at the project root. And use ‘files.exclude’ to control whether to hide the project metadata files from the file explorer. Controls whether to exclude extension-generated project settings files ( .project , .classpath , .factorypath , .settings/ ) from the file explorer. Defaults to false .
    • java.referencesCodeLens.enabled : Enable/disable the references code lenses.
    • java.implementationsCodeLens.enabled : Enable/disable the implementations code lenses.
    • java.signatureHelp.enabled : Enable/disable signature help support (triggered on ( ).
    • java.signatureHelp.description.enabled : Enable/disable to show the description in signature help. Defaults to false .
    • java.contentProvider.preferred : Preferred content provider (see 3rd party decompilers available in vscode-java-decompiler).
    • java.import.exclusions : Exclude folders from import via glob patterns. Use ! to negate patterns to allow subfolders imports. You have to include a parent directory. The order is important.
    • java.import.gradle.enabled : Enable/disable the Gradle importer.
    • Specify the Gradle distribution used by the Java extension:
      • java.import.gradle.wrapper.enabled : Use Gradle from the ‘gradle-wrapper.properties’ file. Defaults to true .
      • java.import.gradle.version : Use Gradle from the specific version if the Gradle wrapper is missing or disabled.
      • java.import.gradle.home : Use Gradle from the specified local installation directory or GRADLE_HOME if the Gradle wrapper is missing or disabled and no ‘java.import.gradle.version’ is specified.
      • auto : Use off only when using Visual Studio Code — Insiders, other platform will defaults to insertBestGuessedArguments .
      • off : Method arguments will not be inserted during completion.
      • insertParameterNames : The parameter names will be inserted during completion.
      • insertBestGuessedArguments : The best guessed arguments will be inserted during completion according to the code context.
      • notification : Show the build status via progress notification.
      • terminal : Show the build status via terminal.
      • off : Do not show any build status.

      For backward compatibility, this setting also accepts boolean value, where true has the same meaning as notification and false has the same meaning as off .

      • Standard : Provides full features such as intellisense, refactoring, building, Maven/Gradle support etc.
      • LightWeight : Starts a syntax server with lower start-up cost. Only provides syntax features such as outline, navigation, javadoc, syntax errors. The lightweight mode won’t load thirdparty extensions, such as java test runner, java debugger, etc.
      • Hybrid : Provides full features with better responsiveness. It starts a standard language server and a secondary syntax server. The syntax server provides syntax features until the standard server is ready. And the syntax server will be shutdown automatically after the standard server is fully ready.

      Default launch mode is Hybrid . Legacy mode is Standard

      • afterCursor : Insert the generated code after the member where the cursor is located.
      • beforeCursor : Insert the generated code before the member where the cursor is located.
      • lastMember : Insert the generated code as the last member of the target type.
      • auto
      • on
      • off
      • Windows: First use «$APPDATA\\.jdt\\index» , or «~\\.jdt\\index» if it does not exist
      • macOS: «~/Library/Caches/.jdt/index»
      • Linux: First use «$XDG_CACHE_HOME/.jdt/index» , or «~/.cache/.jdt/index» if it does not exist
Оцените статью