theme-language-server: checks get dropped while a forced runChecks is pending

Open
#1,385 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 2 days

@efegokdemir is already working on this.

Since Nov 12, 2026.

  • #1397 by @efegokdemir — open

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
76/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
typescript
Domain
devtools

Research direction

Start with src/utils/debounce.ts and trace how runChecks passes trigger URIs through normal and forced calls. Check the debounce tests and the language server call sites to see how multiple roots are handled. Done means pending checks are retained across calls and diagnostics arrive for every affected file; add or update tests for the reported timing cases.

Written by the indexing model from the issue text.

Description

Hi! We run our own language server on top of startServer from @shopify/theme-language-server-common, and we noticed that sometimes an open file just never gets diagnostics until you edit it again.

I tracked it down to debounce in src/utils/debounce.ts. Once runChecks.force(...) has been called, every other call is ignored until that forced run has finished (if (timeoutId !== null && force) return;). And since only the arguments of the last call are kept, a normal call made within 100 ms of another one also replaces it.

So you can lose a check in a few ways:

  • A file is opened while a forced run is waiting or running (for example right after a watched file changed). If the forced run already read its theme, that new file isn't in it, and its own request was ignored. No diagnostics.
  • Two files from two different themes (two roots in the workspace) are opened within 100 ms. Only the second one gets checked.
  • A forced call replaces a normal call that was still waiting.

It's easy to hit when the editor restores several tabs at startup while something on disk is changing.

What fixed it for us was keeping a set of all the trigger URIs from every call, forced or not, and passing all of them to the next run, instead of keeping only the last call. Happy to open a PR if that sounds like the right direction.

We reproduced it on 2.21.2, and the code on main looks the same.

Dominant language
TypeScript
Stars
245
Forks
108
Avg merge
2d 8h
Merged PRs (30d)
24

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Shopify/theme-tools

All issues in Shopify/theme-tools

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.