在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:georgewfraser/java-language-server开源软件地址:https://github.com/georgewfraser/java-language-server开源编程语言:Java 96.0%开源软件介绍:Java compiler APILanguage Server for Java using theA Java language server based on v3.0 of the protocol and implemented using the Java compiler API. Installation (VS Code)Install from the VS Code marketplace Installation (other editors)Vim (with vim-lsc)
Note: This tool is not compatible with vim-lsp as it only supports LSPv2.0. Sublime 3 (with LSP)
IssuesFeaturesJavadocSignature helpAutocomplete symbols (with auto-import)Autocomplete membersGo-to-definitionFind symbolsLintType information on hoverFind referencesDebugUsageThe language server will provide autocomplete and other features using:
SettingsIf the language server doesn't detect your external dependencies automatically, you can specify them using .vscode/settings.json {
"java.externalDependencies": [
"junit:junit:jar:4.12:test", // Maven format
"junit:junit:4.12" // Gradle-style format is also allowed
]
} If all else fails, you can specify the java class path manually: {
"java.classPath": [
"lib/some-dependency.jar"
]
} You can generate a list of external dependencies using your build tool:
The Java language server will look for the dependencies you specify in
DesignThe Java language server uses the Java compiler API to implement language features like linting, autocomplete, and smart navigation, and the language server protocol to communicate with text editors like VSCode. Incremental updatesThe Java compiler API provides incremental compilation at the level of files: you can create a long-lived instance of the Java compiler, and as the user edits, you only need to recompile files that have changed. The Java language server optimizes this further by focusing compilation on the region of interest by erasing irrelevant code. For example, suppose we want to provide autocomplete after class Printer {
void printFoo() {
System.out.println("foo");
}
void printBar() {
System.out.println("bar");
}
void main() {
print // Autocomplete here
}
} None of the code inside class Printer {
void printFoo() {
}
void printBar() {
}
void main() {
print // Autocomplete here
}
} For most requests, the vast majority of code can be erased, dramatically speeding up compilation. LogsThe java service process will output a log file to stderr, which is visible in VSCode using View / Output, under "Java". ContributingInstallingBefore installing locally, you need to install prerequisites: npm, maven, protobuf. For example on Mac OS, you can install these using Brew:
You also need to have Java 13 installed. Point the
Assuming you have these prerequisites, you should be able to install locally using:
At the time of this writing, the build only works on Mac, because of the way it uses JLink. However, it would be straightforward to fix this by changing EditingPlease run ./configure before your first commit to install a pre-commit hook that formats the code. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论