Open dp-sgr opened 2 days ago
Thank you for such a detailed issue report!
Can I just check which version of the Esbonio extension you are using?
While I've never tried Codespaces myself, I have been using the pre-release version of the extension (v0.90+
) with a Dev Container and the preview seems to work ok there. But then again maybe since the container is still on my machine localhost would work fine... :thinking:
Thanks also for finding asExternalUri
, that looks like it's going to be useful!
Hi @alcarney thanks for the quick response.
I've used the latest released version of the extension (v0.11.0).
I installed v0.95.1 (pre-release). Now im getting the error/loading page of esbonio:
After enabling debug logging, i can see the following output in my Esbonio log:
[esbonio.PreviewManager] Previewing file: 'file:///workspaces/MyProject/source/index.rst'
[esbonio.SphinxManager] No applicable client for uri: file:///workspaces/MyProject/source/index.rst
Which should be this line here: https://github.com/swyddfa/esbonio/blob/1c1e5b19d24703dd171b71f5e6dc36c6a3eade71/lib/esbonio/esbonio/server/features/sphinx_manager/manager.py#L244
After reloading the VsCode instance i get this output:
[esbonio.PreviewManager] Previewing file: 'file:///workspaces/MyProject/source/index.rst'
[esbonio.PreviewManager] Preview available at: http://localhost:45525/?ws=37923
[esbonio.PreviewManager] window/showDocument: ShowDocumentResult(success=True)
In both cases the "No Content found" loading/error page of esbonio doesn't change. opening another document just outputs the three lines from above .
When im opening the preview (in this case on the container http://localhost:45525/) from outside (with the codespace url) im getting a semi-corrupt output of the html files. Multiple assets are missing (Images, Styles, and so on...).
I also noticed, that the "build" folder is missing even if defined in config. I even removed the folder (from previous builds). It seams that the rst files are now transpiled on-the-fly? Idk. Running the build manually still works fine.
All-In-All: I don't know where to start to debug further. Console outputs are looking ok for me. Only the Browser debug console outputs the following error:
But this could be an error because something before that call goes wrong. The error hits every time im opening a new file to preview:
I also noticed, that the "build" folder is missing even if defined in config
Unfortunately, there are some differences in configuration between the two versions. If you haven't found it already, this page from the docs should tell you what you need to adapt your config to the pre-release version.
When I'm opening the preview (in this case on the container http://localhost:45525/) from outside (with the codespace url) im getting a semi-corrupt output of the html files. Multiple assets are missing (Images, Styles, and so on...).
Looking at the screenshot, my guess is that the server hasn't run a full build yet... have you tried editing a file and saving it?
Only the Browser debug console outputs the following error:
I don't immediately recognise those error messages :thinking:... perhaps we can ignore those for now.
Expected behavior
The preview of a a rst file should be displayed.
Actual behavior
The Preview is broken.
The files are build and i can see a running process/automatically forwared port for esbonio:
The preview is generated from an iframe and i believe that the problem is, that the url to the html page is statically mapped to localhost:
Opening the preview in another tab served from the routed Codespace works as expected. Its only the build-in preview tab in vscode which doesn't work.
I've investigated a little bit.
As far as i can interpret the current esbonio code localhost is hardcoded and there is some additional logic when serving via localhost or not. Therefore this should be the problem.
The VsCode LivePreview plugin uses the method:
asExternalUri
In the env object of vscode (sorry there was no direct hyperlink to the function. Just search for "asExternalUri"):
https://code.visualstudio.com/api/references/vscode-api#env
LivePreview Ref: https://github.com/microsoft/vscode-livepreview/blob/main/src/connectionInfo/connection.ts#L85
Maybe this helps a bit. But ive never wrote a vscode plugin before. I din't find any other issues regarding Codespaces or Dev Containers.
Log output
(Optional) Settings from conf.py
No response