ByeSpec—a VS Code extension to customize @spec appearance

The byesig extension is one of my favorites when doing Ruby+Sorbet coding. I forked it to create ByeSpec to do the same for Elixir specs. Here’s how I use it:

Before

After

On a light theme

I want to see my specs, but I also want to reduce visual noise from so much text on the screen. Opacity and some other settings are configurable, like the option to show the green markers in the left-hand column. Personally, they help me navigate my code, seeing where the functions begin.

Byesig does code folding too for the Sorbet sigs, which needs a little effort to get working with specs.

This is v1.0.0 and my first IDE extension, so YMMV. :slight_smile:

21 Likes

Vim users can achieve this with the following:

" ~/.vim/after/colors/elixir.vim

hi link elixirFunctionSpec Comment
call matchadd("elixirFunctionSpec", '^\s\+@spec\_.*::.*$')

Regex may need tweaking, I haven’t used this since my old job.

1 Like

Nice one @dogweather. It doesn’t seem to work on multi-line specs. The first line is subdued, but the following lines are not.

Would be handy to be able to subdue @impl too.

2 Likes

Great idea! I’m definitely installing that tomorrow when I get back to work :wink:

Quick licensing heads up: I noticed you’ve replaced the original license file. You should probably restore the original copyright (while keeping your own), as mentioned in the MIT License (“The above copyright notice […] shall be included in all […] substantial portions of the Software.”)

This would do the trick:

MIT License

Copyright (c) 2023 Public.Law
Copyright (c) 2022 Peter Arato
1 Like

@dogweather terrific :fire: thank you for this extension!

Screenshot from 2023-11-24 17-04-30

1 Like

Yeah, you’re right. It’s good to keep a history of this.

1 Like

@dogweather Same for @type

Thanks for this useful extension for people like me who customizes their IDE a lot (perhaps too much :sweat_smile:)

1 Like