diff --git a/src/schema/store.rs b/src/schema/store.rs index d416871..436fc65 100644 --- a/src/schema/store.rs +++ b/src/schema/store.rs @@ -27,8 +27,9 @@ pub struct SchemaStore { memory: HashMap>, pending: HashSet, want_network: HashSet, - /// Schemas whose one automatic (non-network) load has been kicked off, so - /// editing does not re-probe the cache on every change. + /// Schemas whose one automatic (non-network) load has been decided, so + /// editing does not repeat the cache probe or the workspace-containment + /// filesystem check on every change. auto_attempted: HashSet, waiting: HashMap>, doc_schema: HashMap, @@ -76,9 +77,11 @@ impl SchemaStore { return Some(Arc::clone(schema)); } - // Attempt an automatic, non-network load at most once per schema. - if self.auto_loadable(&url, &doc.uri) - && self.auto_attempted.insert(url.clone()) + // Decide the automatic, non-network load at most once per schema. + // The order matters: `auto_loadable` canonicalizes paths, and this + // runs on every change, so the syscalls must sit behind the set. + if self.auto_attempted.insert(url.clone()) + && self.auto_loadable(&url, &doc.uri) { self.enqueue(url, doc.uri.clone(), false); } else {