theme-language-server: creating or deleting a folder leaves stale readDirectory/stat cache

オープン
#1,386 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 2 日以内に返信

@efegokdemir がすでに取り組んでいます。

2026年11月10日 から。

  • #1390 @efegokdemir による — オープン

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
68/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
typescript
領域
devtools

調査の方向性

Start in startServer and trace how watched-file create, delete, and rename events invalidate readDirectory, stat, and readFile caches. Check how paths are represented and where the workspace root is determined before changing invalidation. Done when creating or deleting nested folders, and renaming files across folders, refresh directory listings and stats without restarting the server.

索引モデルが issue の本文から書いたものです。

説明

Hi! When a watched-file event creates or deletes a file, startServer only invalidates readDirectory for that file's own folder (path.dirname(change.uri)), plus readFile and stat for the file itself.

That's not enough when the event creates or removes a whole folder. Say a theme has no snippets/ folder yet, and then snippets/card.liquid is created. readDirectory of the theme root and stat of snippets/ are still cached from before, so the server keeps thinking snippets/ doesn't exist. Snippet completion stays empty until you restart the server. The same happens the other way round when the last file in a folder is deleted: the cached root listing still has the folder, and walking it fails.

What fixed it for us was invalidating readDirectory and stat for every folder above the created or deleted file, up to the root, not just its direct parent. Renames have the same problem, since they also only invalidate the two parent folders.

We hit this on 2.21.2, and main looks the same. Happy to send a PR.

主要言語
TypeScript
スター
245
フォーク
108
平均マージ
2日 8時間
マージ済み PR(30日)
24

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

Shopify/theme-tools のほかの issue

Shopify/theme-tools の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。