Change:
import * as glob from 'vs/base/common/glob'; import { isLinux } from 'vs/base/common/platform'; import { createDecorator } from 'vs/platform/instantiation/common/instantiation'; <del> import { Event } from 'vs/base/common/event'; </del> <ins> import { Event, Emitter } from 'vs/base/common/event'; </ins> import { startsWithIgnoreCase } from 'vs/base/common/strings'; <del> import { IDisposable } from 'vs/base/common/lifecycle'; </del> <ins> import { IDisposable, Disposable } from 'vs/base/common/lifecycle'; </ins> import { isEqualOrParent, isEqual } from 'vs/base/common/resources'; import { isUndefinedOrNull } from 'vs/base/common/types'; <ins> import { ThrottledDelayer } from 'vs/base/common/async'; </ins> export const IFileService = createDecorator<IFileService>('fileService'); <ins> export class FileListener extends Disposable { private readonly _onDidContentChange = new Emitter<IFileStat>(); readonly onDidContentChange: Event<IFileStat> = this._onDidContentChange.event; private watching: boolean = false; private delayer: ThrottledDelayer<void>; private etag: string | undefined; constructor( private readonly file: URI, private readonly fileService: IFileService ) { super(); this.delayer = new ThrottledDelayer<void>(500); } watch(eTag?: string): void { if (!this.watching) { this.etag = eTag; this.poll(); this.watching = true; } } private poll(): void { const loop = () => this.doWatch().then(() => this.poll()); this.delayer.trigger(loop); } private doWatch(): Promise<void> { return this.fileService.resolveFile(this.file) .then(stat => { if (stat.etag !== this.etag) { this.etag = stat.etag; this._onDidContentChange.fire(stat); } }); } unwatch(): void { if (this.watching) { this.delayer.cancel(); this.watching = false; } } dispose(): void { this.unwatch(); super.dispose(); } } </ins> export interface IResourceEncodings { getWriteEncoding(resource: URI, preferredEncoding?: string): string; }

Discussion:
Issue Type: <bBug</bChanges to the file by external sources (extensions/manual edit) are not picked up anymore until VSCode is relaunched. For instance, if you use notepad to add a workspace folder to the file, VSCode won't show the new workspace folder until the workspace is relaunched in VSCode. This also means that if you then add another workspace folder through VSCode, and save the workspace, the workspace folder with notepad is removed. Using the button doesn't trigger a re-read of the file either. This renders the extension rather useless. VS Code version: Code 1.31.0 (, 2019-02-05T22:35:56.624Z) OS version: Windows_NT x64 10.0. Does this issue occur when all extensions are disabled?: Yes Steps to Reproduce: a new workspace 2 folders to the workspace, called and the workspace and save the file, changing the order of the folders using notepad or the extension that the order in VSCode has not been changed and reopen VSCode, notice that the order in VSCode did change
(Experimental duplicate detection) Thanks for submitting this issue. Please also check if it is already covered by an existing one, like: <!-- score: 0.51 --- <!-- score: 0.471 --- <!-- score: 0.46 --<!-- potentialduplicatescomment --
I was not able to reproduce this on macOS at least.
In the screenshot below you can see that VSCode shows a different order of the folders than the file. !
Can you reproduce this with latest vscode insiders?
Yes, I can. The screenshot below shows the difference in the order of the folders between the content of the file within the latest insiders, in this case there are also no extensions active. Changes are not shown in VSCode until it is restarted. !
I can reproduce this also on the mac. The issue here is that the does not fire a event when the order of workspace roots is changed in the code-workspace file. Since the order changed I would expect this event to arrive. Thus forwarding to and
could be the case of a missing file event (given I could not reproduce when I tried on macOS), if so, please forward back to me. did you check if the file event made it through?

--verbose
The file event does not seem to go through. if I start out of source with --verbose flag.
I assume you setup custom file watching for the workspace file right? Where is that code? Does it check for changes?
I think this would have caused by my changes moving away from node based file watching to file service watch. Will investigate further and figure it out.
Thanks for the fix, I just tested it in the new insiders build and everything seems to be working correctly. I am looking forward to the next release!