Skip to content

Commit af8f155

Browse files
authored
[lldb-dap] Don't send expanded descriptions for "hover" expressions (#92726)
VSCode will automatically ask for the children (in structured form) so there's no point in sending the textual representation. This can make displaying hover popups for complex variables with complicated data formatters much faster. See discussion on #77026 for context.
1 parent d89f200 commit af8f155

File tree

3 files changed

+10
-27
lines changed

3 files changed

+10
-27
lines changed

lldb/test/API/tools/lldb-dap/evaluate/TestDAP_evaluate.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def assertEvaluateFailure(self, expression):
2727
)
2828

2929
def isResultExpandedDescription(self):
30-
return self.context == "repl" or self.context == "hover"
30+
return self.context == "repl"
3131

3232
def isExpressionParsedExpected(self):
3333
return self.context != "hover"

lldb/test/API/tools/lldb-dap/variables/TestDAP_variables.py

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -502,29 +502,12 @@ def do_test_scopes_and_evaluate_expansion(self, enableAutoVariableSummaries: boo
502502
},
503503
"hover": {
504504
"equals": {"type": "PointType"},
505-
"equals": {
506-
"result": """(PointType) pt = {
507-
x = 11
508-
y = 22
509-
buffer = {
510-
[0] = 0
511-
[1] = 1
512-
[2] = 2
513-
[3] = 3
514-
[4] = 4
515-
[5] = 5
516-
[6] = 6
517-
[7] = 7
518-
[8] = 8
519-
[9] = 9
520-
[10] = 10
521-
[11] = 11
522-
[12] = 12
523-
[13] = 13
524-
[14] = 14
525-
[15] = 15
526-
}
527-
}"""
505+
"startswith": {
506+
"result": (
507+
"{x:11, y:22, buffer:{...}}"
508+
if enableAutoVariableSummaries
509+
else "PointType @ 0x"
510+
)
528511
},
529512
"missing": ["indexedVariables"],
530513
"hasVariablesReference": True,

lldb/tools/lldb-dap/JSONUtils.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1065,9 +1065,9 @@ llvm::json::Object VariableDescription::GetVariableExtensionsJSON() {
10651065
}
10661066

10671067
std::string VariableDescription::GetResult(llvm::StringRef context) {
1068-
// In repl and hover context, the results can be displayed as multiple lines
1069-
// so more detailed descriptions can be returned.
1070-
if (context != "repl" && context != "hover")
1068+
// In repl context, the results can be displayed as multiple lines so more
1069+
// detailed descriptions can be returned.
1070+
if (context != "repl")
10711071
return display_value;
10721072

10731073
if (!v.IsValid())

0 commit comments

Comments
 (0)