don't use file-uri when creating untitled-files, just pass path information along the side, #49078

This commit is contained in:
Johannes Rieken
2018-05-03 12:33:29 +02:00
parent 809f5dffd1
commit 01a2356098
2 changed files with 17 additions and 8 deletions

View File

@@ -220,11 +220,18 @@ export class MainThreadDocuments implements MainThreadDocumentsShape {
return this._fileService.resolveFile(asFileUri).then(stats => {
// don't create a new file ontop of an existing file
return TPromise.wrapError<boolean>(new Error('file already exists on disk'));
}, err => this._doCreateUntitled(asFileUri).then(resource => !!resource));
}, err => {
return this._doCreateUntitled(uri).then(resource => !!resource);
});
}
private _doCreateUntitled(resource?: URI, modeId?: string, initialValue?: string): TPromise<URI> {
return this._untitledEditorService.loadOrCreate({ resource, modeId, initialValue }).then(model => {
return this._untitledEditorService.loadOrCreate({
resource,
modeId,
initialValue,
useResourcePath: Boolean(resource && resource.path)
}).then(model => {
const resource = model.getResource();
if (!this._modelIsSynced[resource.toString()]) {