Skip to content

tigersoldier/JavaComp

Repository files navigation

Build Status

JavaComp - a Java Language Server

JavaComp implements Language Server Protocol for Java language. It provides language editing features such as code completion, showing method signatures and jumping to definitions to editors that support the protocol.

Features

Code completion

Code completion screencast

Go to definition

Go to definition screencast

Symbol documentation

Symbol documentation screencast

How to install

See the installation guide for your editor:

Customization

You can put a javacomp.json file under the project root directory to customize the behavior of JavaComp.

Example javacomp.json file content:

{
  "logPath": "/tmp/javacomp.log",
  "logLevel": "fine",
  "typeIndexFiles": ["typeindeces/guava.json"],
  "ignorePaths": ["*.bak", ".*"]
}

The schema of the JSON is defined by the InitializationOptions class in InitializeParams.java. The initializationOptions field of the initialize Request accepts the same format as javacomp.json. Editor plugins can set initializationOptions to customize JavaComp. If both javacomp.json and initializationOptions exist, initializationOptions overrides javacomp.json.

Below are supported options. The source of truth of the supported options is the

logPath

(String) Path of the log file. If not set, logs are not written to any file.

logLevel

(String) The minimum log level. Logs with the level and above will be logged.

Possible values are: severe, warning, info, fine, finer, finest.

ignorePaths

(String) Pattern of paths that JavaComp should ignore.

The patterns are valid Java path glob patterns defined by the documentation of java.nio.file.FileSystem#getPathMatcher without glob: prefix.

When determing whether a path of a file or directory should be ignored, the path is converted into 2 froms: the filename and pseudo absolute path. A pseudo absolute path is the path without the prefix of project root path. For example, if a path is /root/path/foo/bar and the project root path is /root/path, its pseudo absolute path is /foo/bar. If a path is not under project root, its pseudo absolute path is itself.

Both filename of the path and its pseudo absolute path are checked by all ignore path patterns. If either form matches any of the patterns, the path is ignored.

typeIndexFiles

(Array of strings) A list of file paths that contains additional type indeces generated by the Indexer tool.

The path can be either relative to the project root path, or an absolute path.

Documentation

See our Wiki page.