Skip to content
This repository was archived by the owner on Jul 27, 2024. It is now read-only.

add more color and regexps: #16

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

anyaharter97
Copy link

@anyaharter97 anyaharter97 commented Jul 17, 2018

add header tag to index

add regexps for:

  • files overview
  • new file mode line
  • deleted file mode line
  • mail header

add color to:

  • range and coordinates
  • header
  • meta separater
  • mail header

add header tag to index

add regexps for files overview
                new file mode line
                deleted file mode line
                mail header

add color to range and coordinates
             header
             meta separater
             mail header
@miketheman
Copy link
Owner

Hello! Thanks for contributing.
Any chance you can provide some more context, as well as adding some test cases to validate these behaviors?

so that multi-line commit messages don't look weird
@anyaharter97
Copy link
Author

In the example I made the colors might seem like a lot in your face but on changes with more than just one line, the color of the headers and ranges make it easier to find the boundaries between commits

The mail header color is just to set it slightly apart from the rest of the file

The newfile and deletefile modes did not used to match the color of the header which seemed off to me so that is fixed in this patch

I guess I just thought it would be pretty to color the pluses and minuses in the file overview part because I've seen that somewhere before

I created an example patch demonstrating the changes I made but I don't know how to attach it to this...

@anyaharter97
Copy link
Author

0001-Example-commit.patch.txt

I added a txt extension to it that hopefully you can just delete and it will behave the same?

@miketheman
Copy link
Owner

Hi @anyaharter97 !
Thanks for explaining further and providing an example.

I tried out the patch, and I think there's some considerations that aren't captured - could you take a pass at adding specs for the situations added in the diff.cson captures?

Here's an example of a spec that confirms a specific capture is being categorized correctly:

it 'tokenizes entries `Only in`', ->
{tokens} = grammar.tokenizeLine('Only in new_version: a.txt')
expect(tokens[0]).toEqual value: 'Only in new_version: a.txt', scopes: [
'source.diff', 'meta.diff.only-in'
]

This becomes helpful to leverage when tweaking regexps - and you can run the tests via apm test or TravisCI will execute them on git push to your branch.

Also - curious why you would add new regexps for things that don't have colors added to them - are you using the scope for something else?

@anyaharter97
Copy link
Author

With the regexps that don't have colors associated, I'm not entirely sure which ones you are referring to. I split up the regexps for the "mail" lines according to what I thought different categories were and which lines had colors in my command line editor. For example, I have attached a screenshot of the coloring for the top of the example patch in vim.
vimcoloring
In terms of splitting up the lines, I just figured it would be better to have back-references to pieces that fit easily into categories that could be colored later if desired.

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

Successfully merging this pull request may close these issues.

2 participants