提交 733a1cd8 编写于 作者: M Matt Bierner

Strict null check extHostDocuments

上级 480b838e
......@@ -80,17 +80,26 @@
"./vs/workbench/api/node/extHostConfiguration.ts",
"./vs/workbench/api/node/extHostDecorations.ts",
"./vs/workbench/api/node/extHostDialogs.ts",
"./vs/workbench/api/node/extHostDocumentContentProviders.ts",
"./vs/workbench/api/node/extHostDocumentData.ts",
"./vs/workbench/api/node/extHostDocuments.ts",
"./vs/workbench/api/node/extHostDocumentsAndEditors.ts",
"./vs/workbench/api/node/extHostExtensionActivator.ts",
"./vs/workbench/api/node/extHostFileSystemEventService.ts",
"./vs/workbench/api/node/extHostHeapService.ts",
"./vs/workbench/api/node/extHostLanguages.ts",
"./vs/workbench/api/node/extHostLogService.ts",
"./vs/workbench/api/node/extHostMessageService.ts",
"./vs/workbench/api/node/extHostOutputService.ts",
"./vs/workbench/api/node/extHostProgress.ts",
"./vs/workbench/api/node/extHostSearch.fileIndex.ts",
"./vs/workbench/api/node/extHostSearch.ts",
"./vs/workbench/api/node/extHostStorage.ts",
"./vs/workbench/api/node/extHostTextEditor.ts",
"./vs/workbench/api/node/extHostTypeConverters.ts",
"./vs/workbench/api/node/extHostTypes.ts",
"./vs/workbench/api/node/extHostUrls.ts",
"./vs/workbench/api/node/extHostWebview.ts",
"./vs/workbench/api/node/extHostWindow.ts",
"./vs/workbench/api/node/extHostWorkspace.ts",
"./vs/workbench/api/shared/editor.ts",
......
......@@ -103,8 +103,10 @@ export class ExtHostDocuments implements ExtHostDocumentsShape {
public $acceptModelModeChanged(uriComponents: UriComponents, oldModeId: string, newModeId: string): void {
const uri = URI.revive(uriComponents);
let data = this._documentsAndEditors.getDocument(uri);
const data = this._documentsAndEditors.getDocument(uri);
if (!data) {
throw new Error('unknown document');
}
// Treat a mode change as a remove + add
this._onDidRemoveDocument.fire(data.document);
......@@ -114,14 +116,20 @@ export class ExtHostDocuments implements ExtHostDocumentsShape {
public $acceptModelSaved(uriComponents: UriComponents): void {
const uri = URI.revive(uriComponents);
let data = this._documentsAndEditors.getDocument(uri);
const data = this._documentsAndEditors.getDocument(uri);
if (!data) {
throw new Error('unknown document');
}
this.$acceptDirtyStateChanged(uriComponents, false);
this._onDidSaveDocument.fire(data.document);
}
public $acceptDirtyStateChanged(uriComponents: UriComponents, isDirty: boolean): void {
const uri = URI.revive(uriComponents);
let data = this._documentsAndEditors.getDocument(uri);
const data = this._documentsAndEditors.getDocument(uri);
if (!data) {
throw new Error('unknown document');
}
data._acceptIsDirty(isDirty);
this._onDidChangeDocument.fire({
document: data.document,
......@@ -131,7 +139,10 @@ export class ExtHostDocuments implements ExtHostDocumentsShape {
public $acceptModelChanged(uriComponents: UriComponents, events: IModelChangedEvent, isDirty: boolean): void {
const uri = URI.revive(uriComponents);
let data = this._documentsAndEditors.getDocument(uri);
const data = this._documentsAndEditors.getDocument(uri);
if (!data) {
throw new Error('unknown document');
}
data._acceptIsDirty(isDirty);
data.onEvents(events);
this._onDidChangeDocument.fire({
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册