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

feat: improve colored output #26

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

Conversation

Davincible
Copy link
Contributor

Continuation of #24

@Davincible
Copy link
Contributor Author

image

I've added more coloring for testify output, the extra coloring is nice but I'm not sure about the colors themselves yet. Open to suggestions

@Davincible
Copy link
Contributor Author

Panic highlight:
image

Copy link
Collaborator

@akinsho akinsho left a comment

Choose a reason for hiding this comment

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

This generally looks good to me. I've made a few comments about using builtin helper functions instead of custom ones and some other suggestions/questions

lua/neotest-go/color.lua Outdated Show resolved Hide resolved
lua/neotest-go/color.lua Outdated Show resolved Hide resolved
lua/neotest-go/color.lua Show resolved Hide resolved
lua/neotest-go/color.lua Outdated Show resolved Hide resolved
lua/neotest-go/color.lua Outdated Show resolved Hide resolved
lua/neotest-go/color.lua Outdated Show resolved Hide resolved
@@ -1,7 +1,93 @@
local termcolors = {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should these come from a user's config, but default to these values to start, so they can be easily overridden?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. What do you think would be the best behavior here;

  1. if a user specifies a custom pattern, replace all patterns with the users' patterns
  2. if a user specifies a custom pattern, add on to default patterns, and overwrite the default pattern if they have the same name

Copy link
Collaborator

Choose a reason for hiding this comment

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

@Davincible I think in most cases plugin authors use vim.tbl_deep_extend i.e. we only ever replace something that has been specifically changed by the user so essentially option 2

@Davincible
Copy link
Contributor Author

Changed to built-in functions. Didn't know about them

@Davincible
Copy link
Contributor Author

Davincible commented Nov 7, 2022

There are two small bugs I'm not sure how to resolve;

  1. if a panic occurs and the goroutine number is 19, this artifact occurs
  2. sometimes patterns get overwritten by others, here the bytes after the file number are uncolored. This happens randomly. This is because color patterns in the table are unordered, which is fine, but even though all patterns should get applied to the same line, they somehow don't.

image

Edit:
Nr. 1 happens because it does a 'replace all' on the number 19, which happens to be also contained in the color codes. Thus currently a pattern like <red>ABC</red> <green>ABC</green> wouldn't work because all occurrences would be colored green

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.

2 participants