Deenu488 / CodeAssist-Unofficial

GNU General Public License v3.0
128 stars 29 forks source link

Libraries classpath missing #18

Open BanDroid opened 4 months ago

BanDroid commented 4 months ago

Note that Issues are for bugs only. Use the discussions tab for feature requests.

Describe the bug i use latest ci release, in my kotlin and java code, any dependency package cant be recognized in diagnostic.

To Reproduce Steps to reproduce the behavior:

  1. just open any kotlin/java file.

Expected behavior the diagnostic did not shown error.

Screenshots Screenshot_20240305-233328.png

Smartphone (please complete the following information):

BanDroid commented 4 months ago

e3333a2c5e9533d0b909900648ea9c072e01ffa5

already fixed dependency package name, but now the problem is the object of our own package.

i have created MyClass.kt but the completion and diagnostic doesn't know it was exists.

Screenshot_20240306-052401.png

Screenshot_20240306-052350.png

Screenshot_20240306-052330.png

Screenshot_20240306-052355.png

Deenu488 commented 4 months ago

kotlin and java dir are being added to the claspath, in alpha03 version I checked it is same java file are being added to the claspath, but I don't know why it's not working with compiler

BanDroid commented 4 months ago

i realize now java is working just fine, the only thing that doesn't recognized was kotlin classes.

i've checked that any of kotlin classes i created is not exist in build folder, it seems the incremental compiler ignored kotlin files except when build.

Screenshot_20240306-140841.png

there is no MyClass.class anywhere inside build, but the build is just fine and could use the class.

Deenu488 commented 4 months ago

With java completion I think it adds the kotlin class only and but it give error in diagnostic but we can build it Maybe it needs to include runtime jar (kotlin classes) then it will work normally with java And also maybe kotlin Compiler will able to get it's own classes by .jar

Deenu488 commented 4 months ago

I tried to build jar package while analysis but they are in classPath but it didn't recognise it

BanDroid commented 4 months ago

even after build and kotlin files compiled to .class in build, it still cant be recognized by lsp, this problem is also occuring with viewbinding classes, if i create a new layout file, i have to compile first to make the class generated, after i create a layout file, there's a Binding class generated in /build/injected/view_binding but not in /build/view_binding, it seems you have to remove /build/view_binding and keep /build/injected/view_binding to make it work.

Deenu488 commented 4 months ago

Since I Screenshot_2024-03-07-17-20-34-927_com tyron code implemented realtime compilation, when you start editing it will start to compile and package as jar, and they are added to classPath but when changes it doesn't update compiler configuration , so they are packaged as realtime View binding updates with real time in kotlin it will not work

BanDroid commented 4 months ago

in this commit 4cdecbbc34e136c7ab70a305e430e50e285ddb67

the first problem exist again, doesn't want to recognize dependency package.

BanDroid commented 4 months ago

when you start editing it will start to compile and package as jar, and they are added to classPath but when changes it doesn't update compiler configuration , so they are packaged as realtime

i dont have this in latest commits, there's no kotlin_runtime

Deenu488 commented 4 months ago

enable isCompilerEnabled in .idea/app_compiler_settings.json and try editing kotlin files

BanDroid commented 4 months ago

enable isCompilerEnabled in .idea/app_compiler_settings.json and try editing kotlin files

tried multiple times with different new projects, result are no kotlin_runtime folder generated.

Deenu488 commented 4 months ago

Which Android version

BanDroid commented 4 months ago

Which Android version

10, infinix note 8 64-bit

Deenu488 commented 4 months ago

@BanDroid Uninstall and try again with latest version

BanDroid commented 4 months ago

still the same, and now the autocomplete window does not even show

Screenshot_20240311-010750.png

Screenshot_20240311-010746.png

Screenshot_20240311-010808.png

Deenu488 commented 4 months ago

@BanDroid Try this

class App {

}

{ "java": { "isCompilerEnabled": "false", "sourceCompatibility": "1.8", "targetCompatibility": "1.8" }, "kotlin": { "isCompilerEnabled": "true", "isKotlinCompletionV2": "false", "jvmTarget": "1.8" } }

implementation 'org.jetbrains.kotlin:kotlin-stdlib:2.0.0-Beta4'

Project - Application Kotlin

BanDroid commented 4 months ago

still hasn't resolved this, tried with many things, 1 thing that could be a resolver was to build the apk first, it will generate .class of kotlin classes, but after i exit codeassist and reopen the project, still cant recognized by the lsp.

also, kotlin_runtime still not exist even i turn on any settings in compiler_settings.json.

BanDroid commented 4 months ago

improvement:

i just got this kotlin_runtime folder, somehow it does work now (after updating to new release version from release download page, not ci build) but still giving error (not warning) in diagnostic about metadata.

edit: sometimes other class couldn't be recognized, but then its own class file is recognized (see third image). this also happen in MainActivity.kt, it shows MainActivity class but not MyClass.

Screenshot_20240317-053510.png

Screenshot_20240317-053444.png

Screenshot_20240317-065215.png

Deenu488 commented 4 months ago

Great 😃 I think kotlin compiler trying to compile the source but it's giving error metadata different versions , so it fails and not successfully compile So we used different kotlin compiler that compiles with different version 2.0.0-Beta4 I tried to add skip metadata but doesn't work in compilation environment

BanDroid commented 4 months ago

maybe set isCompilerEnabled to true should be the default when creating new project, i had to force stop CA to make this changes applied somehow.

Deenu488 commented 4 months ago

New Latest kotlin compiler is experimental it may give some errors