Add ability to open untitled document with initial content#22021
Add ability to open untitled document with initial content#22021bpasero merged 2 commits intomicrosoft:masterfrom
Conversation
|
@hoovercj, thanks for your PR! By analyzing the history of the files in this pull request, we identified @bpasero and @alexandrudima to be potential reviewers. |
|
@hoovercj, |
|
@hoovercj thanks. /cc @jrieken for the API change |
| }); | ||
|
|
||
| test('openTextDocument, untitled without path but language ID and contents', function () { | ||
| return workspace.openTextDocument({ language: 'html', contents: '<h1>Hello world!</h1>' }).then(doc => { |
| * @return A promise that resolves to a [document](#TextDocument). | ||
| */ | ||
| export function openTextDocument(options?: { language: string; }): Thenable<TextDocument>; | ||
| export function openTextDocument(options?: { language?: string; contents?: string; }): Thenable<TextDocument>; |
There was a problem hiding this comment.
missing jsdoc-comment, also use content to align with TextDocumentContentProvider
|
re #22021 (comment) - that's a personal preference ;-) For me, private fields are underscore-prefixed because that helps me read method bodies. Others use underscore only if a property would collide with a getter/setter otherwise. |
|
As a rule of thumb, when adding to existing code, we should not start a new style but apply the style the code was originally written in. @hoovercj since I already merged this change, I suggest a new PR just for the 💄 changes. |
|
@bpasero I agree with the consistent style comment. I was confused by Regarding a new PR, you are suggesting that I make a new PR that changes contents to content, adds a jsdoc comment, etc.? I can hopefully get to that tonight. |
|
@hoovercj |
|
Yep, now I see that, and that |
Follow up to PR #22021 to respond to feedback
Addresses #21413 by passing file contents down to the
UntitledEditorModel.I checked that it worked locally and I added a test case, but I've had issues getting tests to run as reported in #22019.