Skip to content
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

Add indication for externally deleted files #1999

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

pro100filipp
Copy link

Description

Related Issues

Checklist

  • I read and understood the contributing guide as well as the code of conduct
  • The issues this PR addresses are related to each other
  • My changes generate no new warnings
  • My code builds and runs on my machine
  • My changes are all related to the related issue above
  • I documented my code

Screenshots

1936.mov

austincondiff
austincondiff previously approved these changes Feb 25, 2025
Copy link
Collaborator

@austincondiff austincondiff left a comment

Choose a reason for hiding this comment

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

Looks nice, solid work! 🔥

@@ -57,7 +60,7 @@ struct EditorTabView: View {
/// The item associated with the current tab.
///
/// You can get tab-related information from here, like `label`, `icon`, etc.
private var item: CEWorkspaceFile
private let item: CEWorkspaceFile
Copy link
Contributor

Choose a reason for hiding this comment

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

Might be an idea to rename this to something more descriptive?

Copy link
Author

Choose a reason for hiding this comment

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

To be honest my eye just got caught by the var keyword, so I decided to change it to let for the sake of its usage. But I'll push update on the name also – "item" is a no-go naming for sure.

Copy link
Member

@tom-ludwig tom-ludwig left a comment

Choose a reason for hiding this comment

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

Amazing job Filipp! Just two suggestions 😁

///
/// Often returns ``FSEvent/changeInDirectory`` as `FSEventStream` returns
/// Often returns ``[FSEvent/changeInDirectory]`` as `FSEventStream` returns
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure I understand this sentence 😅

Copy link
Author

Choose a reason for hiding this comment

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

I think you might be loosing the other part of it on the next line 🙂

/// Often returns ``[FSEvent/changeInDirectory]`` as `FSEventStream` returns
/// `kFSEventStreamEventFlagNone (0x00000000)` frequently without more information.

This docstring was set before my changes, I only changed the type of returning value

Comment on lines 21 to 29
func fileManagerUpdated(updatedItems: Set<CEWorkspaceFile>) {
guard let parent = item.parent else {
return
}

if updatedItems.contains(parent) {
isDeleted = item.doesExist == false
}
}
Copy link
Member

Choose a reason for hiding this comment

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

I believe this can be simplified, and I’m fairly certain it should be updated on the main thread as well

Suggested change
func fileManagerUpdated(updatedItems: Set<CEWorkspaceFile>) {
guard let parent = item.parent else {
return
}
if updatedItems.contains(parent) {
isDeleted = item.doesExist == false
}
}
func fileManagerUpdated(updatedItems: Set<CEWorkspaceFile>) {
if let parent = item.parent, updatedItems.contains(parent) {
isDeleted = item.doesExist == false
}
}

Copy link
Author

Choose a reason for hiding this comment

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

I think that depends on whether you are a fan of explicit guard's everywhere (like me) or not. But I think you are right and semantics of your suggestion is more clean about the logic and intention of this block.

And of course main thread is a must – missing it was just my mistake.

@pro100filipp
Copy link
Author

Implemented all suggested changes

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.

4 participants