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

Highlight git/VCS modified files in explorer, palette, and buffer tabs #1856

Merged
merged 4 commits into from Jan 4, 2023

Conversation

claytonrcarter
Copy link
Contributor

@claytonrcarter claytonrcarter commented Dec 23, 2022

  • Added an entry to CHANGELOG.md if this change could be valuable to users

Hi there! I'm enjoying using Lapce and excited to contribute to the project. This PR upates the styling of file names in the file explorer, file palette, and editor tab headers to reflect their curreng git/VCS status. I found this feature really useful in Atom (RIP). I've been using this locally for several days, and it has been accurate and stable so far.

Screenshot showing updated styling:
Screen Shot 2023-01-03 at 10 56 01 PM

Notes:

  • no new system calls were needed; the data was already present on LapceTabData.file_diffs, it just needed to be tweaked a little to be accessible where needed
  • LapceTabData.file_diffs is currently a Vec<(FileDiff, bool)>; this changes it to a HashMap<PathBuf, FileDiff> (for easy lookup by path) and adds a new file_list: Vec<(PathBuf, bool)> to support the int based indexing that's happening on the Vec
  • modified, added, deleted are highlighted, along with their containing directories
    • note that directories are only displayed as modified, not added or deleted

Specific things to look for during review:

  • I don't expect a performance hit, but perhaps a limited memory usage increase. I'm not able to quantify that at this time, though. Any insight you have here would be great.
  • I think I picked the right theme colors, but this should definitely be confirmed.
  • I've only been working w/ Lapce for a week or so, so I likely did something very wrong somewhere in here. All suggestions are very welcome!

References:

@claytonrcarter claytonrcarter marked this pull request as ready for review December 23, 2022 04:17
@codecov-commenter
Copy link

codecov-commenter commented Dec 23, 2022

Codecov Report

Merging #1856 (6eb9a07) into master (1c7815b) will decrease coverage by 0.01%.
The diff coverage is 0.00%.

@@            Coverage Diff            @@
##           master   #1856      +/-   ##
=========================================
- Coverage    6.94%   6.93%   -0.02%     
=========================================
  Files         128     128              
  Lines       55532   55636     +104     
=========================================
  Hits         3857    3857              
- Misses      51675   51779     +104     
Impacted Files Coverage Δ
lapce-data/src/data.rs 0.00% <0.00%> (ø)
lapce-data/src/editor.rs 0.00% <0.00%> (ø)
lapce-data/src/palette.rs 4.16% <0.00%> (-0.02%) ⬇️
lapce-data/src/source_control.rs 0.00% <0.00%> (ø)
lapce-ui/src/editor/tab_header_content.rs 12.48% <0.00%> (-0.07%) ⬇️
lapce-ui/src/explorer.rs 0.00% <0.00%> (ø)
lapce-ui/src/palette.rs 0.00% <0.00%> (ø)
lapce-ui/src/source_control.rs 0.00% <0.00%> (ø)
lapce-ui/src/tab.rs 0.00% <0.00%> (ø)
lapce-ui/src/app.rs 0.00% <0.00%> (ø)
... and 5 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@claytonrcarter claytonrcarter marked this pull request as draft January 3, 2023 03:54
@claytonrcarter claytonrcarter marked this pull request as ready for review January 4, 2023 04:02
@claytonrcarter
Copy link
Contributor Author

Oops, I forgot to include a screenshot of these changes in action when I opened this PR:
Screen Shot 2023-01-03 at 10 56 01 PM

@MinusGix MinusGix added the A-ui Area: UI rendering and interactions label Jan 4, 2023
@dzhou121
Copy link
Collaborator

dzhou121 commented Jan 4, 2023

Excellent work! Thanks!

@dzhou121 dzhou121 merged commit 9d0a33f into lapce:master Jan 4, 2023
@claytonrcarter claytonrcarter deleted the vcs-status-color branch January 4, 2023 19:47
@panekj panekj added this to the Next release milestone Jan 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ui Area: UI rendering and interactions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants