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

WIP - LiveShare functionality #598

Closed
wants to merge 29 commits into from
Closed

WIP - LiveShare functionality #598

wants to merge 29 commits into from

Conversation

ElianHugh
Copy link
Collaborator

@ElianHugh ElianHugh commented Mar 29, 2021

What problem did you solve?

Closes #555

General functionality

Vscode-R functions related to the session watcher currently do not function in LiveShare sessions. This means that the workspace viewer, dataview, plots, etc., do not work for guests.

This PR implements a 'LiveSession Listener', which allows for the sharing of file content and the forwarding of commands from a guest session to the host terminal. Thus, dataview, plots, browsers, and the workspace viewer should now function for guest sessions.

image

Settings & controls

This PR also contributes a liveshare control view, for tweaking guest access to the R workspace. This involves the following controls:

  • command forwarding
    • Whether the host allows guests to forward commands to the host terminal. E.g. workspace viewer view, remove
  • workspace sharing
    • Allows guests access to the R environment and related files
  • share ports
    • Automatically share & close browser ports with the guest

image

Default state can be controlled through three contributed settings.

How can I check this pull request?

  1. Have the LiveShare extension installed
  2. Have session watcher enabled
  3. Start an R LiveShare session, session watcher capabilities should be functional** for both host and guest

Features

  • Attach terminal
  • Send commands to terminal
  • Plots (images)
  • Dataview: file
  • Dataview: table
  • Dataview: list
  • Browser
  • Webview: I didn't change much but it seems to work regardless? Might need someone else to check this one
  • Help Pages
  • Control menu/view

**I've intentionally left addin functionality out of this PR, as it is either a bigger undertaking or does not function with guest sessions at all. When initially adding guest access to addins, there was significant desyncing between host and guest sessions, so I have decided to leave it out. Further complicating the issue, there is no way (at the moment) of distinguishing between a guest addin call and a host addin call.

Extra things to note

  • Adds vsls as a dependency
  • The window has to be reloaded if liveshare is not enabled prior to starting an R session
  • Both the host and the guest have to be running vscode-R with this PR
  • the guest does not need R installed

@ElianHugh ElianHugh changed the title Initial commit LiveShare functionality Mar 29, 2021
Rebuild to attempt to fix devreplay check failure
@ElianHugh ElianHugh marked this pull request as draft March 31, 2021 08:29
Remove superfluous callbacks, as we can just rely on requestFileContent for the majority of liveshare compatibility

Also impements some helper functions, such as readContent, which is a drop-in replacement for fs.readFile

Also fixes a bug that isLiveShare() was always returning true as long as the extension was enabled
Browser is now shared for guest sessions, and is disposed of when closed
Plots now work for those using the default vscode-R plot functionality

Plot data is sent to the guest as base64, and written to a guest file
The browser webview was failing due to accidentally attempting to share the server on guest side
Call attach from guest rather than from host
Rebuild to attempt to fix devreplay check failure
Remove superfluous callbacks, as we can just rely on requestFileContent for the majority of liveshare compatibility

Also impements some helper functions, such as readContent, which is a drop-in replacement for fs.readFile

Also fixes a bug that isLiveShare() was always returning true as long as the extension was enabled
Browser is now shared for guest sessions, and is disposed of when closed
Plots now work for those using the default vscode-R plot functionality

Plot data is sent to the guest as base64, and written to a guest file
The browser webview was failing due to accidentally attempting to share the server on guest side
Call attach from guest rather than from host
@ElianHugh
Copy link
Collaborator Author

Sorry about the spammed commits above - I tried rebasing with the Github desktop application, and apparently I duplicated the commits in the process.

Delegate requestRunTextInTerm in the runTextInTerm method, rather than checking if the user is a guest every time we want to call the method
Initial settings menu for R LiveShare
- Fix regression in browser sharing
- Fix regression in guest hiding save+load buttons
- Finish moving liveshare init into its own function
-> Rewrite contributed settings descriptions
-> Add LiveShare to readme
-> enableSessionWatcher as global var
-> Add more comments
Rstudioapi is buggy for guest share sessions, and there isn't a way (currently) to distinguish between a guest caller and a host caller
- Adds helper functions to ease the addition of creating new callbacks in the future
    - Simplifies the vsls callback
     'structure' to a two-method setup
- Added extra comments for explanation + examples
@ElianHugh ElianHugh changed the title LiveShare functionality WIP - LiveShare functionality Apr 13, 2021
Prevents guests that previously had access to the workspace to continue to have access, despite permissions being changed
Refactor commands to separate file, add logs to indicate loaded listeners, clear up comments
Use the host R term for rHelp panels
@ElianHugh
Copy link
Collaborator Author

As this PR seems to be reaching ready for review stage, I'm going to recreate the pull to get rid of the messy commit history.

@ElianHugh ElianHugh closed this Apr 20, 2021
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.

Implement shared R workspace in VS Live Share
1 participant