diff --git a/extensions/vscode-api-tests/src/workspace.test.ts b/extensions/vscode-api-tests/src/workspace.test.ts index 89ba7a38602f5751fa073af3b0f17aca99a18c6d..0e8a23e8f3925adaa36eabe262762cb0886d1d85 100644 --- a/extensions/vscode-api-tests/src/workspace.test.ts +++ b/extensions/vscode-api-tests/src/workspace.test.ts @@ -100,8 +100,8 @@ suite('workspace-namespace', () => { }); }); - test('openTextDocument, untitled without path but language ID and contents', function () { - return workspace.openTextDocument({ language: 'html', contents: '

Hello world!

' }).then(doc => { + test('openTextDocument, untitled without path but language ID and content', function () { + return workspace.openTextDocument({ language: 'html', content: '

Hello world!

' }).then(doc => { assert.equal(doc.uri.scheme, 'untitled'); assert.equal(doc.languageId, 'html'); assert.ok(doc.isDirty); diff --git a/src/vs/vscode.d.ts b/src/vs/vscode.d.ts index 3f67c01d6c8e42f4f023b27200ded140def33b16..0dc764fd500947af9dc24f90943cadfcfeb4b25a 100644 --- a/src/vs/vscode.d.ts +++ b/src/vs/vscode.d.ts @@ -4080,12 +4080,12 @@ declare module 'vscode' { /** * Opens an untitled text document. The editor will prompt the user for a file * path when the document is to be saved. The `options` parameter allows to - * specify the *language* of the document. + * specify the *language* and/or the *content* of the document. * * @param options Options to control how the document will be created. * @return A promise that resolves to a [document](#TextDocument). */ - export function openTextDocument(options?: { language?: string; contents?: string; }): Thenable; + export function openTextDocument(options?: { language?: string; content?: string; }): Thenable; /** * Register a text document content provider. diff --git a/src/vs/workbench/api/node/extHost.api.impl.ts b/src/vs/workbench/api/node/extHost.api.impl.ts index 58f32f4c8c8d12fb9df2149428b8eba4d4e201fc..995031bdfbaf051ac8bffbf404bf3a3a05451428 100644 --- a/src/vs/workbench/api/node/extHost.api.impl.ts +++ b/src/vs/workbench/api/node/extHost.api.impl.ts @@ -368,10 +368,10 @@ export function createApiFactory(initData: IInitData, threadService: IThreadServ set textDocuments(value) { throw errors.readonly(); }, - openTextDocument(uriOrFileNameOrOptions?: vscode.Uri | string | { language?: string; contents?: string; }) { + openTextDocument(uriOrFileNameOrOptions?: vscode.Uri | string | { language?: string; content?: string; }) { let uriPromise: TPromise; - let options = uriOrFileNameOrOptions as { language?: string; contents?: string; }; + let options = uriOrFileNameOrOptions as { language?: string; content?: string; }; if (!options || typeof options.language === 'string') { uriPromise = extHostDocuments.createDocumentData(options); } else if (typeof uriOrFileNameOrOptions === 'string') { diff --git a/src/vs/workbench/api/node/extHost.protocol.ts b/src/vs/workbench/api/node/extHost.protocol.ts index 1862112d114db78acf13f9cb6854ded5f3677dc4..51d64d7dc8e2a5d21c52d17c891e9c374b4f65bc 100644 --- a/src/vs/workbench/api/node/extHost.protocol.ts +++ b/src/vs/workbench/api/node/extHost.protocol.ts @@ -120,7 +120,7 @@ export abstract class MainThreadDiagnosticsShape { } export abstract class MainThreadDocumentsShape { - $tryCreateDocument(options?: { language?: string; contents?: string; }): TPromise { throw ni(); } + $tryCreateDocument(options?: { language?: string; content?: string; }): TPromise { throw ni(); } $tryOpenDocument(uri: URI): TPromise { throw ni(); } $registerTextContentProvider(handle: number, scheme: string): void { throw ni(); } $onVirtualDocumentChange(uri: URI, value: ITextSource): void { throw ni(); } diff --git a/src/vs/workbench/api/node/extHostDocuments.ts b/src/vs/workbench/api/node/extHostDocuments.ts index 4763902f279f34d1d370df2562a2971badbecfe7..f2eded6cbc66a4cc89efda62e3db31d3a6f08051 100644 --- a/src/vs/workbench/api/node/extHostDocuments.ts +++ b/src/vs/workbench/api/node/extHostDocuments.ts @@ -101,7 +101,7 @@ export class ExtHostDocuments extends ExtHostDocumentsShape { return promise; } - public createDocumentData(options?: { language?: string; contents?: string }): TPromise { + public createDocumentData(options?: { language?: string; content?: string }): TPromise { return this._proxy.$tryCreateDocument(options); } diff --git a/src/vs/workbench/api/node/mainThreadDocuments.ts b/src/vs/workbench/api/node/mainThreadDocuments.ts index ae4e71de2c11788a6f8c4e37f7240790ac6a668d..495b40acfbb49fbea1b691b25775f33d581f5c7c 100644 --- a/src/vs/workbench/api/node/mainThreadDocuments.ts +++ b/src/vs/workbench/api/node/mainThreadDocuments.ts @@ -228,8 +228,8 @@ export class MainThreadDocuments extends MainThreadDocumentsShape { }); } - $tryCreateDocument(options?: { language?: string, contents?: string }): TPromise { - return this._doCreateUntitled(void 0, options ? options.language : void 0, options ? options.contents : void 0); + $tryCreateDocument(options?: { language?: string, content?: string }): TPromise { + return this._doCreateUntitled(void 0, options ? options.language : void 0, options ? options.content : void 0); } private _handleAsResourceInput(uri: URI): TPromise {