-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
[code] support live preview of local files #3831
Comments
Are you sure that you are using the correct port? The server tells you that it exposes web socket connection, not pure http. |
Could you share the repo please? From the description is not clear which server you are running. |
Sure, here is the repo : https://github.com/kevinadhiguna/typescript |
This port is a debug port for Gitpod Code Server. It does not have anythign to do with index.html Are you trying to preview index.html? |
Yes, I am. Sorry I am confused how to preview the HTML file. The docs in Gitpod shows how to do it in Theia but I am a bit confused as I usually drag ad drop an HTML file in local machine to preview it. Do you mind telling me how to preview HTML in a new tab from Gitpod ? |
Hm, VS Code does not support this feature by default, but you can install additional extensions like: https://open-vsx.org/extension/ritwickdey/LiveServer Could you give it a try? |
Sure, I just installed the Live Server extension in VScode in Gitpod. Next, I right-clicked The result was : A couple of questions please :
|
correct
that's probably related to how we handle ws connection |
Thank you very much, that was so helpful. |
Anyway, the Firefox unable to establish connection is not a major issue here IMO. Many thanks for the prompt reply, it helped a beginner like me a lot ! |
please upvote here to implement live preview in VS Code: microsoft/vscode#12080 You can also follow this thread for other solutions (VS Code extensions). |
Upvoted, thanks |
Would it be possible for you to test this with Five Server? |
How may I install Five Server in Gitpod ? @yandeu |
I have just added it. Also, I found a bug in Live Server and Five Server that prevents auto-reload on an index page. If you want to use auto-reload, access your index file with But everything else (instant update, highlight, auto navigation) works fine. I will publish an update to Five Server tomorrow. |
Thank you @yandeu , I was able to install Five Server extension. However, I encountered some issues regarding connection. Terminal in Gitpod in FIrefox : This is how it looks in Chrome : Terminal in Gitpod in Chrome : This Environment |
Yes 😄 (see yandeu/five-server@5564c40)
Yes, I will try to fix that today. In the meanwhile try to rename your Also, there is a small bug when reloading css. Will fix that as well 👍 |
@kevinadhiguna I have fixed everything. Just had no time to release it today :/ |
Five Server v0.0.25 is now available on gitpod and it works very very well :) |
Cool @yandeu , it worked like magic ! Thanks |
You're welcome 🙂 Also, there are new cool features in development. Currently working on a sort of "Hot Module Replacement" feature. Means, instant update while keeping the state (DOM) previously manipulated by JavaScript 👍🏻 |
@yandeu Does it support preview of PDF files too? In Theia we used to have special handling for pdfs: https://github.com/eclipse-theia/theia/blob/96930a2edcc4c706d41ab8486500de7979d01283/packages/mini-browser/src/browser/mini-browser-content.ts#L581-L593 Maybe you can get inspired from that and add PDf support for Five Server too? We have such questions in the community: https://community.gitpod.io/t/latex-pdf-viewer/3365 |
I have not implemented anything special for PDFs yet. I guess if you try to preview it, it will display "File is too big for a preview"? I haven't tried it yet. Have you tried it? What does it show? Five Server allows for middlewares, similar to an express app. So I guess it would be possible to embed a PDF preview. Feel free to open a new Feature Request Issue on yandeu/five-server (not yandeu/five-server-vscode). |
@yandeu here you go yandeu/five-server-vscode#1 |
@yandeu I tried the latest extension and it gives me: From this repo: https://github.com/joejcollins/latex Maybe some CSP is misconfigured for iframe in remote context, not sure? |
Yes, I think the CSP policy of the WebView is blocking iFrames. |
It is strange though, |
I'm getting the same issue for the PDF viewer. Any updates? Could there be information if this issue shows up with vs and not theia maybe? |
@mfouesneau @akosyakov Please help to debug the PDF preview feature on |
Sure. How can we provide help? |
It looks like the "Simple Browser" preview does not support loading PDFs. Therefore, Five Server will only show PDF preview in the browser. I tried Office Viewer which seems to show a preview for PDFs. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Bug description
Unable to see HTML file and faced a HTTP 400 Bad Request issue. Instead, I saw a text saying : Web Sockets Request was expected.
Steps to reproduce
index.html
andindex.ts
file.index.html :

index.ts :

index.ts
withyarn tsc index.ts
and produce anindex.js
file.index.js :

<h1>Hello</h1>
and connect it toindex.js
.<PORT>-<Gitpod Workspace URL>
.Expected behavior
Display an HTML file and run Javascript in console.
The text was updated successfully, but these errors were encountered: