Skip to content

Commit 46ac754

Browse files
Merge pull request #840 from savetheclocktower/fix-scope-resolver-fix
Fix behavior of new `ScopeResolver` config caching in specs
2 parents 32ff14f + 09db9e0 commit 46ac754

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

spec/scope-resolver-spec.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,10 @@ describe('ScopeResolver', () => {
104104
atom.config.set('core.useExperimentalModernTreeSitter', true);
105105
});
106106

107+
afterEach(() => {
108+
ScopeResolver.clearConfigCache();
109+
});
110+
107111
it('resolves all scopes in absence of any tests or adjustments', async () => {
108112
await grammar.setQueryForTest('highlightsQuery', `
109113
(comment) @comment

src/scope-resolver.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,10 @@ ConfigCache.forConfig = (config) => {
124124
return configCache;
125125
};
126126

127+
ConfigCache.clear = () => {
128+
ConfigCache.CACHES_FOR_CONFIG_OBJECTS.clear();
129+
};
130+
127131

128132
// A data structure for storing scope information while processing capture
129133
// data. The data is reset in between each task.
@@ -954,5 +958,9 @@ ScopeResolver.ADJUSTMENTS = {
954958
}
955959
};
956960

961+
ScopeResolver.clearConfigCache = () => {
962+
ConfigCache.clear();
963+
};
964+
957965

958966
module.exports = ScopeResolver;

0 commit comments

Comments
 (0)