mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-07 09:35:41 -05:00
Merge from vscode 1eb87b0e9ce9886afeaecec22b31abd0d9b7939f (#7282)
* Merge from vscode 1eb87b0e9ce9886afeaecec22b31abd0d9b7939f * fix various icon issues * fix preview features
This commit is contained in:
@@ -35,20 +35,24 @@ export class JSONEditingService implements IJSONEditingService {
|
||||
this.queue = new Queue<void>();
|
||||
}
|
||||
|
||||
write(resource: URI, value: IJSONValue, save: boolean): Promise<void> {
|
||||
return Promise.resolve(this.queue.queue(() => this.doWriteConfiguration(resource, value, save))); // queue up writes to prevent race conditions
|
||||
write(resource: URI, values: IJSONValue[], save: boolean): Promise<void> {
|
||||
return Promise.resolve(this.queue.queue(() => this.doWriteConfiguration(resource, values, save))); // queue up writes to prevent race conditions
|
||||
}
|
||||
|
||||
private async doWriteConfiguration(resource: URI, value: IJSONValue, save: boolean): Promise<void> {
|
||||
private async doWriteConfiguration(resource: URI, values: IJSONValue[], save: boolean): Promise<void> {
|
||||
const reference = await this.resolveAndValidate(resource, save);
|
||||
await this.writeToBuffer(reference.object.textEditorModel, value);
|
||||
await this.writeToBuffer(reference.object.textEditorModel, values);
|
||||
|
||||
reference.dispose();
|
||||
}
|
||||
|
||||
private async writeToBuffer(model: ITextModel, value: IJSONValue): Promise<any> {
|
||||
const edit = this.getEdits(model, value)[0];
|
||||
if (this.applyEditsToBuffer(edit, model)) {
|
||||
private async writeToBuffer(model: ITextModel, values: IJSONValue[]): Promise<any> {
|
||||
let hasEdits: boolean = false;
|
||||
for (const value of values) {
|
||||
const edit = this.getEdits(model, value)[0];
|
||||
hasEdits = this.applyEditsToBuffer(edit, model);
|
||||
}
|
||||
if (hasEdits) {
|
||||
return this.textFileService.save(model.uri);
|
||||
}
|
||||
}
|
||||
@@ -133,4 +137,4 @@ export class JSONEditingService implements IJSONEditingService {
|
||||
}
|
||||
}
|
||||
|
||||
registerSingleton(IJSONEditingService, JSONEditingService, true);
|
||||
registerSingleton(IJSONEditingService, JSONEditingService, true);
|
||||
|
||||
Reference in New Issue
Block a user