Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

filter out unneeded variables, bring back privates but sort them last #15551

Merged
merged 1 commit into from
Apr 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,13 @@ def getValue(variable):

def getPropertyNames(variable):
props = []
privateProps = []
for prop in dir(variable):
if not prop.startswith("_"):
props.append(prop)
return props
elif not prop.startswith("__"):
privateProps.append(prop)
return props + privateProps


def getFullType(varType):
Expand All @@ -74,6 +77,9 @@ def getFullType(varType):
return module + varType.__name__


typesToExclude = ["module", "function", "method", "class", "type"]


def getVariableDescription(variable):
result = {}

Expand Down Expand Up @@ -126,6 +132,7 @@ def _VSCODE_getVariableDescriptions(varNames):
}
for varName in varNames
if varName in globals()
and type(globals()[varName]).__name__ not in typesToExclude
]

return json.dumps(variables)
Expand Down Expand Up @@ -167,7 +174,10 @@ def _VSCODE_getAllChildrenDescriptions(rootVarName, propertyChain, startIndex):
children = []
for prop in childrenNames:
child_property = getChildProperty(parent, [prop])
if child_property is not None and type(child_property).__name__ != "method":
if (
child_property is not None
and type(child_property).__name__ not in typesToExclude
):
child = {
**getVariableDescription(child_property),
"name": prop,
Expand Down
Loading