Skip to content
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

Playground in offline mode #3370

Closed
songhtdo opened this issue May 18, 2024 · 4 comments
Closed

Playground in offline mode #3370

songhtdo opened this issue May 18, 2024 · 4 comments
Labels
enhancement Feature request

Comments

@songhtdo
Copy link

songhtdo commented May 18, 2024

Problem

Thank you for providing a very useful tool.
I am on a new computer and experiencing a network outage. I am unable to use the playground function properly and will display an error message in the browser console.

The error message displayed in the browser's console is as follows:
image

Possible reason: In pages generated by tree sitter cli control, access to some network resources is required.

Expected behavior

I hope to be able to use the tree sit playground feature in a completely offline state.
Thank you.

@songhtdo songhtdo added the enhancement Feature request label May 18, 2024
@tree-sitter tree-sitter deleted a comment from Tc69Cabusog May 18, 2024
@tree-sitter tree-sitter deleted a comment from Tc69Cabusog May 18, 2024
@amaanq
Copy link
Member

amaanq commented May 18, 2024

clone the repo, run ./script/build-wasm, then run cargo install --path cli and it'll bundle in the locally built tree-sitter.js/wasm files, as for the others, I have no clue, I don't get what you're asking exactly, I'm just assuming you are asking how to run a playground without needing an internet connection in regards to the playground subcommand

@songhtdo
Copy link
Author

@amaanq
Hello, thank you very much for your attention and reply.

Maybe I didn't express myself clearly, let me describe it again.
Normally, our computer will be connected to the Internet, and we can access tree-siter.github.io/tree-sitter/playground through the browser to test some syntax. Alternatively, test it locally through tree-sitter playground.
But in some cases, computers are completely separated from the Internet environment and physically isolated. At this point, to test some syntax with playground, I need to use the local tree sit playground command.

To run the tree-sitter program locally, I need to start from the https://cdnjs.cloudflare.com The website downloads some js/css files. This step is unsuccessful when the Internet cannot be accessed. cause http://127.0.0.1:8000 The page is not working properly.

I would like to ask if there is a way to solve this problem.
Thank you again.

@sogaiu
Copy link

sogaiu commented May 19, 2024

I tested tree-sitter playground while disconnected from networks and at least for my setup, the result was not usable:

tree-sitter-playground-offline-in-firefox

After I re-established a network connection and reloaded, things started working:

tree-sitter-playground-online-in-firefox

IIUC, the former of the two results is what is being described as what is being experienced and the desire is for things to work even while offline.

@songhtdo
Copy link
Author

This issue has been resolved.
I have developed a small local application by combining the tree sitter and csharp tree sitter projects. You can skip using tree -sitter playground anymore.

The project source code has been uploaded to the GitHub project: tree-sitter-play

The project screenshot is as follows:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Feature request
Projects
None yet
Development

No branches or pull requests

4 participants
@songhtdo @amaanq @sogaiu and others