nvim-neotest / neotest-go

MIT License
125 stars 43 forks source link

feat: refactor layout #24

Closed Davincible closed 1 year ago

Davincible commented 1 year ago

3 things here)

  1. Allow for custom hex colors in user config
  2. Easily add new colorization with Lua patterns (multi group capture support)
  3. Refactored the code a bit, as I found it easier to work with

Mandatory screenshot; image

You can now define highlights like this

    -- Patterns to colorize in output
    colors = {
        run = { pattern = '(===%s+RUN)%s+(.*)', gui = { '#777777', '#deb887' }, term = { 34, 34 } },
        file = { pattern = '^%s+(.*.go):(%d+):', gui = { '#20b2aa', '#a474dc' }, term = { 36, 35 } },
        pass = { pattern = '^---%s+PASS:', gui = '#14D000', term = 31 },
        fail = { pattern = '^---%s+FAIL:', gui = '#cc0000', term = 32 },
        skip = { pattern = '^---%s+SKIP:', gui = '#729fcf', term = 33 },
    },

Currently only allows users to tweak colors, not define custom highlights. Option to add patterns could be exposed

Davincible commented 1 year ago

Still need to update docs

Davincible commented 1 year ago

I'll see what I can do. Refactoring only consisted of copying some functions into other files though, so as long as they are called properly (which I think they are), everything should work

Davincible commented 1 year ago

@akinsho I've removed my color changes. Functionality should be the same as before now. Functions are pulled out into separate files.

Could you have a look and merge this if you agree with it?

Davincible commented 1 year ago

@akinsho I felt like it was easier to work with smaller files to conceptually understand what's where, felt less cluttered, which was my reasoning for separating them out. Especially in the beginning while trying to understand the code and find where I needed to be to make the relevant changes.

You're right about the formatting, I've copied over the stylua.toml file from the neotest core to here, so it's all the same.