-
Notifications
You must be signed in to change notification settings - Fork 535
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
Live Share Integration #2228
Live Share Integration #2228
Conversation
Thank you for your contribution. Please convert the newline code from I am sorry that I am against merging this PR because it makes the maintenance of the extension much difficult as we can see code fragments for Live Share in multiple files. I think the architecture of LiveShare does not allow the maintenance to be easy. @jlelong What do you think? |
Just my 2c, I'm quite positive to this PR as it is a long requested and popular feature. The code seems to split in many places, yet mostly in a new |
Thanks for the feedback @tamuratak and @James-Yu . I'm definitely agreed that this introduces coupling between Live Share and other components in the extension that would generally be considered bad design. But it seemed like this was the pattern followed by other components in the extension - virtually every one receives an instance of I'd be happy to refactor this PR, as well as other parts of the extension, to decouple the Live Share component from the others, but it'll increase the size and risk of the change. I think the following would accomplish this:
I think the trade-off here is between a cleaner design and a larger/riskier change. Let me know which you prefer! |
I'm good with the current implementation. However as I have been away from the table for quite a loooong time, @tamuratak and @jlelong have higher priority. |
I have found that we can debug the extension with Live Share as a host and a guest on the same machine. It could make maintenance much easy. I am not sure this PR works well with multiple file projects. @jlelong is in charge of the function. I want to wait for the opinion. The architecture of Live Share still makes me nervous about the maintenance cost of this PR. |
@tamuratak could you elaborate on your specific concerns? We could probably refactor the changes to ease/remove them. |
@tamuratak I was on vacation and disconnected. I will need a few more days to look at this PR in depth and investigate the possible issues. |
First, I would like to say that I am very enthusiastic about VSCode's Live Share feature. Yet, I share @tamuratak's concerns about the maintenance: fully supporting Live Share requires a lot of small changes/adaptations at many places, which makes maintenance and evolution more costly.
I am afraid that fixing all these issues will spread live share specific code at even more places and therefore increase the maintenance cost. |
This PR does not work now. Error handling in this PR is incomplete. When errors occur, |
I have found that, on the guest machine, we can read files on the host machine with I think that it is a more appropriate approach making LaTeX Workshop use the API of VS Code FileSystem instead of using Node.js API directly. Then, the extension works seamlessly both on the guest and the host. Other than Live Share, using the API of VS Code FileSystem seems promising to benefit from the ecosystem of VS Code. |
I have found that |
The following is an approach that I think is appropriate. Implement a kind of the We can see a prototype. With this approach, all we have to do is replace the The paths of files on the host machine are expressed as With this approach, we can also make LaTeX Workshop work with other virtual file systems provided by other extensions, e.g., sshfs. However, as mentioned above, this approach does not work with Live Share now because I don't know why it is restricted only for text files. VS Code FileSystemProvider is not intended only for text files. |
I opened an issue microsoft/live-share/issues/3791 |
@daytonellwanger @tamuratak @jlelong I'm really eager to see this combination of Live Share and Latex Reporting in this extension. The main use cases, where binary support is needed, would be:
I see your point, when you want to stay extension neutral and would like to support SSH FS, but I think Live Share offers a far better way for collaborative editing, as SSHFS does not support for file-change-notifications, which is a limitation by the underlying SFTProtocol. While I see the benefits of the pure LiveShare-FS implementation on MS-side, I think the project would benefit from implementing this pull request as there is no progress sadly. |
Hey @cmprmsd, I'd love to add Live Share integration to LaTeX Workshop the right way. I haven't forgotten about this pull request 😊. Unfortunately there are higher priority items on the Live Share side to be working on at the moment. But I do intend to get back to this as soon as possible, and really want to see this thing completed. cc @Davsterl |
Would this also allow the guests to initiate the compile process or is this limited to the host? If the former is the case this seems like a big security problem as a guest could insert arbitrary commands into the source code which would be executed during compilation |
Yup that's the case. It's based on trust who you work with. As this whole story never really got pushed forward I decided to look for alternatives and ended up with the self hosted version of Overleaf. It's great. I modified the server a bit in order to allow custom snippets and am happy with it :) |
Close in favor of the approach #2228 (comment). |
While you definitely should trust who you work with the underlying security issue is still relevant and the reason why terminals for example are still read-only by default. So regardless which approach gets implement this should be considered.
This seems like a good and clean solution. However based on the above security consideration I would propose to only give the host the ability to initiate a compilation and have the clients fetch the PDF (or generate them locally) |
This PR adds Live Share support to LaTeX Workshop. General info on Live Share here. Extensibility API here.
Previously, certain features such as hover, completion, and snippets were supported by virtue of Live Share's remoting of VS Code primitives. Others were functional because they were able to run locally, such as the Snippet Panel. However, many critical features of LaTeX Workshop require custom Live Share integration to support.
Most importantly this PR downloads the generated PDFs on the host's machine to the guest's machine, which makes the various vieiwing functionality supported (with the exception of SyncTeX, which will require also downloading the SyncTeX files).
This PR also remotes those commands (build, clean, ..) that need to be run on the host's machine.
In order to be able to see the output of these commands and others, this PR also forwards the logs and the compiler logs to the guest. Lines from the host machine are prefixed with
[Remote]
.There are a few places in this PR where I update the assumption that the
.tex
file exists on disc, which is not the case for the Live Share guest which uses a virtualized file system provider. E.g. these updates make structure shortcuts functional for the guest.Note that the guest need not have LaTeX installed for any of this to work.
Of course all the regular Live Share features (coediting, independent file navigation, language features, shared terminals, ...) work as usual.
With this, I hope the majority of LaTeX Workshop's features now work for a Live Share guest. Surely there will be bugs and more features to add, but I think what is in this PR gives a super valuable offering.