src/vs/platform/configuration/common/userConfigurationFileService.ts/UserConfigurationFileService/doWrite
class UserConfigurationFileService:	private async doWrite(resource: URI, jsonValue: IJSONValue, formattingOptions: FormattingOptions): Promise<void> {
		this.logService.trace(`${UserConfigurationFileServiceId}#write`, resource.toString(), jsonValue);
		const { value, mtime, etag } = await this.fileService.readFile(resource, { atomic: true });
		let content = value.toString();

		const parseErrors: ParseError[] = [];
		parse(content, parseErrors, { allowTrailingComma: true, allowEmptyContent: true });
		if (parseErrors.length) {
			throw new Error(UserConfigurationErrorCode.ERROR_INVALID_FILE);
		}

		const edit = this.getEdits(jsonValue, content, formattingOptions)[0];
		if (edit) {
			content = content.substring(0, edit.offset) + edit.content + content.substring(edit.offset + edit.length);
			try {
				await this.fileService.writeFile(resource, VSBuffer.fromString(content), { etag, mtime });
			} catch (error) {
				if ((<FileOperationError>error).fileOperationResult === FileOperationResult.FILE_MODIFIED_SINCE) {
					throw new Error(UserConfigurationErrorCode.ERROR_FILE_MODIFIED_SINCE);
				}
			}
		}
	}