-
Notifications
You must be signed in to change notification settings - Fork 24
Add viewer support for database connections in Variables Pane #1004
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
For S4 objects, `class(object)` only returns the immediate class name, not the full inheritance hierarchy like S3 objects do. This meant that methods registered for a parent S4 class would not be found when dispatching on a subclass. Now `call_ark_method` uses `methods::extends()` for S4 objects to get the complete class hierarchy including superclasses. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
Adds the ability to view database connections (starting with ODBC) from the Variables Pane. When a user clicks to view a connection variable, it opens in the Connections Pane. Changes: - Add `VariableIsConnection` and `VariableViewConnection` to ArkGenerics - Add `is_connection()` and `view_connection()` functions in variable.rs - Modify `has_viewer()` to return true for connection objects - Modify `view()` in r_variables.rs to handle connections - Add method table entries for the new generics in methods.R - Implement ODBC connection support using `odbc:::on_connection_opened()` with reconstructed connection code from the connection info The ODBC methods are registered via setHook when the odbc package loads. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
The `ark_positron_variable_view_connection` method now returns TRUE on success and FALSE on failure, allowing callers to detect and report errors. Also removes redundant `inherits()` check in OdbcConnection handler since method dispatch already ensures the correct class. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
Adds `ps_connection_focus` to send a focus event to the frontend, allowing the Connections Pane to focus on a connection. The focus event is now sent automatically whenever `connectionOpened` is called, whether for a new connection or an existing one. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
Prevents panic in connection tests by checking if RMain is initialized before attempting to send the focus event. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
Registers methods for `BigQueryConnection` class when the bigrquery package is loaded, enabling users to view BigQuery connections in the Connections Pane from the Variables Pane. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
Replace connection-specific methods with generic viewer methods: - Remove `ark_positron_variable_is_connection` and `view_connection` - Add generic `ark_positron_variable_view` for custom view actions - Extend `has_viewer` to dispatch for all objects, not just data frames Connection packages now register: - `kind` returning "connection" for proper icon display - `has_viewer` returning validity check - `view` for the actual view action This allows any package to implement custom viewers for their objects. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
lionel-
approved these changes
Jan 26, 2026
Contributor
lionel-
left a comment
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.
A few nitpicks but LG!
- Remove `.ps.` prefix from internal helper functions that are not exported (`odbc_connection_code`, `bigrquery_connection_code`, `connection_focus`) - Rename `try_custom_view` to `try_dispatch_view` for consistency with the `try_dispatch()` pattern Co-Authored-By: Claude Opus 4.5 <[email protected]>
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The PR adds the
ark_positron_variable_viewmethod, which is called by the variables pane upon clicking on the view button. Packages can add support for a view action for any object that appears in the variables pane by implementingark_positron_has_viewerandark_positron_variable_view, they can useark_positron_variable_kindto customize the viewer button icon.Additionally, it makes the connections pane focus when a connection is opened.
Adresses:
The PR implements support for odbc and bigrquery. Ideally those methods would live in their packages. But it will require new package releases to really fix posit-dev/positron#11357 - which is somewhat urgent. Happy to move the implementation there though, if we think it's bad to keep it here.
I found other packages that use the same addTaskCallback pattern: