-
Notifications
You must be signed in to change notification settings - Fork 4
Add support for ACE linters (Python, JSON) #124
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
base: main
Are you sure you want to change the base?
Conversation
src/components/IdeEditor.jsx
Outdated
| // tab | ||
| import TabTemplate from "../utilComponents/TabTemplate"; | ||
|
|
||
| let aceLinterWorker = new Worker(new URL('/ace-linter-worker.js', import.meta.url), { type: 'module' }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am concerned that this won't work when deployed. I had so much trouble with getting this path right in my development - only using the absolute path worked for me. If I tried anything else, vite served up index.html in its place which was very confusing. This bothers me because:
- I solved a problem in serviceWorkerRegistration.js by REMOVING the absolute path.
- With this code, I'm getting this error from the NPM console:
Instead of /public/ace-linter-worker.js?worker_file&type=module, use /ace-linter-worker.js?worker_file&type=module.
public/service-worker.js
Outdated
| @@ -1,4 +1,4 @@ | |||
| const CACHE_NAME = "CircuitPython-Online-IDE-cache"; | |||
| const CACHE_NAME = "CircuitPython-Online-IDE-cache.v20250714.001"; | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had so many issues with caching, that I was concerned that new users of the IDE might start to see lots of issues if they had used the IDE before. That may be why I found a number of missing resources when I ran it that you might not have seen in your development environment. See #121
|
In another PR/issue we were discussing what gets output when you build the app and cache it. Here's what this change adds: Notably, the app now spans multiple javascript files. There is a 12 MB download for the python service. It is mostly WASM encoded in javascript, so hugely bloated. Google Workbox allows you to pass it a glob for specifing files to cache in one of their npm plugins that generates the service-worker. |
ac8f5ce to
73e456d
Compare
- In IdeEditor we create a web worker and tell the ACE editor to use that worker for language support - The ace-linter-worker.js loads up JSON and Python language lint support - I also changed the name of the cache to clear out outdated versions. I was having tons of issues with stale caching and was concerned that might persist past a deploy.
Vite needed some extra config to avoid an error when building the site. It was complaining as follows: Invalid value "iife" for option "worker.format" - UMD and IIFE output formats are not supported for code-splitting builds. Changing the config to generate in 'es' format seems to fix it.
Since I've seen some exceptions from the linter, I thought it might be nice to deploy with the linter off to see how things are going.
73e456d to
93b27ee
Compare

Resolves #60
This change adds a webworker to add LSP support to perform linting for the code editors.