Repository navigation
Conversation
Fixes redhat-developer#2117 With a debug adapter that supports setVariable, Set Value was enabled on the result of Evaluate Expression and of the value popup of an expression. Pressing Enter threw a NullPointerException in DAPValueModifier.setValue: such a result has no parent variablesReference, which setVariable needs. Nothing was sent to the debug adapter, and the editor stayed open. DAPValue.getModifier now returns no modifier for a value without a parent variablesReference, so IntelliJ disables Set Value for it. A variable of the Variables view, and a variable inside an Evaluate result, can be set as before.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2123 +/- ##
==========================================
+ Coverage 50.48% 50.66% +0.17%
==========================================
Files 816 816
Lines 33871 33897 +26
Branches 5287 6977 +1690
==========================================
+ Hits 17101 17174 +73
+ Misses 14114 14059 -55
- Partials 2656 2664 +8 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
lagergren
added a commit
to lagergren/lsp4ij
that referenced
this pull request
Nov 23, 2026
…request With a debug adapter that supports 'setExpression' (supportsSetExpression), "Set Value..." is offered on the result of Evaluate Expression and on the top value of an expression's value popup, and assigns the new value to the evaluated expression. redhat-developer#2123 hid it there, since 'setVariable' can't name a value without a parent 'variablesReference'. DAPValue.getModifier chooses the request: - a variable with a parent 'variablesReference' is set with 'setVariable' as before; only when the adapter doesn't support 'setVariable' is it set with 'setExpression' of its 'evaluateName', as in VS Code (debugModel.ts), and of the resolved variable's for a lazy variable; - a value without a parent, such as an Evaluate result, is set with 'setExpression' of its expression, and not at all without it; - a value marked read-only is never set. The request sends the expression, the typed value, the frame and the session's value format. Its answer updates the shown variable: value, type, variablesReference (0 when left out, so the children reload), named and indexed counts, presentationHint, memoryReference and valueLocationReference. IntelliJ hides "Set Value..." on a watch, where editing changes the watch's expression, so watches don't change. Fixes redhat-developer#2109
lagergren
added a commit
that referenced
this pull request
Nov 24, 2026
…request With a debug adapter that supports 'setExpression' (supportsSetExpression), "Set Value..." is offered on the result of Evaluate Expression and on the top value of an expression's value popup, and assigns the new value to the evaluated expression. #2123 hid it there, since 'setVariable' can't name a value without a parent 'variablesReference'. DAPValue.getModifier chooses the request: - a variable with a parent 'variablesReference' is set with 'setVariable' as before; only when the adapter doesn't support 'setVariable' is it set with 'setExpression' of its 'evaluateName', as in VS Code (debugModel.ts), and of the resolved variable's for a lazy variable; - a value without a parent, such as an Evaluate result, is set with 'setExpression' of its expression, and not at all without it; - a value marked read-only is never set. The request sends the expression, the typed value, the frame and the session's value format. Its answer updates the shown variable: value, type, variablesReference (0 when left out, so the children reload), named and indexed counts, presentationHint, memoryReference and valueLocationReference. IntelliJ hides "Set Value..." on a watch, where editing changes the watch's expression, so watches don't change. Fixes #2109
This was referenced Nov 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2117
What
With a debug adapter that supports
setVariable, Set Value was enabled on an Evaluate result. Pressing Enter threw aNullPointerExceptioninDAPValueModifier.setValue: nothing was sent to the adapter, and the editor stayed open.Cause
DAPDebuggerEvaluator.evaluatecreates the result with no parentvariablesReference:new DAPValue(stackFrame, variable, null).DAPValue.getModifierreturned a modifier whenever the adapter supportssetVariableand the value isn't read-only.DAPValueModifier.setValuepasses the nullIntegertoDAPClient.setVariable(String, int, String), and unboxing it throws.Change
DAPValue.getModifierreturns null for a value without a parentvariablesReference, so IntelliJ disables Set Value for it.docs/dap/UserGuide.mdsays so under "Set value".setExpressionfor these values.Behaviour changes
variablesReference.XSetValueAction.update, in 2024.2, 2025.3 and 2026.3).Test
DAPSetValueOfEvaluateResultSessionTest(new) attaches a debug session to a DAP server in the test process, which supportssetVariableand notsetExpression:testSetValueIsNotOfferedForAnEvaluateResult: with the result selected, theXDebugger.SetValueaction is disabled, the value has no modifier, and nosetVariableis sent. Onmainit fails with "Set Value… isn't offered for an Evaluate result".testSetValueOfAVariableSendsSetVariableWithTheReferenceOfItsParent(control): Set Value is enabled on a local, and Enter sendssetVariablewith the reference of the Locals scope. It passes before and after.maindaptests with the fix