提交 44da540b 编写于 作者: J Johannes Rieken

fix #27949

上级 97dc7073
......@@ -98,6 +98,9 @@ export class ExtHostDocumentsAndEditors extends ExtHostDocumentsAndEditorsShape
this._activeEditorId = delta.newActiveEditor;
}
dispose(removedDocuments);
dispose(removedEditors);
// now that the internal state is complete, fire events
if (delta.removedDocuments) {
this._onDidRemoveDocuments.fire(removedDocuments);
......@@ -112,10 +115,6 @@ export class ExtHostDocumentsAndEditors extends ExtHostDocumentsAndEditorsShape
if (delta.newActiveEditor !== undefined) {
this._onDidChangeActiveTextEditor.fire(this.activeEditor());
}
// now that the events are out, dispose removed documents and editors
dispose(removedDocuments);
dispose(removedEditors);
}
getDocument(strUrl: string): ExtHostDocumentData {
......
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as assert from 'assert';
import URI from 'vs/base/common/uri';
import { ExtHostDocumentsAndEditors } from 'vs/workbench/api/node/extHostDocumentsAndEditors';
import { TPromise } from 'vs/base/common/winjs.base';
suite('ExtHostDocumentsAndEditors', () => {
let editors: ExtHostDocumentsAndEditors;
setup(function () {
editors = new ExtHostDocumentsAndEditors({
_serviceBrand: undefined,
get() { return undefined; },
set() { }
});
});
test('The value of TextDocument.isClosed is incorrect when a text document is closed, #27949', () => {
editors.$acceptDocumentsAndEditorsDelta({
addedDocuments: [{
EOL: '\n',
isDirty: true,
modeId: 'fooLang',
url: URI.parse('foo:bar'),
versionId: 1,
lines: [
'first',
'second'
]
}]
});
return new TPromise((resolve, reject) => {
editors.onDidRemoveDocuments(e => {
try {
for (const data of e) {
assert.equal(data.document.isClosed, true);
}
resolve(undefined);
} catch (e) {
reject(e);
}
});
editors.$acceptDocumentsAndEditorsDelta({
removedDocuments: ['foo:bar']
});
});
});
});
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册