Git Product home page Git Product logo

Comments (3)

themkat avatar themkat commented on June 15, 2024

The language server sadly don't have good support for Kotlin Native, or anything other than Kotlin JVM to be honest 🙁 I have not experimented much with Kotlin Native myself, but think that it should be possible to get completion at least (based on my small experience looking into Kotlin Multiplatform projects). Hopefully we can improve the support a bit.

A few question that might help me (or someone else) look into this issue 🙂

  1. Could you create a very small example project that replicates the issue? Just so we have something to experiment with. This can be a zip-file, a github repo or something else you are comfortable sending.
  2. What does the language server logs look like? If you could share them, that would be awesome!
  3. If you have any system info to share, like your JVM type (Temurin, Coretto, something else?) and Java version? Maybe also some minor system specs.

from kotlin-language-server.

TeamPuzel avatar TeamPuzel commented on June 15, 2024

Okay, here's the code:

code.zip

It creates a window for a second then closes (although I don't know how to use pointers and structs from kotlin at the moment so the window is never moved to front)

I can't test this on Windows or Linux so if you're not using macOS you will have to change the build.gradle.kts to build for something else.

Logs
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Dec 03, 2023 2:33:21 PM org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint lambda$recursiveFindRpcMethods$2
SEVERE: A delegate object is null, jsonrpc methods of 'public default org.eclipse.lsp4j.services.NotebookDocumentService org.eclipse.lsp4j.services.LanguageServer.getNotebookDocumentService()' are ignored
[Info  - 2:33:21 PM] main      Adding script definitions [null]
[Info  - 2:33:21 PM] main      Kotlin Language Server: Version 1.3.7
[Error - 2:33:21 PM] main      A delegate object is null, jsonrpc methods of 'public default org.eclipse.lsp4j.services.NotebookDocumentService org.eclipse.lsp4j.services.LanguageServer.getNotebookDocumentService()' are ignored
[Info  - 2:33:21 PM] main      Connected to client
[Info  - 2:33:21 PM] async0    Database has the correct version 3 and will be used as-is
[Info  - 2:33:21 PM] async0    Adding workspace folder GameTest
[Info  - 2:33:21 PM] async0    Adding .../GameTest/build.gradle.kts, .../kotlin/main.kt under /Users/teampuzel/Temp/GameTest to source path
[Info  - 2:33:21 PM] async0    Searching for dependencies and Java sources in workspace root /Users/teampuzel/Temp/GameTest
[Info  - 2:33:21 PM] async0    Classpath has not changed. Fetching from cache
[Info  - 2:33:21 PM] async0    Adding [/opt/homebrew/Cellar/kotlin/1.9.21/libexec/lib/kotlin-stdlib.jar] to class path
[Info  - 2:33:21 PM] async0    Update build script path
[Info  - 2:33:21 PM] async0    Build script classpath has not changed. Fetching from cache
[Info  - 2:33:21 PM] async0    Adding 748 files to build script class path
[Info  - 2:33:21 PM] async0    Reinstantiating compiler
[Info  - 2:33:21 PM] async0    Adding script definitions [null]
[Info  - 2:33:21 PM] async0    Configuring Kotlin DSL script templates...
[Info  - 2:33:21 PM] async0    Adding script definitions [null, KotlinInitScript, KotlinSettingsScript, KotlinBuildScript]
[Info  - 2:33:22 PM] client    Updated configuration: {"kotlin":{"java":{"home":"","opts":""},"languageServer":{"enabled":true,"path":"","transport":"stdio","port":0,"debugAttach":{"enabled":false,"port":5005,"autoSuspend":false}},"trace":{"server":"off"},"compiler":{"jvm":{"target":"default"}},"linting":{"debounceTime":250},"indexing":{"enabled":true},"completion":{"snippets":{"enabled":true}},"debugAdapter":{"enabled":true,"path":""},"debounceTime":250,"externalSources":{"useKlsScheme":true,"autoConvertToKotlin":true},"snippetsEnabled":true}}
[Info  - 2:33:24 PM] async3    Find symbols in .../kotlin/main.kt
[Info  - 2:33:24 PM] async3    Finished in 2 ms
[Info  - 2:33:24 PM] async3    Ranged semantic tokens in .../kotlin/main.kt
[Info  - 2:33:24 PM] async3    Found 10 tokens
[Info  - 2:33:24 PM] async3    Finished in 5 ms
[Info  - 2:33:24 PM] async3    Full semantic tokens in .../kotlin/main.kt
[Info  - 2:33:24 PM] async3    Found 15 tokens
[Info  - 2:33:24 PM] async3    Finished in 3 ms
[Info  - 2:33:24 PM] async4    Updating symbol index...
[Info  - 2:33:24 PM] async4    Updated symbol index in 8 ms! (1 symbol(s))
[Info  - 2:33:24 PM] async4    Updating symbol index...
[Info  - 2:33:24 PM] async4    Updated symbol index in 0 ms! (2 symbol(s))
[Info  - 2:33:24 PM] async4    Updating symbol index...
[Info  - 2:33:24 PM] async4    Updated symbol index in 0 ms! (3 symbol(s))
[Error - 2:33:24 PM] org.jetbrains.kotlin.codegen.CompilationException: Back-end (JVM) Internal error: Failed to generate function main
File being compiled: (7,1) in //Users/teampuzel/Temp/GameTest/src/nativeMain/kotlin/main.kt
The root cause java.lang.IllegalStateException was thrown at: org.jetbrains.kotlin.codegen.state.KotlinTypeMapper$typeMappingConfiguration$1.processErrorType(KotlinTypeMapper.kt:124)
[Error - 2:33:24 PM] 	at org.jetbrains.kotlin.codegen.MemberCodegen.genSimpleMember(MemberCodegen.java:206)
[Error - 2:33:24 PM] 	at org.jetbrains.kotlin.codegen.PackagePartCodegen.generateBody(PackagePartCodegen.java:98)
[Error - 2:33:24 PM] 	at org.jetbrains.kotlin.codegen.MemberCodegen.generate(MemberCodegen.java:132)
[Error - 2:33:24 PM] 	at org.jetbrains.kotlin.codegen.PackageCodegenImpl.generateFile(PackageCodegenImpl.java:167)
[Error - 2:33:24 PM] 	at org.jetbrains.kotlin.codegen.PackageCodegenImpl.generate(PackageCodegenImpl.java:70)
[Error - 2:33:24 PM] 	at org.jetbrains.kotlin.codegen.DefaultCodegenFactory.generatePackage(CodegenFactory.kt:143)
[Error - 2:33:24 PM] 	at org.jetbrains.kotlin.codegen.DefaultCodegenFactory.invokeLowerings(CodegenFactory.kt:122)
[Error - 2:33:24 PM] 	at org.jetbrains.kotlin.codegen.CodegenFactory.generateModule(CodegenFactory.kt:44)
[Error - 2:33:24 PM] 	at org.jetbrains.kotlin.codegen.KotlinCodegenFacade.compileCorrectFiles(KotlinCodegenFacade.java:45)
[Error - 2:33:24 PM] 	at org.jetbrains.kotlin.codegen.KotlinCodegenFacade.compileCorrectFiles(KotlinCodegenFacade.java:54)
[Error - 2:33:24 PM] 	at org.javacs.kt.compiler.Compiler.generateCode(Compiler.kt:585)
[Error - 2:33:24 PM] 	at org.javacs.kt.SourcePath.save(SourcePath.kt:277)
[Error - 2:33:24 PM] 	at org.javacs.kt.SourcePath.saveAllFiles(SourcePath.kt:289)
[Error - 2:33:24 PM] 	at org.javacs.kt.KotlinTextDocumentService$lintAll$1.invoke(KotlinTextDocumentService.kt:270)
[Error - 2:33:24 PM] 	at org.javacs.kt.KotlinTextDocumentService$lintAll$1.invoke(KotlinTextDocumentService.kt:268)
[Error - 2:33:24 PM] 	at org.javacs.kt.util.Debouncer.submitImmediately$lambda$1(Debouncer.kt:27)
[Error - 2:33:24 PM] 	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:577)
[Error - 2:33:24 PM] 	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
[Error - 2:33:24 PM] 	at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
[Error - 2:33:24 PM] 	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
[Error - 2:33:24 PM] 	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
[Error - 2:33:24 PM] 	at java.base/java.lang.Thread.run(Thread.java:1589)
[Error - 2:33:24 PM] Caused by: java.lang.IllegalStateException: Error type encountered: [Error type: Unresolved type for kotlinx.cinterop.ExperimentalForeignApi] (ErrorType).
[Error - 2:33:24 PM] 	at org.jetbrains.kotlin.codegen.state.KotlinTypeMapper$typeMappingConfiguration$1.processErrorType(KotlinTypeMapper.kt:124)
[Error - 2:33:24 PM] 	at org.jetbrains.kotlin.load.kotlin.DescriptorBasedTypeSignatureMappingKt.mapType(descriptorBasedTypeSignatureMapping.kt:83)
[Error - 2:33:24 PM] 	at org.jetbrains.kotlin.codegen.state.KotlinTypeMapper.mapType(KotlinTypeMapper.kt:276)
[Error - 2:33:24 PM] 	at org.jetbrains.kotlin.codegen.state.KotlinTypeMapper.mapType$default(KotlinTypeMapper.kt:267)
[Error - 2:33:24 PM] 	at org.jetbrains.kotlin.codegen.state.KotlinTypeMapper.mapType(KotlinTypeMapper.kt)
[Error - 2:33:24 PM] 	at org.jetbrains.kotlin.codegen.AnnotationCodegen.genAnnotation(AnnotationCodegen.java:385)
[Error - 2:33:24 PM] 	at org.jetbrains.kotlin.codegen.AnnotationCodegen.genAnnotations(AnnotationCodegen.java:153)
[Error - 2:33:24 PM] 	at org.jetbrains.kotlin.codegen.FunctionCodegen.generateMethodAnnotationsIfRequired(FunctionCodegen.java:309)
[Error - 2:33:24 PM] 	at org.jetbrains.kotlin.codegen.FunctionCodegen.generateMethod(FunctionCodegen.java:226)
[Error - 2:33:24 PM] 	at org.jetbrains.kotlin.codegen.FunctionCodegen.generateMethod(FunctionCodegen.java:166)
[Error - 2:33:24 PM] 	at org.jetbrains.kotlin.codegen.FunctionCodegen.gen(FunctionCodegen.java:137)
[Error - 2:33:24 PM] 	at org.jetbrains.kotlin.codegen.MemberCodegen.genSimpleMember(MemberCodegen.java:200)
[Error - 2:33:24 PM] 	... 21 more
[Info  - 2:33:24 PM] debounce0 Linting .../kotlin/main.kt
[Info  - 2:33:24 PM] async4    Updating full symbol index...
[Info  - 2:33:24 PM] debounce0 Reported 17 diagnostics in .../kotlin/main.kt
[Info  - 2:33:24 PM] async3    Full semantic tokens in .../kotlin/main.kt
[Info  - 2:33:24 PM] async3    Found 30 tokens
[Info  - 2:33:24 PM] async3    Finished in 2 ms

System specs:

M2 Max 32gb
macOS 14.2 Sonoma (developer beta 23C5055b)

Java (output of java --version):

openjdk 19.0.2 2023-01-17
OpenJDK Runtime Environment Zulu19.32+13-CA (build 19.0.2+7)
OpenJDK 64-Bit Server VM Zulu19.32+13-CA (build 19.0.2+7, mixed mode, sharing)

from kotlin-language-server.

fwcd avatar fwcd commented on June 15, 2024

Kotlin/Native isn't really supported yet (see #11), but if you wish to use the language server anyway, you can now use

{
  "kotlin.diagnostics.enabled": false
}

in your settings to turn off the errors while still getting basic code completion for standard library functions etc.

from kotlin-language-server.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.