ryanwinchester

ryanwinchester

Does anybody else feel this way about @spec (visually overpowering)?

Anybody here feel this way (or have better syntax highlighting)?

It feels overwhelming/noisy.

https://twitter.com/ryanrwinchester/status/953495758484905984

Most Liked Switch mode

tme_317

tme_317

Hi @ryanwinchester,

I feel exactly the same way you do. I understand the arguments around typing in Elixir leading to this long thread. For now dialyzer is the best we can get.

Rather than fork the repo and run my own version of the extension as gonz suggests, I just keep a custom copy of the grammar file elixir.json along with a custom color scheme/theme file based on ST3’s Monokai in a private repo under ~/.vscode/extensions.

When I want to make tweaks to syntax highlighting, I just edit the elixir.json grammar and optionally the theme file, then run an .exs script which copies it over the installed extension’s files. Whenever the extension updates itself I have to manually re-run the script to copy over the files again. This is a pain but easier IMO than the fork…pull from upstream…merge option every time there is a new extension release.

Here is the snippet of JSON you will need in your custom elixir.json file located at ~/.vscode/extensions/JakeBecker.elixir-ls-0.2.10/syntaxes and it should work out-of-the-box with any color scheme you like:

{
  "comment": "treat @spec as a comment/documentation to de-emphasize",
  "begin": "@spec ",
  "beginCaptures": {
    "0": {
      "name": "comment.documentation.spec.elixir"
    }
  },
  "while": "(^|\\G)(?!\\s*(def |defp ))",
  "contentName": "comment.documentation.spec.elixir"
}

This assumes the @spec line(s) are directly before a def or defp line.

Please let me know if this helps or if you’d like me to put a gist up.

OvermindDL1

OvermindDL1

Uhh, why would you not want to? Types put into comments is as good as no types at all as far as the compiler is concerned… o.O

Do note, dialyzer is part of and comes with the BEAM/OTP.

Add it as a git pre-commit hook or in your CI or as part of your compilation command itself. :wink:

I would so very much love this instead:

def some_function(some_arg :: SomeType.t()) :: SomeOtherType.t() do
  ...
end

Then have each head be properly combined and all finally as a BEAM spec. :slight_smile:

gon782

gon782

I don’t really agree, but why not just change your theme to make up for it? It’s not very likely to change based on the idea of it being too visually distinctive.

Last Post!

dogweather

dogweather

Where Next?

Trending in Discussions Top

AstonJ
As the title says, please share what you’ve been up to with Elixir. Whether that’s been learning it, looking into it, making stuff with i...
2976 91332 914
New
byu
@chrismccord : I just saw the Extract AGENTS.md from Phoenix.new into phx.new generator commit to the phoenix project. My initial shotgu...
New
arcanemachine
I was working on an Ecto migration and I needed a timestamp. So, for the nth time, I looked up the different data types for timestamps, a...
New
AstonJ
Just a general thread to post chat/news/info relating to AI/ML stuff that may be relevant for Nx now or in the future. Got anything to sh...
New
type1fool
I just stumbled on a newly redesigned elixir-lang.org. :tada: It looks like @Software_Mansion did the work, and I think it is generally a...
New
juhalehtonen
There has been a thread to discuss the Stack Overflow Developer Survey on this forum every year since 2018, so here’s yet another one for...
New
alexslade
Fly’s CEO posted this recently - Turn And Face The Strange · The Fly Blog It says that Fly is going all-in on sprites, which is a worry ...
New

Other Trending Topics Top

JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve. They are GUI (Emerge) and State management (S...
New
ausimian
Emily is an Elixir library that runs Nx computations on Apple’s MLX. Install it as the default Nx backend and Nx, defn, Axon, Nx.Serving,...
New
akoutmos
@hugobarauna and I (Alex Koutmos) have been hard at work on writing a book on Nerves that takes you from simply blinking LEDs to building...
New
zachdaniel
Introducing AshStorage! Attachment and file management that slots directly into your resources :smiling_face_with_sunglasses: I had hope...
New

We're in Beta

About us Mission Statement