-
Notifications
You must be signed in to change notification settings - Fork 150
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add vscode-kotlin extension #611
Conversation
Can one of the admins verify this patch? |
1 similar comment
Can one of the admins verify this patch? |
Hello, reopening this with new extension from fwcd. I would like to discuss here this issue I found in extension activation giving this error:
Adding logs from Workspace: https://pastebin.com/RDMmmz9g
It looks like it is trying to create the extension directory into Theia $HOME$HOME, but it is not using Is that expected? |
@blues-man you have the extension trying to create a folder after being initialized by che: private async downloadServer(downloadUrl: string, version: string, status: Status): Promise<void> {
if (!(await fsExists(this.installDir))) {
await fs.promises.mkdir(this.installDir, { recursive: true });
} the commands (like mkdir) run by the extension are executed within its sidecar context, so if you mkdir -p the /home/theia/home/theia/fwcd.kotlin it results in this being downloaded inside the sidecar: Conclusion: try to find the settings in the extensions package.json that will let you customize the path where the extension is trying to download the language server. Or debug the extension to see how you can "help" it figure the right path string (seeing what variables can be used as a base for the folder calculation). |
if this to be solved serving the language and debug servers inside the sidecar, this is what I did:
{
"kotlin.languageServer.path": "/home/theia/kotlin_ls/fwcd.kotlin/langServerInstall/server/bin/kotlin-language-server",
"kotlin.debugAdapter.path": "/home/theia/kotlin_ls/fwcd.kotlin/debugAdapterInstall/adapter/bin/kotlin-debug-adapter"
} |
Signed-off-by: Natale Vinto <nvinto@redhat.com>
@gattytto I don't get why |
I was able to workaround it adding a volume in the sidecar into plugin's
Don't know if this could be a suitable option? |
for starters, the runtime execution provider that runs the mkdir command prepends /home/theia by default, then the extension tries to download a zip file to that location, which didn't get created for some reason. this is an example devfile for making the extension bypass the check and just look for the binaries in the specific path, then you may need to make a sidecar that includes those files: metadata:
name: kotlin
projects:
- name: kotlin-examples
source:
location: 'https://github.com/Kotlin/kotlin-examples'
type: git
clonePath: kotlin
components:
- id: eclipse/che-theia/next
type: cheEditor
- type: chePlugin
reference: >-
https://raw.githubusercontent.com/gattytto/cheplugins/master/kotlin/0.2.18/meta.yaml
alias:
kotlin
preferences:
kotlin.languageServer.path: /home/theia/kotlin_ls/fwcd.kotlin/langServerInstall/server/bin/kotlin-language-server
kotlin.debugAdapter.path: /home/theia/kotlin_ls/fwcd.kotlin/debugAdapterInstall/adapter/bin/kotlin-debug-adapter
apiVersion: 1.0.0 |
@blues-man I'm trying to build an android native bin using kotlin and gradlew and it's asking me for the and sdk, do you think there could be a branch of the cli image with android sdks included? how is the android dependencies to be dealt with when it comes to language-server and import tracking? I'm not good with java stuff and my android is rusty about the "dependencies", this is what the author's language server repo says about the subject: so I'm not sure there is an "imports" resolution here |
I have now also tried to add the java extension as you did in your devfile-registry pull request, the extension has the same behavior around the home/theia duplication @ericwill this seems to affect both kotlin and java-quarkus extensions metadata:
name: kotlin
projects:
- name: kotlin-examples
source:
location: 'https://github.com/Kotlin/kotlin-examples'
type: git
clonePath: kotlin
components:
- id: redhat/quarkus-java11/latest
type: chePlugin
- mountSources: true
memoryLimit: 2048Mi
type: dockerimage
volumes:
- name: gradle
containerPath: /home/gradle/.gradle
image: 'quay.io/eclipse/che-java11-gradle:nightly'
alias: gradle
env:
- value: /home/gradle/.gradle
name: GRADLE_USER_HOME
- value: /home/gradle
name: HOME
- value: >-
-XX:MaxRAMPercentage=50 -XX:+UseParallelGC -XX:MinHeapFreeRatio=10
-XX:MaxHeapFreeRatio=20 -XX:GCTimeRatio=4
-XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true
-Xms20m -Djava.security.egd=file:/dev/./urandom
name: JAVA_OPTS
- value: >-
-XX:MaxRAMPercentage=50 -XX:+UseParallelGC -XX:MinHeapFreeRatio=10
-XX:MaxHeapFreeRatio=20 -XX:GCTimeRatio=4
-XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true
-Xms20m -Djava.security.egd=file:/dev/./urandom
name: JAVA_TOOL_OPTIONS
- id: eclipse/che-theia/next
type: cheEditor
- type: chePlugin
reference: >-
https://raw.githubusercontent.com/gattytto/cheplugins/master/kotlin/0.2.18/meta.yaml
alias: kotlin
apiVersion: 1.0.0 |
The workaround mentioned above worked, however I can't have |
It looks it misses
Is it possible to add it to the sidecar with some extension or should it be added to a new sidecar like |
Signed-off-by: Natale Vinto <nvinto@redhat.com>
I managed to have it working with 2 adds into
|
Signed-off-by: Natale Vinto <nvinto@redhat.com>
@blues-man can you test the imports with a gradle based project using the gradle standard quay.io/eclipse/che-sidecar-java:11-7bd8c8c? |
I have tested the following changes to the plugin.yaml for having a working gradle example: apiVersion: v2
publisher: fwcd
name: vscode-kotlin
version: 0.2.18
type: VS Code extension
displayName: Kotlin
title: Kotlin tooling for VS Code
description: This plug-in provides support for Kotlin development.
icon: https://raw.githubusercontent.com/JetBrains/logos/master/web/kotlin/kotlin.svg
repository: https://github.com/fwcd/vscode-kotlin/
category: Language
spec:
containers:
- image: "quay.io/eclipse/che-sidecar-java:11-7bd8c8c"
name: vscode-quarkus-kotlin
memoryLimit: "2500Mi"
env:
- value: "/home/theia/.gradle"
name: GRADLE_USER_HOME
- value: "/home/theia"
name: HOME
volumes:
- mountPath: "/home/theia/.m2"
name: m2
- mountPath: "/home/theia/home/theia"
name: vscode-theia-workaround
extensions:
- https://github.com/fwcd/vscode-kotlin/releases/download/0.2.18/kotlin-0.2.18.vsix |
Hello @gattytto thanks for sharing it! I tried generating the Kotlin Quarkus quickstart as gradle project and that works fine with those env you tried, in this way we don't have to use any custom sidecar and any Devfile would work straightforward if and only if, they point to Gradle projects. I can update the PR code with that, I would like to know what's the best option here @ericwill @svor ? |
@blues-man I think the extension is not fully functional, but it's hard for me to reproduce, could you please come to mattermost so we can chat about it more fluidly?. |
Which parts are missing? |
repository: https://github.com/fwcd/vscode-kotlin/ | ||
category: Language | ||
spec: | ||
containers: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
env:
- value: "/home/theia/.gradle"
name: GRADLE_USER_HOME
outline, kotiln dsl (.kts files) linting. |
there's a setting I have to try next 'kotlin.compiler.jvm.target' : "1.8" .. putting it here for the record |
this line helps to prevent the language server from breaking after issuing the F1=>"Kotlin: Restart the Language Server". |
I think that this extension, notwithstanding some bugs yet to correct, is the most complete for VSCode, maybe we can ship the che plugin with the maven sidecar and the gradle envs, so it will support both, releasing this version and updating with new ones. What do you think? |
@blues-man I think that the cleaner solution would be to have this implemented first, to make the workarounds (like settings*2 for this and this bins to avoid downloads from the extension) maintainable in new versions of the extension and a kotlin specific sidecar with tags for both gradle and maven (and then maybe a java11 gradle/maven che images to use for base-image) |
FYI |
gladly, time to revive this @ericwill @blues-man |
TODO: check .kts support status |
@blues-man: PR needs rebase. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Signed-off-by: Natale Vinto nvinto@redhat.com
What does this PR do?
Add language support for Kotlin using VS Code extension
fwcd.kotlin
TODO
Resolve issue on extension activation