-
Notifications
You must be signed in to change notification settings - Fork 92
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
Connections pane integration with the variables pane #2594
Conversation
0aa8d13
to
c94adc1
Compare
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.
Some random teeny nits, but overall, this works really nicely for Python 3.10+! It looks like sqlite3
Connections are not registering on Python 3.9 and lower. I took a look at the different versions (this is the diff of 3.9 and 3.10), but wasn't quite sure where to look. There's not much actual Python code there, so it's probably somewhere on the C side, under Modules/_sqlite
😅
One more random thing: when users click on the DB icon in the Variables pane, should it bring focus to the Connections pane ?
extensions/positron-python/pythonFiles/positron/positron_ipykernel/connections.py
Outdated
Show resolved
Hide resolved
extensions/positron-python/pythonFiles/positron/positron_ipykernel/connections.py
Outdated
Show resolved
Hide resolved
extensions/positron-python/pythonFiles/positron/positron_ipykernel/connections.py
Outdated
Show resolved
Hide resolved
# we don't want to import sqlalchemy for that | ||
type_name = type(obj).__name__ | ||
|
||
if not self.object_is_supported(obj): |
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 might be missing something, but is essentially the same as lines 232-238?
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 very similar, indeed. The only reason why it's here, is to make sure, the variables pane is in sync with what's supported here. Otherwise, it's easy to break the variables pane, but keep unit tests passing.
c234469
to
868f3f3
Compare
Yes, I think this makes sense! I'll do that! |
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 looks good for the supported versions of Python! It also feels much faster than before ☄️
One small thing-- if you have a Connection open and then shut down the runtime (without disconnecting), you'll get this in the logs:
[Python] File "/Users/isabelzimmerman/code/positron/extensions/positron-python/python_files/positron/positron_ipykernel/positron_ipkernel.py", line 374, in do_shutdown
[Python] self.connections_service.shutdown()
[Python] File "/Users/isabelzimmerman/code/positron/extensions/positron-python/python_files/positron/positron_ipykernel/connections.py", line 346, in shutdown
[Python] for comm_id in self.comms.keys():
[Python] RuntimeError: dictionary changed size during iteration
I think if you change that line to list(self.comms.keys())
it should be good!
8523349
to
4649bdc
Compare
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.
Nice!
One thing that isn't clear to me is why we need the createEventEmitter
bits. It looks like they are duplicating the codegen'ed event onDidFocus
. If you want to expose that event in ConnectionsComm, you can do so just by creating a public-facing Event
and then assigning it to the wrapped onDidFocus
from the generated class.
|
||
const emitter = new PositronCommEmitter<T>(name, properties); | ||
this._emitters.set(name, emitter); | ||
//this._register(emitter); |
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.
Should this be commented out? If it causes trouble for us to clean up the emitter when disposed, then who takes ownership of the emitter for cleanup?
* @param name The name of the event, as a JSON-RPC method name. | ||
* @param properties The names of the properties in the event payload; used | ||
* to convert positional parameters to named parameters. | ||
* @returns |
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.
Nit: Should document return value if specifying @returns
My goal was to make positron/src/vs/workbench/services/languageRuntime/common/positronBaseComm.ts Lines 156 to 168 in cd0b655
AFAICT from extensions, the only way to listen to backend events is to listen to this event:
So I think I could instead of using Does it make sense? |
Oh, thanks, that makes it clearer. Should make it easier to reabsorb into core at some point. |
The connections pane is now displayed when a connection is openend from the variables pane, or using `%connection_show` line magic.
cd0b655
to
6d6f96e
Compare
Intent
This PR integrates the variables pane with the connections pane. When variables are assigned and they are known to the connections pane we display a small icon, that triggers the registration of that connection with the connections pane.
Addresses #2503
Approach
view
buttom for them:positron/extensions/positron-python/pythonFiles/positron/positron_ipykernel/inspectors.py
Lines 902 to 909 in f233f3e
enable register the object with the connections service:
positron/extensions/positron-python/pythonFiles/positron/positron_ipykernel/variables.py
Lines 519 to 537 in f233f3e
positron/extensions/positron-python/pythonFiles/positron/positron_ipykernel/variables.py
Lines 157 to 169 in f233f3e
QA Notes
A small video below showing different scenarios that we expect this PR to work with:
Screen.Recording.2024-04-04.at.10.59.43.mov