You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -92,22 +96,30 @@ class LuaPsiDebugVariablePositionProvider : LuaDebugVariablePositionProvider {
92
96
}
93
97
94
98
/**
95
-
* Collect all NameExpr in the scope up to the specified line end offset
99
+
* Collect all NameExpr, NameDef, and ParamNameDef in the scope up to the specified line end offset
96
100
*/
97
101
privatefuncollectNameExprsInScope(
98
102
scopeElement:PsiElement,
99
103
lineEndOffset:Int,
100
104
document:Document,
101
105
context:LuaDebugVariableContext
102
106
) {
103
-
// Find all NameExpr within the scope element
107
+
// Find all NameExpr (variable usages) within the scope element
104
108
val nameExprs =PsiTreeUtil.findChildrenOfType(scopeElement, LuaNameExpr::class.java)
105
109
106
-
println("LuaPsiDebugVariablePositionProvider: Found ${nameExprs.size} NameExpr in scope")
110
+
// Find all NameDef (local variable definitions) within the scope element
111
+
val nameDefs =PsiTreeUtil.findChildrenOfType(scopeElement, LuaNameDef::class.java)
107
112
108
-
// For each variable, we want to keep track of ALL occurrences before or on current line
109
-
// This allows inline values to be shown at each usage location
110
-
var addedCount =0
113
+
// Find all ParamNameDef (function parameter definitions) within the scope element
114
+
val paramNameDefs =PsiTreeUtil.findChildrenOfType(scopeElement, LuaParamNameDef::class.java)
115
+
116
+
println("LuaPsiDebugVariablePositionProvider: Found ${nameExprs.size} NameExpr, ${nameDefs.size} NameDef, ${paramNameDefs.size} ParamNameDef in scope")
117
+
118
+
// Collect all elements with their positions into a single list
119
+
data classElementWithPosition(valname:String, valoffset:Int, valtextRange:TextRange, valtype:String)
120
+
val allElements = mutableListOf<ElementWithPosition>()
121
+
122
+
// Collect NameExpr (variable usages)
111
123
for (nameExpr in nameExprs) {
112
124
val textRange = nameExpr.textRange
113
125
@@ -116,14 +128,55 @@ class LuaPsiDebugVariablePositionProvider : LuaDebugVariablePositionProvider {
116
128
val variableName = nameExpr.text.trim()
117
129
118
130
if (variableName.isNotBlank() &&!isKeyword(variableName)) {
119
-
println("LuaPsiDebugVariablePositionProvider: Adding variable '$variableName' at ${textRange.startOffset}")
120
-
// Use a composite key (variable name + offset) to store multiple occurrences
0 commit comments