-
Notifications
You must be signed in to change notification settings - Fork 293
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
Extract out python-specific code out of KernelVariables and into PythonVariablesRequester (and Sort variable explorer by types) #6042
Conversation
Codecov Report
@@ Coverage Diff @@
## main #6042 +/- ##
======================================
- Coverage 72% 71% -1%
======================================
Files 398 399 +1
Lines 26846 26866 +20
Branches 3950 3952 +2
======================================
- Hits 19428 19300 -128
+ Misses 6537 5938 -599
- Partials 881 1628 +747
|
|
||
// VariableTypesFunc takes in list of vars and the corresponding var names | ||
const results = await notebook.execute( | ||
`print(${GetVariableInfo.VariableTypesFunc}([${matches}], [${matchesAsStr}]))`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is obviously python specific. The query.query was intended to support other languages. I think we could at least extract out the python part into a separate class? Maybe make an interface for getting names and types, like IKernelVariableRequester or something.
So instead of having getVariableNamesandTypesFromKernel be a function, there would be an interface with this single method on it.
Right now we'd just support python, but this interface could be expanded (or suppled by other extensions) for other languages later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are other functions that do some python specific things. I'm thinking about putting those into the PythonVariableRequester as well.
@@ -58,3 +58,16 @@ def _VSCODE_getVariableProperties(var, listOfAttributes): | |||
if hasattr(var, attr) | |||
} | |||
return _VSCODE_json.dumps(result) | |||
|
|||
|
|||
def _VSCODE_getVariableTypes(vars, varnames): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How long does this take to execute for say 10000 variables?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was wondering if we're making another request for types, could we do the list and the types at the same time?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Internally this would essentially call the same function we do now to list the names (you'd have to look up what the magic %_who_ls does in ipykernel)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
think I got something that works well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
⏲️
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Like the python variable separation. Should make supporting other languages a lot easier.
For #4585
This changes some things in KernelVariables so not entirely how badly this would affect other kernels. This addition may not be worth it depending on that. Any/all comments appreciated
Summary:
package-lock.json
has been regenerated by runningnpm install
(if dependencies have changed).