Open opensource-philosophy opened 1 year ago
can you do M-x lsp-toggle-trace-io
and then look for the log buffer content?
Thanks for the quick answer! Here is the log:
Found the following clients for/path/to/file.java: (server-id jdtls, priority 0)
The following clients were selected based on priority: (server-id jdtls, priority 0)
Found the following clients for/path/to/file.java: (server-id jdtls, priority 0)
The following clients were selected based on priority: (server-id jdtls, priority 0)
Found the following clients for/path/to/file.java: (server-id jdtls, priority 0)
The following clients were selected based on priority: (server-id jdtls, priority 0)
Found the following clients for/path/to/file.java: (server-id jdtls, priority 0)
The following clients were selected based on priority: (server-id jdtls, priority 0)
Found the following clients for/path/to/file.java: (server-id jdtls, priority 0)
The following clients were selected based on priority: (server-id jdtls, priority 0)
Found the following clients for/path/to/file.java: (server-id jdtls, priority 0)
The following clients were selected based on priority: (server-id jdtls, priority 0)
Found the following clients for/path/to/file.java: (server-id jdtls, priority 0)
The following clients were selected based on priority: (server-id jdtls, priority 0)
This is not the log we are looking for. It is named like this: *lsp-log: jdtls:108480*
Sorry, there was a buffer lsp-log
of which I copied the contents. This should be the correct log:
[Trace - 07:47:33 ] Sending request 'initialize - (7)'.
Params: {
"processId": null,
"rootPath": "/root/path",
"clientInfo": {
"name": "emacs",
"version": "GNU Emacs 28.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.36, cairo version 1.17.6)\n of 2023-01-03"
},
"rootUri": "file:///path/to/file/folder",
"capabilities": {
"workspace": {
"workspaceEdit": {
"documentChanges": true,
"resourceOperations": [
"create",
"rename",
"delete"
]
},
"applyEdit": true,
"symbol": {
"symbolKind": {
"valueSet": [
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26
]
}
},
"executeCommand": {
"dynamicRegistration": false
},
"didChangeWatchedFiles": {
"dynamicRegistration": true
},
"workspaceFolders": true,
"configuration": true,
"codeLens": {
"refreshSupport": true
},
"fileOperations": {
"didCreate": false,
"willCreate": false,
"didRename": true,
"willRename": true,
"didDelete": false,
"willDelete": false
}
},
"textDocument": {
"declaration": {
"linkSupport": true
},
"definition": {
"linkSupport": true
},
"implementation": {
"linkSupport": true
},
"typeDefinition": {
"linkSupport": true
},
"synchronization": {
"willSave": true,
"didSave": true,
"willSaveWaitUntil": true
},
"documentSymbol": {
"symbolKind": {
"valueSet": [
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26
]
},
"hierarchicalDocumentSymbolSupport": true
},
"formatting": {
"dynamicRegistration": true
},
"rangeFormatting": {
"dynamicRegistration": true
},
"rename": {
"dynamicRegistration": true,
"prepareSupport": true
},
"codeAction": {
"dynamicRegistration": true,
"isPreferredSupport": true,
"codeActionLiteralSupport": {
"codeActionKind": {
"valueSet": [
"",
"quickfix",
"refactor",
"refactor.extract",
"refactor.inline",
"refactor.rewrite",
"source",
"source.organizeImports"
]
}
},
"resolveSupport": {
"properties": [
"edit",
"command"
]
},
"dataSupport": true
},
"completion": {
"completionItem": {
"snippetSupport": true,
"documentationFormat": [
"markdown",
"plaintext"
],
"resolveAdditionalTextEditsSupport": true,
"insertReplaceSupport": true,
"deprecatedSupport": true,
"resolveSupport": {
"properties": [
"documentation",
"detail",
"additionalTextEdits",
"command"
]
},
"insertTextModeSupport": {
"valueSet": [
1,
2
]
}
},
"contextSupport": true
},
"signatureHelp": {
"signatureInformation": {
"parameterInformation": {
"labelOffsetSupport": true
}
}
},
"documentLink": {
"dynamicRegistration": true,
"tooltipSupport": true
},
"hover": {
"contentFormat": [
"markdown",
"plaintext"
]
},
"foldingRange": {
"dynamicRegistration": true
},
"callHierarchy": {
"dynamicRegistration": false
},
"publishDiagnostics": {
"relatedInformation": true,
"tagSupport": {
"valueSet": [
1,
2
]
},
"versionSupport": true
},
"linkedEditingRange": {
"dynamicRegistration": true
}
},
"window": {
"workDoneProgress": true,
"showMessage": null,
"showDocument": {
"support": true
}
}
},
"initializationOptions": {
"settings": {
"java": {
"codeGeneration": {
"toString": {
"limitElements": 0,
"listArrayContents": true,
"skipNullValues": false,
"codeStyle": "STRING_CONCATENATION",
"template": "${object.className} [${member.name()}=${member.value}, ${otherMembers}]"
},
"generateComments": false,
"useBlocks": false,
"hashCodeEquals": {
"useInstanceof": false,
"useJava7Objects": false
}
},
"format": {
"onType": {
"enabled": true
},
"comments": {
"enabled": true
},
"enabled": true,
"tabSize": 4,
"insertSpaces": true
},
"progressReports": {
"enabled": true
},
"foldingRange": {
"enabled": true
},
"completion": {
"importOrder": [
"java",
"javax",
"com",
"org"
],
"favoriteStaticMembers": [
"org.junit.Assert.*",
"org.junit.Assume.*",
"org.junit.jupiter.api.Assertions.*",
"org.junit.jupiter.api.Assumptions.*",
"org.junit.jupiter.api.DynamicContainer.*",
"org.junit.jupiter.api.DynamicTest.*",
"org.mockito.Mockito.*",
"org.mockito.ArgumentMatchers.*",
"org.mockito.Answers.*"
],
"guessMethodArguments": true,
"overwrite": true,
"enabled": true,
"filteredTypes": [
"java.awt.*",
"com.sun.*"
],
"maxResults": 10
},
"maxConcurrentBuilds": 1,
"autobuild": {
"enabled": true
},
"selectionRange": {
"enabled": true
},
"import": {
"exclusions": [
"**/node_modules/**",
"**/.metadata/**",
"**/archetype-resources/**",
"**/META-INF/maven/**"
],
"maven": {
"enabled": true
},
"gradle": {
"enabled": true,
"wrapper": {
"enabled": true
},
"offline": {
"enabled": false
}
}
},
"saveActions": {
"organizeImports": true
},
"implementationsCodeLens": {
"enabled": false
},
"signatureHelp": {
"enabled": true
},
"referencesCodeLens": {
"enabled": false
},
"maven": {
"downloadSources": false,
"updateSnapshots": false
},
"trace": {
"server": "off"
},
"configuration": {
"updateBuildConfiguration": "automatic",
"checkProjectSettingsExclusions": true
},
"errors": {
"incompleteClasspath": {
"severity": "warning"
}
},
"dependency": {
"packagePresentation": "flat"
},
"project": {
"importHint": true,
"importOnFirstTimeStartup": "automatic",
"referencedLibraries": [
"lib/**/*.jar"
],
"resourceFilters": [
"node_modules",
".metadata",
"archetype-resources",
"META-INF/maven"
]
},
"imports": {
"gradle": {
"wrapper": {
"checksums": []
}
}
},
"sources": {
"organizeImports": {
"staticStarThreshold": 99,
"starThreshold": 99
}
},
"server": {
"launchMode": "Hybrid"
},
"showBuildStatusOnStart": {
"enabled": false
}
}
},
"extendedClientCapabilities": {
"progressReportProvider": true,
"classFileContentsSupport": true,
"classFileContentsSupport": true,
"overrideMethodsPromptSupport": true,
"hashCodeEqualsPromptSupport": true,
"advancedOrganizeImportsSupport": true,
"generateConstructorsPromptSupport": true,
"generateToStringPromptSupport": true,
"advancedGenerateAccessorsSupport": true,
"advancedExtractRefactoringSupport": true,
"moveRefactoringSupport": true,
"resolveAdditionalTextEditsSupport": true
},
"bundles": [
"/home/user/.emacs.d/.cache/lsp/eclipse.jdt.ls/bundles/com.microsoft.java.test.plugin-0.28.0.jar",
"/home/user/.emacs.d/.cache/lsp/eclipse.jdt.ls/bundles/com.microsoft.jdtls.ext.core-0.5.1.jar",
"/home/user/.emacs.d/.cache/lsp/eclipse.jdt.ls/bundles/dg.jdt.ls.decompiler.cfr-0.0.2-201802221740.jar",
"/home/user/.emacs.d/.cache/lsp/eclipse.jdt.ls/bundles/dg.jdt.ls.decompiler.common-0.0.2-201802221740.jar",
"/home/user/.emacs.d/.cache/lsp/eclipse.jdt.ls/bundles/dg.jdt.ls.decompiler.fernflower-0.0.2-201802221740.jar",
"/home/user/.emacs.d/.cache/lsp/eclipse.jdt.ls/bundles/dg.jdt.ls.decompiler.procyon-0.0.2-201802221740.jar",
"/home/user/.emacs.d/.cache/lsp/eclipse.jdt.ls/bundles/io.projectreactor.reactor-core.jar",
"/home/user/.emacs.d/.cache/lsp/eclipse.jdt.ls/bundles/java.debug.plugin.jar",
"/home/user/.emacs.d/.cache/lsp/eclipse.jdt.ls/bundles/jdt-ls-commons.jar",
"/home/user/.emacs.d/.cache/lsp/eclipse.jdt.ls/bundles/jdt-ls-extension.jar",
"/home/user/.emacs.d/.cache/lsp/eclipse.jdt.ls/bundles/org.apiguardian_1.1.0.v20190826-0900.jar",
"/home/user/.emacs.d/.cache/lsp/eclipse.jdt.ls/bundles/org.eclipse.jdt.junit4.runtime_1.1.1200.v20200214-0716.jar",
"/home/user/.emacs.d/.cache/lsp/eclipse.jdt.ls/bundles/org.eclipse.jdt.junit5.runtime_1.0.900.v20200513-0617.jar",
"/home/user/.emacs.d/.cache/lsp/eclipse.jdt.ls/bundles/org.junit.jupiter.api_5.6.0.v20200203-2009.jar",
"/home/user/.emacs.d/.cache/lsp/eclipse.jdt.ls/bundles/org.junit.jupiter.engine_5.6.0.v20200203-2009.jar",
"/home/user/.emacs.d/.cache/lsp/eclipse.jdt.ls/bundles/org.junit.jupiter.migrationsupport_5.6.0.v20200203-2009.jar",
"/home/user/.emacs.d/.cache/lsp/eclipse.jdt.ls/bundles/org.junit.jupiter.params_5.6.0.v20200203-2009.jar",
"/home/user/.emacs.d/.cache/lsp/eclipse.jdt.ls/bundles/org.junit.platform.commons_1.6.0.v20200203-2009.jar",
"/home/user/.emacs.d/.cache/lsp/eclipse.jdt.ls/bundles/org.junit.platform.engine_1.6.0.v20200203-2009.jar",
"/home/user/.emacs.d/.cache/lsp/eclipse.jdt.ls/bundles/org.junit.platform.launcher_1.6.0.v20200203-2009.jar",
"/home/user/.emacs.d/.cache/lsp/eclipse.jdt.ls/bundles/org.junit.platform.runner_1.6.0.v20200203-2009.jar",
"/home/user/.emacs.d/.cache/lsp/eclipse.jdt.ls/bundles/org.junit.platform.suite.api_1.6.0.v20200203-2009.jar",
"/home/user/.emacs.d/.cache/lsp/eclipse.jdt.ls/bundles/org.junit.vintage.engine_5.6.0.v20200203-2009.jar",
"/home/user/.emacs.d/.cache/lsp/eclipse.jdt.ls/bundles/org.opentest4j_1.2.0.v20190826-0900.jar",
"/home/user/.emacs.d/.cache/lsp/eclipse.jdt.ls/bundles/org.reactivestreams.reactive-streams.jar"
],
"workspaceFolders": [
"file:///path/to/file/folder",
"file:///home/user",
"file:///other/workspace/folder"
]
},
"workDoneToken": "1",
"workspaceFolders": [
{
"uri": "file:///path/to/file/folder",
"name": "Desktop"
},
{
"uri": "file:///home/user",
"name": "user"
},
{
"uri": "file:///other/workspace/folder",
"name": "Organisation"
}
]
}
So it crashes right away... Can you do M-x lsp-workspace-folders-remove and keep only one of the folders preferably the simplest project? Also, can you check if there is a log in lsp-java-workspace-dir? I don't know what to try next...
I deleted every folder available using M-x lsp-workspace-folders-remove
and reinitialized the project. I am already working with an example project with the simplest possible structure. There is just an empty .gitkeep
file in lsp-java-workspace-dir
. The problem is neither the Emacs Version (28.2) nor the java Version (19)?
It is not the emacs version. It is something in jdtls/java version. Can you try a different java version? (make sure to delete lsp-java-workspace-dir when switching versions). Can you remove that setting as well:
(setq lsp-java-configuration-runtimes '[(:name "JavaSE-19"
:path "/usr/lib/jvm/java-19-openjdk/"
:default t)]))
How do I use a different java version? I now changed
(setenv "JAVA_HOME" "/usr/lib/jvm/java-11-openjdk")
(setq lsp-java-java-path "/usr/lib/jvm/java-11-openjdk/bin/java")
The directories exist, of course. I commented out the code you highlighted, deleted the workspace-dir and re-installed the jdtls, but the problem persists.
You use update-java-alternatives
binary (available on debian). This will allow also using M-x lsp-start-plain
. (And again, don't forget to flush lsp-java-workspace-dir after each switch)
Now I am on arch-linux, so there is no update-java-alternatives
, for me but It seems to be archlinux-java. I successfully changed the version, adjusted the environment and java path, deleted the workspace and still got the same problem.
Reinstalling jdts worked for me: lsp-install-server
For me just sudo archlinux-java set java-17-openjdk
helped. 11 was not working.
run lsp-update-server
This problem seems closely related to #293.
When trying to start the
lsp-java
server, I receive the messageWhen looking in the
Messages
buffer, I readThe
stderr
buffer readsM-: lsp-java--ls-command
results inManually executing the code gives
I have multiple versions of Java installed, but the current version (found out by
which java
) isjava-19-openjdk
. I am using the code below to setup my Emacs forlsp-java
.As you can see, I am already trying to make every path explicit. What I have also tried is …
What could be the problem?