Closed loralei28 closed 4 days ago
https://github.com/user-attachments/assets/dda5bdb4-67c2-4b34-b9aa-fcad49d4a91e
Seems to be working for me. @loralei28 , @testforstephen what am I missing here. Also, if you activate Java: Open Java Language Server Log File
, are there any errors in that log ? Does the "Extension Host" logs (from the dropdown) of the Output view indicate any errors ?
Could definitely see it being a regression of https://github.com/eclipse-jdtls/eclipse.jdt.ls/pull/3229 though.
I reproduced this issue, it seems like it's Windows-specific
Here is a sample file:
package functions;
import io.quarkus.funqy.Funq;
/**
* Your Function class
*/
public class Function {
/**
* Use the Quarkus Funqy extension for our function. This function simply echoes its input
* @param input a Java bean
* @return a Java bean
*/
@Funq
public Output function(Input input) {
// Add business logic here
bar();
return null;
}
}
Here is a trace of what the server returns for the quickfix:
[Trace - 10:45:24 AM] Received response 'codeAction/resolve - (119)' in 5ms.
Result: {
"title": "Create method 'bar()'",
"kind": "quickfix",
"diagnostics": [
{
"range": {
"start": {
"line": 18,
"character": 8
},
"end": {
"line": 18,
"character": 11
}
},
"severity": 1,
"code": "67108964",
"source": "Java",
"message": "The method bar() is undefined for the type Function"
}
],
"edit": {
"changes": {},
"documentChanges": [
{
"textDocument": {
"version": null,
"uri": "file:///C:/Users/david/Documents/Programming/TestProjects/quarkus-func/src/main/java/functions/Function.java"
},
"edits": [
{
"snippet": {
"value": "${1:bar}();\n\n return null;\n }\n\n ${2|private,public,protected|} ${3:void} ${1:bar}() {\n // TODO Auto-generated method stub\n throw new UnsupportedOperationException(\"Unimplemented method 'bar'\");\n }"
},
"range": {
"start": {
"line": 18,
"character": 8
},
"end": {
"line": 21,
"character": 5
}
},
"newText": ""
}
]
}
]
},
"command": {
"title": "refresh Diagnostics",
"command": "java.project.refreshDiagnostics",
"arguments": [
"file:///c%3A/Users/david/Documents/Programming/TestProjects/quarkus-func/src/main/java/functions/Function.java",
"thisFile",
false,
true
]
}
}
I'm seeing the exact same response, only file URI is different (I'm on Linux). When you have time, i would try to validate whether
--- yours.txt 2024-09-26 11:17:54.751100419 -0400
+++ mine.txt 2024-09-26 11:23:02.727259008 -0400
@@ -1,4 +1,4 @@
-[Trace - 10:45:24 AM] Received response 'codeAction/resolve - (119)' in 5ms.
+[Trace - 11:22:36] Received response 'codeAction/resolve - (458)' in 39ms.
Result: {
"title": "Create method 'bar()'",
"kind": "quickfix",
@@ -26,7 +26,7 @@
{
"textDocument": {
"version": null,
- "uri": "file:///C:/Users/david/Documents/Programming/TestProjects/quarkus-func/src/main/java/functions/Function.java"
+ "uri": "file:///home/rgrunber/sample-projects/my-quarkus-example/src/main/java/functions/Function.java"
},
"edits": [
{
@@ -53,7 +53,7 @@
"title": "refresh Diagnostics",
"command": "java.project.refreshDiagnostics",
"arguments": [
- "file:///c%3A/Users/david/Documents/Programming/TestProjects/quarkus-func/src/main/java/functions/Function.java",
+ "file:///home/rgrunber/sample-projects/my-quarkus-example/src/main/java/functions/Function.java",
"thisFile",
false,
true
Definitely seems like something on the client side that's treated differently.
Update: Maybe the LSP text document URI is slightly different than the converted to VS Code text document URI ? https://github.com/redhat-developer/vscode-java/blob/29329d8b0d60fd7c99deaedd55408e45d080898a/src/extension.ts#L334 .
Looks like snippet
text of "codeAction/resolve" response is not respected on Windows, and it still applies newText
, which is ""
and behaves as delete.
Hello.
After upgrading the extension to version 1.35.0 in Windows 11 environment, Create local Variable '???' does not work properly.
However, there was no problem in Ubuntu 22.04 environment.
Windows 11 + Ext Ver. 1.35.0 (It became "")
https://github.com/user-attachments/assets/362dac89-a6e0-4e40-9c03-d2595178659c
Ubuntu 22.04 + Ext Ver. 1.35.0
https://github.com/user-attachments/assets/f97e8079-5c60-4487-b43c-3d8184919673
@testforstephen , can you try the PR and let me know if it resolves it for you ? It should prevent newText
from being populated.
If someone could try out java-win32-x64-1.36.0-179.vsix (on windows) from https://github.com/rgrunber/vscode-java/releases/tag/v1.36.0 and let me know if that fixes things for them, that would help.
In my Windows 11 environment, installing 1.36.0 did not solve the problem.
@testforstephen , I think we should just disable the feature ( snippetEditSupport
in extendedClientCapabilities
) until there's some kind of fix upstream / we find a proper solution for windows. Could we do a bug-fix release for Monday ?
@testforstephen , I think we should just disable the feature (
snippetEditSupport
inextendedClientCapabilities
) until there's some kind of fix upstream / we find a proper solution for windows. Could we do a bug-fix release for Monday ?
+1
I found the root cause on Windows. It's our code :
URI from the language server is : file:///C:/Users/user/projects/foo/Test.java
URI after converting lsp.codeaction to a vscode.codeaction is : file:///C%3A/Users/user/projects/foo/Test.java
The conversion seems to be done by the asCodeAction
conversion call that occurs higher up.
We can probably fix this by calling Uri.parse(..)
on the initial Uri we retrieve from the language server.
Could someone try out https://github.com/rgrunber/vscode-java/releases/tag/v1.36.0 . It should contain a new vsix there that should work on Windows.
@rgrunber It seems to be working:
https://github.com/user-attachments/assets/7fbd98d7-8cf2-4574-9fb7-f3347b97efa5
There's a bug related to the indentation of the inserted content. At the end of the video I formatted the document manually and the content seems to be correct after that
There's a bug related to the indentation of the inserted content. At the end of the video I formatted the document manually and the content seems to be correct after that
The v1.35.1 release yesterday worked well in a Windows environment. Thank you for your support. 👍
Environment
Steps To Reproduce
class
andmain
code snippet to generate codebar();
Current Result
”Create method 'bar()'“ does not work and will delete "bar()"