vscode-perforce icon indicating copy to clipboard operation
vscode-perforce copied to clipboard

Support Live Share

Open mjcrouch opened this issue 5 years ago • 0 comments

Having been using live share quite a lot recently, it would be good to be able to be able to allow users other than the host to be able to see the perforce files and potentially perform perforce operations on files.

Some thoughts around implementation

  • At a rudimentary level, it would probably be quite trivial to get most commands working, generally we could just replace the current call to execute a perforce command with one that asks the host to execute the command and return the result. If we always pass in URIs for files, we can translate any vsls: URIs to file: URIs on the host side. Probably we shouldn't accept strings for paths in commands and only ever accept URIs
  • For the few perforce commands that return local file paths, we would probably need to convert those back to vsls URIs as well - this would have to be on a per command basis since it depends on the parsing required - would need to look at where we return file paths and replace them with URIs
  • There are some cases where we probably don't want to execute the commands at-all - from what I've seen, edit on file save / add on file add already work, because it seems like the host is already getting those events even if they are done by someone else in the session
  • If someone performs an action that provides a refresh, then probably everyone in the session should refresh. We can send a broadcast message to do this - It would be nice to reduce this a bit.
    • For example, is it better for everyone in the session to hit the perforce server, or is it better for the host to just provide the list of changelists / files to all the clients whenever a refresh happens?
  • It should be possible to disable this if the host doesn't want the users to perform perforce operations
  • This would be more difficult to implement, but potentially a read-only mode. this could apply to everyone or just read-only guests - would have to work out how to indicate a command is read or write
    • one possibility is in the p4 api, mark specific command combinations (e.g. change where the -d or -i flag is specified) as write and return an error if a client tries to use that command combination

basic docs for vsls - for some reason the latest npm package is missing the readme so it took me a long time to find this.. extension sample

On furrther investigaion - the extension seemingly needs to be whitelisted due to https://github.com/MicrosoftDocs/live-share/issues/2896 - otherwise we can't use the shareService command

mjcrouch avatar Jun 16 '20 21:06 mjcrouch