Skip to content

Conversation

@dfalbel
Copy link
Contributor

@dfalbel dfalbel commented Jan 20, 2026

The PR adds the ark_positron_variable_view method, 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 implementing ark_positron_has_viewer and ark_positron_variable_view, they can use ark_positron_variable_kind to 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:

dfalbel and others added 8 commits January 19, 2026 21:08
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 <noreply@anthropic.com>
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 <noreply@anthropic.com>
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 <noreply@anthropic.com>
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 <noreply@anthropic.com>
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 <noreply@anthropic.com>
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 <noreply@anthropic.com>
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 <noreply@anthropic.com>
@dfalbel dfalbel marked this pull request as ready for review January 20, 2026 21:41
@dfalbel dfalbel requested a review from lionel- January 20, 2026 21:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ODBC connections no longer automatically appear in Connections pane

2 participants