Skip to content

Push newly created file into the workspace (#696) #1057

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 21, 2023

Conversation

RenanGreca
Copy link
Contributor

@RenanGreca RenanGreca commented Feb 17, 2023

Description

  • In FileItem.swift, the addFile function was changed to return the newly created file's path.
  • In NavigationSidebarToolbarBottom.swift, a bit of post-creation code was introduced, placed in the global DispatchQueue, which attempts to open the new file in a new tab in the workspace.

A related PR is being opened in CodeEditTextView, which works in tandem with this one, so the cursor becomes active in the new file after it is created and opened.

Particularly, I would like a review on the code added to NavigationSidebarToolbarBottom.swift, as I'm not 100% sure the DispatchQueue behavior is consistent in this case. Certainly without putting it on the queue, the behavior was completely non-deterministic, because the code would sometimes run before the completion of rebuildFiles in Live.swift (and thus the new FileItem was not yet available).

Related Issue

Checklist

  • I read and understood the contributing guide as well as the code of conduct
  • My changes generate no new warnings
  • My code builds and runs on my machine
  • I documented my code
  • Review requested

Screenshots

Copy link
Collaborator

@thecoolwinter thecoolwinter left a comment

Choose a reason for hiding this comment

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

Looks good, just one change about the DispatchQueue usage.

thecoolwinter pushed a commit to CodeEditApp/CodeEditSourceEditor that referenced this pull request Feb 17, 2023
…#696) (#144)

# Description

<!--- REQUIRED: Describe what changed in detail -->

* In `STTextViewController.swift`, the `setCursorPosition` function was
changed so that, if the currently open file is empty, the cursor is
automatically set to the first position and active. This behavior is
similar to other text editors e.g. VSCode.

A related PR is opened in CodeEdit, which works in tandem with this one,
so that newly-created files automatically open in a new editor tab.

# Related Issue

<!--- REQUIRED: Tag all related issues (e.g. * #23) -->
* [#696](CodeEditApp/CodeEdit#696) from
CodeEdit.
* PR [#1057](CodeEditApp/CodeEdit#1057) from
CodeEdit.

# Checklist

<!--- Add things that are not yet implemented above -->
- [x] I read and understood the [contributing
guide](https://github.com/CodeEditApp/CodeEdit/blob/main/CONTRIBUTING.md)
as well as the [code of
conduct](https://github.com/CodeEditApp/CodeEdit/blob/main/CODE_OF_CONDUCT.md)
- [x] My changes generate no new warnings
- [x] My code builds and runs on my machine
- [x] I documented my code
- [x] Review requested

# Screenshots
@austincondiff austincondiff merged commit 105cfd4 into CodeEditApp:main Feb 21, 2023
@austincondiff
Copy link
Collaborator

@allcontributors add @RenanGreca for code

@allcontributors
Copy link
Contributor

@austincondiff

I've put up a pull request to add @RenanGreca! 🎉

@jpinnix
Copy link

jpinnix commented Mar 14, 2024

Shouldn't #696 and #700 be closed due to this merge?

@austincondiff
Copy link
Collaborator

@jpinnix Thanks for pointing this out. Both of them are now closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants