Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: add formatting options for file_history_panel #441

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

Open
protiumx wants to merge 6 commits into sindrets:main
base: main
Choose a base branch
Loading
from protiumx:feat/file-history-panel-commit-format

Conversation

Copy link

@protiumx protiumx commented Nov 21, 2023
edited
Loading

Description

Adding formatting option as a list of parts for the file_history_panel commit list

'status',
'stats',
'hash',
'reflog',
'ref',
'subject',
'author',
 'date'

The default configuration includes all the parts that matches the commit format before this PR.
E.g.

M | 52 64 | ba89b731 (HEAD -> feat/file-history-panel-commit-format, origin/feat/file-history-panel-commit-format) feat: add formatting options as a list Brian Mayo, 7 minutes ago

Implementation

I defined a map of formatters, one per each part which allows the user to use a list as config. This looks up in the map and runs the formatter on the RenderComponent table.
The only significant change in the format is the part for author, date which now will show as author date.
Should we add a different HL to make a distinction?

Stylua prolems

I have ran the following command and it has reformatted a lot of files, I'm not sure why

stylua --glob "*.lua" -a -f stylua.toml .

stylua 0.19.1

Docs

I updated the only the default config docs. I'll need assistance to add an entry in the main docs since I don't have experience writing vim docs

Testing

I covered almost all cases except for date, in the branch that compares against the current time. This test would require to monkey patch os.time which I don't think would be a good practice.

Closes #438

Copy link
Owner

sindrets commented Dec 2, 2023

Thanks for the PR! Really nicely done with the tests :)

I'll try to find time to review this properly sometime over this weekend. Something I can comment on immediately: please remove all unrelated code formatting changes from your PR. It only makes it harder to review the actual changes.

Regarding your question about stylua: we don't use it. I should remove the config in the repo. I don't like how it formats code, and it's my opinion that it often hurts code readability. However, feel free to use it on the code that you write yourself.

Regarding your remarks about monkey patching os.time for tests: mocking timers even by the means of monkey patching is very common in test environments. You can use plenary.busted's before_each(), after_each() hooks to ensure that the patched functions only apply for the duration of the test suite.

Copy link
Author

protiumx commented Dec 3, 2023

Hey @sindrets I removed the format changes. How do you format the lua files? I found the default lua lsp formatter to also produce different results.
Regarding the tests, I have added a case for the date formatter to monkey patch os.diffdate. All cases should be covered

Copy link
Author

protiumx commented Jun 1, 2024

Hi @sindrets, any news for this PR?

greyHairChooseLife and amittamari reacted with eyes emoji

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

[Feature Request] allow to change commit log format in FileHistoryPanel

AltStyle によって変換されたページ (->オリジナル) /