Skip to content

Commit 1bc5aa4

Browse files
daplffwcd
authored andcommitted
Set up JDT.LS extension for Java-Kotlin interop
From fwcd/kotlin-language-server#334
0 parents  commit 1bc5aa4

File tree

19 files changed

+1712
-0
lines changed

19 files changed

+1712
-0
lines changed

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
node_modules
2+
target
3+
*.vsix
4+
.idea
5+
*.iml
6+
.DS_Store
7+
**/.DS_Store
8+
jars
9+
.vscode/settings.json

.vscode/launch.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// A launch configuration that compiles the extension and then opens it inside a new window
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
{
6+
"version": "0.2.0",
7+
"configurations": [
8+
{
9+
"name": "Extension",
10+
"type": "extensionHost",
11+
"request": "launch",
12+
"runtimeExecutable": "${execPath}",
13+
"args": [
14+
"--extensionDevelopmentPath=${workspaceFolder}"
15+
],
16+
"outFiles": [
17+
"${workspaceFolder}/out/**/*.js"
18+
]
19+
}
20+
]
21+
}

.vscodeignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.vscode/**
2+
.idea/**
3+
*.iml
4+
javaConfig.json
5+
tsconfig.json
6+
org.javacs.kt.jdt.ls.extension
7+
build.sh
8+
.gitignore

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# VSCode Extension for Java + Kotlin
2+
3+
A VSCode extension that enchances [vscode-java](https://github.com/redhat-developer/vscode-java) and [vscode-kotlin](https://github.com/fwcd/vscode-kotlin) with java + kotlin interoperability. This uses a JDT LS extension with a custom project importer to allow Java code to have access to Kotlin code.
4+
5+
**Disclaimer**: This is very experimental, but it seems to work for small maven and gradle projects at least.
6+
7+
## Setup (for now)
8+
9+
For now, to set this up, you need to run the `build.sh` script in this directory to package the JDT LS extension. Afterwards, you should run `npm install` to install the extension dependencies.
10+
11+
To debug, you can use F5 on VSCode, as with any other extension. To package the extension you can use `vsce package`.

build.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
rm -fr jars
3+
mkdir -p jars
4+
5+
cd jdt-ls-extension
6+
mvn clean package
7+
cp org.javacs.kt.jdt.ls.extension/target/org.javacs.kt.jdt.ls.extension-1.0.0-SNAPSHOT.jar ../jars/jdt-ls-extension.jar

javaConfig.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"projects": [
3+
"./jdt-ls-extension/org.javacs.kt.jdt.ls.extension"
4+
],
5+
"targetPlatform": "./jdt-ls-extension/target.target"
6+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
Manifest-Version: 1.0
2+
Bundle-ManifestVersion: 2
3+
Bundle-Name: org.javacs.kt.jdt.ls.extension
4+
Bundle-SymbolicName: org.javacs.kt.jdt.ls.extension;singleton:=true
5+
Bundle-Version: 1.0.0.qualifier
6+
Bundle-Vendor: VMware, Inc.
7+
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
8+
Require-Bundle: org.eclipse.jdt.ls.core,
9+
org.eclipse.core.runtime,
10+
org.eclipse.jdt.core,
11+
org.eclipse.core.resources,
12+
org.eclipse.m2e.core;resolution:=optional,
13+
org.eclipse.m2e.jdt;resolution:=optional,
14+
org.eclipse.m2e.maven.runtime;resolution:=optional,
15+
org.eclipse.lsp4j,
16+
org.eclipse.lsp4j.jsonrpc
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
source.. = src/
2+
output.. = bin/
3+
bin.includes = META-INF/,\
4+
.,\
5+
plugin.xml
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<?eclipse version="3.4"?>
3+
<plugin>
4+
<extension
5+
id="importers"
6+
point="org.eclipse.jdt.ls.core.importers">
7+
<importer
8+
id = "kotlinGradleImporter"
9+
order = "125"
10+
class = "org.javacs.kt.jdt.ls.extension.KotlinGradleImporter"/>
11+
<importer
12+
id = "kotlinMavenImporter"
13+
order = "150"
14+
class = "org.javacs.kt.jdt.ls.extension.KotlinMavenImporter"/>
15+
</extension>
16+
</plugin>
17+
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<project xmlns="https://maven.apache.org/POM/4.0.0"
2+
xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="https://maven.apache.org/POM/4.0.0
4+
https://maven.apache.org/maven-v4_0_0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
<packaging>eclipse-plugin</packaging>
7+
<groupId>org.javacs.kt</groupId>
8+
<artifactId>org.javacs.kt.jdt.ls.extension</artifactId>
9+
<version>1.0.0-SNAPSHOT</version>
10+
<name>org.javacs.kt.jdt.ls.extension</name>
11+
12+
<parent>
13+
<groupId>org.javacs.kt</groupId>
14+
<artifactId>jdt-ls-extension-parent</artifactId>
15+
<version>1.0.0-SNAPSHOT</version>
16+
<relativePath>../pom.xml</relativePath>
17+
</parent>
18+
</project>

0 commit comments

Comments
 (0)