I’m using VSCode, and syntax highlighting doesn’t work with .exs files.
Confoundingly, it seems that mix test will only include .exs
files.
Is it possible to have both syntax highlighting and doctests in a .ex
file?
I’m using VSCode, and syntax highlighting doesn’t work with .exs files.
Confoundingly, it seems that mix test will only include .exs
files.
Is it possible to have both syntax highlighting and doctests in a .ex
file?
You can enable doctests by adding doctest MyModule
to the test module as seen here
Syntax highlighting is a completely different thing.
I never had any issues with *.exs
back when I used vscode.
If in doubt, just select “elixir” from the list of languages for the file. As a mouse user it’s somewhere in the bottom right, IIRC.
I should have said compiler error syntax highlighting, which isn’t supported:
And this definitely works in a .ex
(not .exs
file)? This and my previous experience seemed show it didn’t work with .ex` files.
Yes, that is referring to test files (that end with _test.exs
). But these are doctests within a module .ex
. Here is another example of how to set it up and use it.