feat: report errors in /try via @codemirror/lint #85

Closed
push-f.com wants to merge 2 commits from push-f.com:try-lint into main
First-time contributor
No description provided.
In the next commit we'll introduce lint diagnostics for errors in the try
editor. As a prepration we stop rewriting imports before execution in this
commit since that can mess up reported ranges.
Owner

This breaks path-independence by hard-coding absolute URLs, meaning the sandbox no longer works under the /website path of the devserver (it tries to read http://localhost:8090/try/mods/codemirror.js, though that's being served ad /website/try/mods/...).

As a general pointer, it's a good idea to propose new features as an issue first, before creating a PR. I'm not fond of increasing the scope of the code I maintain, nor do I particularly enjoy reviewing code, so I'm not generally keen on PRs that add features that weren't even on my radar. If you can get the import map to work, that would be a clear improvement here, so I'm cautiously positive towards this one, but in other cases, you might end up wasting your time implementing something I'm not interested in.

This breaks path-independence by hard-coding absolute URLs, meaning the sandbox no longer works under the /website path of the devserver (it tries to read http://localhost:8090/try/mods/codemirror.js, though that's being served ad /website/try/mods/...). As a general pointer, it's a good idea to propose new features as an issue first, before creating a PR. I'm not fond of increasing the scope of the code I maintain, nor do I particularly enjoy reviewing code, so I'm not generally keen on PRs that add features that weren't even on my radar. If you can get the import map to work, that would be a clear improvement here, so I'm cautiously positive towards this one, but in other cases, you might end up wasting your time implementing something I'm not interested in.
Author
First-time contributor

Pushed a fix for the path-dependence. Showing errors in the editor is such a clear improvement to me, that I assumed you'd be interested. The importmap change happened in drive by. Point taken though, I'll open issues for other features.

Pushed a fix for the path-dependence. Showing errors in the editor is such a clear improvement to me, that I assumed you'd be interested. The importmap change happened in drive by. Point taken though, I'll open issues for other features.
Owner

Since these errors come in asynchronously (via postMessage over an async channel, or even because the code that triggers them didn't run synchronously at the start of the script), the code may be edited between the point where it is evaluated and the point where the error position arrives in the main window. When that happens, the error will be shown in the wrong position.

Since these errors come in asynchronously (via `postMessage` over an async channel, or even because the code that triggers them didn't run synchronously at the start of the script), the code may be edited between the point where it is evaluated and the point where the error position arrives in the main window. When that happens, the error will be shown in the wrong position.
Author
First-time contributor

Good catch. I added a check to only show them if the document hasn't changed.

Good catch. I added a check to only show them if the document hasn't changed.
Owner

Thanks. Merged as 6ca502dcf8 and c3507771f2

Thanks. Merged as 6ca502dcf878e and c3507771f2acbb216
marijn closed this pull request 2026-04-23 08:30:00 +02:00
Author
First-time contributor

Thanks! Btw should website issues be opened here rather than in the central issue tracker?

Thanks! Btw should website issues be opened here rather than in the central issue tracker?
push-f.com deleted branch try-lint 2026-04-23 08:35:16 +02:00
Owner

Yes, if it's website-specific, use this repo's issue tracker.

Yes, if it's website-specific, use this repo's issue tracker.
Author
First-time contributor

Could you deploy this / would it make sense to set up some auto deployment for this repo?

Could you deploy this / would it make sense to set up some auto deployment for this repo?
Owner

There is an auto-deployment, but it looks like some recent server changes had broken it. Should be better again now.

There is an auto-deployment, but it looks like some recent server changes had broken it. Should be better again now.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
codemirror/website!85
No description provided.