Open kathrynkodama opened 1 year ago
Encountered the same bug on Dependency Injection diagnostics, this quick-fix does not appear: https://github.com/eclipse/lsp4jakarta/blob/main/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.core/src/main/java/org/eclipse/lsp4jakarta/jdt/core/di/ConflictInjectMultipleConstructorQuickFix.java
See the expected quick-fixes: https://github.com/eclipse/lsp4jakarta/blob/main/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/src/main/java/org/eclipse/lsp4jakarta/jdt/di/DependencyInjectionTest.java
[Error - 1:30:22 PM] Request textDocument/codeAction failed.
Message: Request jakarta/java/codeaction failed with message: java.lang.NullPointerException: Cannot invoke "Object.toString()" because the return value of "org.eclipse.lsp4j.Diagnostic.getData()" is null
Code: -32603
Same error reported Jsonb Diagnostics, see this class for the expected quick fixes: https://github.com/eclipse/lsp4jakarta/blob/main/jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/src/main/java/org/eclipse/lsp4jakarta/jdt/jsonb/JsonbDiagnosticsCollectorTest.java
Diagnostic received from LS:
[Trace - 2:31:17 PM] Received response 'workspace/executeCommand - (28)' in 604ms.
Result: [
{
"uri": "file:///Users/tl/jakarta-sample/src/main/java/io/openliberty/sample/jakarta/beanvalidation/FieldConstraintValidation1.java",
"diagnostics": [
{
"range": {
"start": {
"line": 7,
"character": 16
},
"end": {
"line": 7,
"character": 23
}
},
"severity": 1,
"code": "FixTypeOfElement",
"source": "jakarta-bean-validation",
"message": "The @AssertTrue annotation can only be used on boolean and Boolean type fields.",
"data": "AssertTrue"
}
]
}
]
diagnostic sent along with quick fix request, one field missing:
[Trace - 2:58:14 PM] Sending request 'textDocument/codeAction - (62)'.
Params: {
"textDocument": {
"uri": "file:///Users/tl/jakarta-sample/src/main/java/io/openliberty/sample/jakarta/beanvalidation/FieldConstraintValidation1.java"
},
"range": {
"start": {
"line": 7,
"character": 16
},
"end": {
"line": 7,
"character": 23
}
},
"context": {
"diagnostics": [
{
"range": {
"start": {
"line": 7,
"character": 16
},
"end": {
"line": 7,
"character": 23
}
},
"message": "The @AssertTrue annotation can only be used on boolean and Boolean type fields.",
"code": "FixTypeOfElement",
"severity": 1,
"source": "jakarta-bean-validation"
}
],
"only": [
"quickfix"
],
"triggerKind": 1
}
}
Opened issue: https://github.com/microsoft/vscode/issues/181166
@dshimo recorded hitting this issue in #460
Affects diagnostics that use: -ScopeDeclarationQuickFix -BeanValidationQuickFix -JsonbTransientAnnotationQuickFix -ManagedBeanConstructorQuickFix -ManagedBeanQuickFix -PersistenceAnnotationQuickFix -CompleteFilterAnnotationQuickFix -CompleteServletAnnotationQuickFix
To reproduce Using jakarta-sample project in VS Code (Mac OS), trying to trigger quick-fixes on bean validation constraint diagnostics: