https://github.com/labath created https://github.com/llvm/llvm-project/pull/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. >From 9d126afa09c7c2f73852da3ba943e1a74498cba4 Mon Sep 17 00:00:00 2001 From: Pavel Labath <pa...@labath.sk> Date: Mon, 20 May 2024 08:18:07 +0000 Subject: [PATCH] [lldb-dap] Don't send expanded descriptions for "hover" expressions 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. --- .../lldb-dap/evaluate/TestDAP_evaluate.py | 2 +- .../lldb-dap/variables/TestDAP_variables.py | 29 ++++--------------- lldb/tools/lldb-dap/JSONUtils.cpp | 6 ++-- 3 files changed, 10 insertions(+), 27 deletions(-) diff --git a/lldb/test/API/tools/lldb-dap/evaluate/TestDAP_evaluate.py b/lldb/test/API/tools/lldb-dap/evaluate/TestDAP_evaluate.py index 57cabf5b7f411..68c57ad775544 100644 --- a/lldb/test/API/tools/lldb-dap/evaluate/TestDAP_evaluate.py +++ b/lldb/test/API/tools/lldb-dap/evaluate/TestDAP_evaluate.py @@ -27,7 +27,7 @@ def assertEvaluateFailure(self, expression): ) def isResultExpandedDescription(self): - return self.context == "repl" or self.context == "hover" + return self.context == "repl" def isExpressionParsedExpected(self): return self.context != "hover" diff --git a/lldb/test/API/tools/lldb-dap/variables/TestDAP_variables.py b/lldb/test/API/tools/lldb-dap/variables/TestDAP_variables.py index 07ab6d5a63eb6..57c17e5ea9d3d 100644 --- a/lldb/test/API/tools/lldb-dap/variables/TestDAP_variables.py +++ b/lldb/test/API/tools/lldb-dap/variables/TestDAP_variables.py @@ -502,29 +502,12 @@ def do_test_scopes_and_evaluate_expansion(self, enableAutoVariableSummaries: boo }, "hover": { "equals": {"type": "PointType"}, - "equals": { - "result": """(PointType) pt = { - x = 11 - y = 22 - buffer = { - [0] = 0 - [1] = 1 - [2] = 2 - [3] = 3 - [4] = 4 - [5] = 5 - [6] = 6 - [7] = 7 - [8] = 8 - [9] = 9 - [10] = 10 - [11] = 11 - [12] = 12 - [13] = 13 - [14] = 14 - [15] = 15 - } -}""" + "startswith": { + "result": ( + "{x:11, y:22, buffer:{...}}" + if enableAutoVariableSummaries + else "PointType @ 0x" + ) }, "missing": ["indexedVariables"], "hasVariablesReference": True, diff --git a/lldb/tools/lldb-dap/JSONUtils.cpp b/lldb/tools/lldb-dap/JSONUtils.cpp index bec277332bcf0..069877dbab339 100644 --- a/lldb/tools/lldb-dap/JSONUtils.cpp +++ b/lldb/tools/lldb-dap/JSONUtils.cpp @@ -1065,9 +1065,9 @@ llvm::json::Object VariableDescription::GetVariableExtensionsJSON() { } std::string VariableDescription::GetResult(llvm::StringRef context) { - // In repl and hover context, the results can be displayed as multiple lines - // so more detailed descriptions can be returned. - if (context != "repl" && context != "hover") + // In repl context, the results can be displayed as multiple lines so more + // detailed descriptions can be returned. + if (context != "repl") return display_value; if (!v.IsValid()) _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits