allow empty string as valid document content, fixes #6526

This commit is contained in:
Johannes Rieken
2016-05-19 12:45:37 +02:00
parent b6f0eee29e
commit d37a76dc92
2 changed files with 18 additions and 1 deletions

View File

@@ -631,7 +631,7 @@ export class MainThreadDocuments {
this._resourceContentProvider[handle] = ResourceEditorInput.registerResourceContentProvider(scheme, {
provideTextContent: (uri: URI): TPromise<EditorCommon.IModel> => {
return this._proxy.$provideTextDocumentContent(handle, uri).then(value => {
if (value) {
if (typeof value === 'string') {
this._virtualDocumentSet[uri.toString()] = true;
const firstLineText = value.substr(0, 1 + value.search(/\r?\n/));
const mode = this._modeService.getOrCreateModeByFilenameOrFirstLine(uri.fsPath, firstLineText);