Jonathan M
Jonathan M

Reputation: 17451

How to get VSCode to recognize Kotlin classes in Java code?

I'm using VSCode. I have the following in myApi.kt:

package com.mycompany.myproject.myapi

data class MyClass(
    val accountNumber: String,
    val state: String,
    val country: String
)

...and I have the following in myApp.java:

import com.mycompany.myproject.myapi.*;

MyClass myObject = new MyClass();

Compilation and execution are all fine. The only problem is VSCode gives me a red squigly underline beneath references to MyClass in the java file. Hovering over it, it says:

MyClass cannot be resolved to a type Java(16777218)

I have the Kotlin plug-in installed in VSCode.

How can I get VSCode to recognize this Kotlin class in my java file?

Upvotes: 4

Views: 3363

Answers (1)

Barry Wang
Barry Wang

Reputation: 1469

This is not yet supported based on this open issue

Upvotes: 4

Related Questions