mirror of
https://github.com/Microsoft/vscode
synced 2024-10-30 03:25:38 +00:00
labels: fix caching of unintended formatters (#157313)
* labels: fix caching of unintended formatters `this.formatters` was the same list instance stored in the memo, so we could cache things we didn't want to. I believe this caused #156135, since things we _intend_ to cache from the extension host are parsed from JSON and cannot be circular. Fixes #156135 * labels: rev label storage to avoid previous bugs Fixes #155844 * fixup! tets
This commit is contained in:
parent
b3a5653de7
commit
24547bcd8e
2 changed files with 3 additions and 3 deletions
|
@ -143,9 +143,9 @@ export class LabelService extends Disposable implements ILabelService {
|
|||
this.os = OS;
|
||||
this.userHome = pathService.defaultUriScheme === Schemas.file ? this.pathService.userHome({ preferLocal: true }) : undefined;
|
||||
|
||||
const memento = this.storedFormattersMemento = new Memento('cachedResourceLabelFormatters', storageService);
|
||||
const memento = this.storedFormattersMemento = new Memento('cachedResourceLabelFormatters2', storageService);
|
||||
this.storedFormatters = memento.getMemento(StorageScope.PROFILE, StorageTarget.MACHINE);
|
||||
this.formatters = this.storedFormatters?.formatters || [];
|
||||
this.formatters = this.storedFormatters?.formatters?.slice() || [];
|
||||
|
||||
// Remote environment is potentially long running
|
||||
this.resolveRemoteEnvironment();
|
||||
|
|
|
@ -166,7 +166,7 @@ suite('URI Label', () => {
|
|||
|
||||
|
||||
test('label caching', () => {
|
||||
const m = new Memento('cachedResourceLabelFormatters', storageService).getMemento(StorageScope.PROFILE, StorageTarget.MACHINE);
|
||||
const m = new Memento('cachedResourceLabelFormatters2', storageService).getMemento(StorageScope.PROFILE, StorageTarget.MACHINE);
|
||||
const makeFormatter = (scheme: string): ResourceLabelFormatter => ({ formatting: { label: `\${path} (${scheme})`, separator: '/' }, scheme });
|
||||
assert.deepStrictEqual(m, {});
|
||||
|
||||
|
|
Loading…
Reference in a new issue