Open dannaf opened 5 months ago
@dannaf Could you quickly retest this with the latest Theia IDE desktop version? https://theia-ide.org/#theiaide
Same issue, essentially: the extension's Viewer did not open for me upon clicking the View LaTex PDF file button at the top-right of the Editor.
However, when trying all the four command palette actions that the extension provides, the View LaTeX PDF file in external viewer
command worked (it opened the PDF file in Preview
) and the View LaTeX PDF file in web browser
worked (it opened Chrome
in what appears to me to be a version of pdf.js specific to the LaTeX Workshop, with the extension's icon, at the url http://localhost:54496/viewer.html?file=pdf..ZmlsZSUzQSUyRiUyRiUyRlVzZXJzJTJGTmFmdHklMkZFbGlqYWgtcGV0aXRpb24lMkZtYWluLnBkZg). (I was not currently able to test the SyncTeX feature of this web viewer because I do not have LaTeX on my local machine — I'm trying to do everything on a remote server and generally access it only via the Theia IDE browser application.)
Actually the View LaTeX PDF file in web browser
command palette action also did something for me via Theia IDE in the browser. (I am not sure what happened when I opened this issue, as I thought I had tried that and it didn't work, but now when I tried again it opened.) I was not able to test it yet due to my particular networking setup, but at least something opened at a url like I mentioned above.
The main bug that this issue represents is still open, however, because the main in-Theia Viewer that the extension implements is not working, neither in Theia IDE via the browser or via the desktop application.
look chrome console after click 'view in tab'
@dannaf Opening a pdf file in the latex workshop viewer works for me in 1.48.0. Please comment if you still have an issue.
FYI, preview is available here: https://download.eclipse.org/theia/ide-preview/1.48.0/
1.48.2 not works for me, chrome console show: maximum call stack exceeded error. @dannaf We have the same problem. Did you solve it?
@yuhorun obviously, we're doing something differently, because opening a pdf file works for me. Can you give exact steps what you are doing so we can figure it out?
@tsmaeder
Thank you for your attention and contribution, my operation is as follows:
I recorded a video reproducing the error.
os: ubuntu22.04 james-yu.latex-workshop: 9.19.1
https://github.com/eclipse-theia/theia/assets/45552382/4113b58c-6c51-4507-9d34-99b13ed08931
@yuhorun can you open a pdf file from the navigator view if you already have it in the workspace? Btw: the video file does not play for me on Windows 11.
@tsmaeder yes, i can open a pdf file from the navigator view if i already have it in the workspace.
I re-uploaded the video to recreate the problem, and if you still can't open it, please play it on google Cloud Drive: https://drive.google.com/file/d/1kO1MlyKdkEttvdqZWp94cw29GsQNGKwL/view
@tsmaeder Please reopen this. I'm experiencing the same issue in 1.49.1 and 1.50.0 preview.
Error message is: Uncaught (in promise) Error: Command with id 'workbench.action.focusLeftGroup' is not registered.
(each time I try View LaTeX PDF File) and Error during encoding: 'Maximum call stack size exceeded'
(only the first time). This matches the output described and shown above.
@yuhorun I'm not familiar with latex. What setup is needed (I'm on Windows) and how do I "compile"?
@tsmaeder The LaTeX Workshop Requirements section lists TeX Live as recommended among possible alternative LaTeX distributions. I have tested with TeX Live Full (comes at ~8gb install size and took >1h to install) on Windows 11 which (for reference) plays nicely with LaTeX Workshop in VSCode (1.90.0). I believe this issue is independent of the choice of latex distribution, though.
The LaTeX Workshop comes with a Build LaTeX project button (play icon, see also @yuhorun's video) for automagic compilation.
Bumped. Encountered same issue with Theia IDE ver. 1.52.0
Even the "SNIPPET VIEW" is broken. I tried "LaTeX Workshop" from both OpenVSIX - version 10.1.0 and Marketplace - version 10.2.1.
This is how it looks like in VS Code
I believe this is a programming error in the LaTex Workshop extensions. Turns out the extension invokes vscode.fs.stat(uri)
, but what it does (in pseudocode) is this:
const uri= Uri.file('path/to/file.pdf`);
const statFunction = vscode.workspace.fs.stat;
statFunction(uri)
Invoking the function in this way, the this
variable inside the stat method is unbound and we get an error when the method tries to access instance variables off this
. The extension interprets this as the pdf file not existing (which it prints to the output view).
This works in VS Code by accident because the FS instance is constructed in a way that does not require this
to be defined.
Note that the API documentation clearly refers to stat
as a "method", not a function (https://code.visualstudio.com/api/references/vscode-api#FileSystem).
Note that the corresponding VS Code implementation was done in https://github.com/microsoft/vscode/pull/115530, with the purpose of hiding the main-side proxies from the API consumers and the side effect of the FileSystem
methods working without a this
value. Maybe it's a good idea to do a similar refactor in Theia? @msujew @JonasHelming thoughts?
@tsmaeder I see. I would also think of the vscode API methods as functions that don't require a this
context.
A refactoring to support this use case would be appropriate.
I would also think of the vscode API methods as functions that don't require a this context.
Namespaces have functions, but objects have methods. The VS Code doc explicitly distinguishes between the two 🤷
The thing is, we'd have to refactor every interface instance we return and every class defined in the VS Code API. Not sure that's worth it for enabling what is basically a programming error.
I wanted to file an issue in LaTeX Workshop repo, but unfortunately Theia is not officially supported.
@tsmaeder I'd argue that the fs
object is special, as most devs use the node:fs
import like this:
import * as fs from 'node:fs';
fs.stat(...);
If you want to use vscode.workspace.fs
as a drop-in replacement for node:fs
, it makes sense to replicate the same behavior as the fs
import, which exposes functions not methods. We should support that IMO.
@msujew invoking an object method as a pure function is a programming error. The equivalent in your example would be this:
import * as fs from 'node:fs';
const bla= fs.stat;
bla('/usr/bin/ls');
That might or might not work.
I wanted to file an issue in LaTeX Workhop repo, but unfortunately Theia is not officially supported.
They might still want to know about this. "Does not support" does not mean they are actively trying to be incompatible.
A cursory inspection has identified at least 16 classes we'd have to adapt.
Another problem is that if we rewrite the api objects we would have to make sure we convert them properly when sending stuff over the ext/main interface. The VS Code style is that they create a proxy object that has only getters/setters referring to some "original" object. Sending such an object will typically send an object without any properties.
Bug Description:
The LaTeX Workshop vscode extension's Viewer does not work on Theia IDE in the browser.
(I considered opening this as a Discussion but decided on an Issue/Bug because this involves a vscode extension working in vscode but specifically not working on Theia. I downloaded the extension on vscode locally and the extension's Viewer did open, so it seems that the problem has to do with Theia. Moreover, while the LaTeX Workshop vscode extension does not officially support Eclipse Theia, Theia does aim to support vscode extensions. So I can still expect that this extension should fully work on Theia, including on Theia IDE — correct?)
Steps to Reproduce:
Additional Information
This question is related to https://github.com/eclipse-theia/theia/discussions/7988, but that discussion was never answered (and in any case seems outdated, perhaps even dating to before Theia implemented vscode extensions at runtime?), so I would like to restart this discussion. Moreover, that is not the exact issue that I have. For me the LaTeX Workshop's Viewer is not even opening.
System Information