Skip to content

Conversation

@andyleejordan
Copy link
Member

Receive a EditorOperationResponse (not yet otherwise used). Delete dead code. Add optional content parameter to NewFile. Expose CloseFile and SaveFile. Fix an outdated warning message.

Part of PowerShell/vscode-powershell#4703 so I could test it.

@andyleejordan andyleejordan requested a review from a team August 17, 2023 02:11
@andyleejordan andyleejordan added Issue-Enhancement A feature request (enhancement). Area-API labels Aug 17, 2023
@andyleejordan
Copy link
Member Author

Tested that last commit with a temporary multi-root workspace:

> $pseditor.GetEditorContext().CurrentFile.WorkspacePath
mocks/BinaryModule/BinaryModuleTest.ps1
@andyjordane318 ...src/vscode-powershell/test/mocks andyleejordan/fix-newfile-casing ≡ +0 ~1 -0 !
> $pseditor.GetEditorContext().CurrentFile.WorkspacePath
features/CustomViews.test.ts
@andyjordane318 ...src/vscode-powershell/test/mocks andyleejordan/fix-newfile-casing ≡ +0 ~1 -0 !
> $pseditor.GetEditorContext().CurrentFile.WorkspacePath
untitled:Untitled-1

Copy link
Collaborator

@SeeminglyScience SeeminglyScience left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a couple of changes so we don't introduce binary breaking changes, other than that LGTM

Receive a `EditorOperationResponse` (not yet otherwise used). Delete
dead code. Add optional `content` parameter to `NewFile`. Expose
`CloseFile` and `SaveFile`. Fix an outdated warning message.
Since `Path` now refers to initial working directory.
public void NewFile() => editorOperations.NewFileAsync().Wait();
/// <param name="content">The content to place in the new file.</param>
public void NewFile(string content) => editorOperations.NewFileAsync(content).Wait();
public void NewFile(string content = "") => editorOperations.NewFileAsync(content).Wait();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
public void NewFile(string content = "") => editorOperations.NewFileAsync(content).Wait();

think the previous suggestion bugged out (or I did it wrong)

@andyleejordan andyleejordan force-pushed the andyleejordan/extension-api branch from 0849ad9 to 0d30182 Compare August 22, 2023 20:07
}

public async Task NewFileAsync()
public async Task NewFileAsync(string content = "")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
public async Task NewFileAsync(string content = "")
public async Task NewFileAsync() => NewFileAsync(string.Empty);
public async Task NewFileAsync(string content)

@andyleejordan andyleejordan force-pushed the andyleejordan/extension-api branch from 0d30182 to 6805767 Compare August 22, 2023 20:11
So as to now add a binary breaking change.

Co-authored-by: Patrick Meinecke <SeeminglyScience@users.noreply.github.com>
@andyleejordan andyleejordan force-pushed the andyleejordan/extension-api branch from 6805767 to f6245f4 Compare August 22, 2023 20:14
Copy link
Collaborator

@SeeminglyScience SeeminglyScience left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! ❤️

@andyleejordan andyleejordan added this pull request to the merge queue Aug 22, 2023
Merged via the queue into main with commit 85fd5be Aug 22, 2023
@andyleejordan andyleejordan deleted the andyleejordan/extension-api branch August 22, 2023 20:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area-API Issue-Enhancement A feature request (enhancement).

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants