Skip to content

Add Java Support #693

@gbroques

Description

@gbroques

It'd be nice to have Java support as well.

JShell, the Java REPL introduced in Java 9, should allow a stdio client.

We'd want to pass the classpath for the project somehow.

nvim-jdtls uses the Java language server to get this:
https://github.com/mfussenegger/nvim-jdtls/blob/c23f200fee469a415c77265ca55b496feb646992/lua/jdtls/util.lua#L122-L151

It then launches jshell passing the CLASSPATH as an environment variable:
https://github.com/mfussenegger/nvim-jdtls/blob/c23f200fee469a415c77265ca55b496feb646992/lua/jdtls.lua#L1144-L1163

Alternatively, jshell accepts a --class-path flag.

I'm not sure yet, but we may need to process all the import_declarations (the tree-sitter node for an import statement) in the current buffer to execute snippets.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions