tmbb

tmbb

Syntax Highlighting for code in the Phoenix (= Plug) debugger

Just created a very simple library that allows you to have syntax highlighting in the Phoenix debugger. Code here: GitHub - tmbb/phoenix_with_pretty_debugger: Add syntax highlighting to the Plug debugger used by Phoenix

PhoenixWithPrettyDebugger

Adds support for syntax highlighting in the Phoenix debugger.

To use, replace the following line in your application’s endpoint:


use Phoenix.Endpoint, otp_app: :your_app

by the this line:


use PhoenixWithPrettyDebugger.Endpoint, otp_app: :your_app

No other changes are needed.

Happy hacking with a prettier debugging experience!

The highlighter supports elixir and erlang by default (so it can even highlight code in the cowboy modules). Internaly this project uses the makeup syntax highlighting library and you can add support for other languages by importing the appropriate lexers.

Example output:

Highlighting Elixir:

Highlighting Erlang:

Is this safe?!

This library simply defines an alternative to the default Phoenix.Endpoint module which is actually API compatible. We reuse as much functionality from that module as possible and only redefine the parts we need to add our new debugger. Becuase the debugger is only used in :dev and never in :prod

Most Liked

tmbb

tmbb

The debugger is part of Plug and not Phoenix. I’ve proposed to add syntax highlighting to Plug here: https://github.com/elixir-plug/plug/pull/763#issuecomment-703064494

I think that instead of adding syntax highlighting to plug debugger is rather have a way of of setting a custom debugger in the Phoenix.Endpoint module (as my last message from that PR explains).

tmbb

tmbb

Can you please describe if and how it’s possible to write said debuggers and have your syntax highlighting at the same time?

You just have to duplicate the functionality in your own debugger module, of course. I’m not interested at all in exposing any part of this as public API. Just copy and paste the relevant files into your own project.

Where Next?

Popular in Libraries Top

josevalim
Hi everyone, We would like to announce that Plataformatec is working on a new MySQL driver called MyXQL. Our goal is to eventually integ...
New
kelvinst
Hey everyone! Well, we made this lib a while ago and now we decided to finally go out and public with it! It’s a tool for creating and m...
New
dbern
I’m excited to announce that TaxJar has developed and open-sourced DateTimeParser. We developed it because we found a need to parse user ...
New
danschultzer
In short Plug n’ play OAuth 2.0 provider library. Just set up a resource owner schema with Ecto (your user schema), install the dependen...
New
danschultzer
None of the current solutions worked well for me, so I went ahead and built a user management system from scratch. This project took far...
548 27727 240
New
alisinabh
Hey everyone i’ve developed a library for Jalaali calendar for elixir which supports converting Gregorian dates to Jalaali and vice vers...
New
ahamez
Hi everyone, I’ve been working on this protobuf library for 3 years. We use it in the company I work for, EasyMile, to communicate with ...
New
gabrielpoca
Hello everyone! I want to share with you something that I’m really proud of: https://stillstatic.io/ Still is a static site builder for...
New
tmbb
I’ve decided to create this topic to discuss optimization possibilities for something like Phoenix LiveView. I’ve created this topic unde...
New
gjaldon
As the title states, EctoEnum has just been updated after some time of hardly any activity in the repo. Here’s the latest release: https:...
New

Other popular topics Top

itssasanka
Hi all, Trying to get some more clarity over utc_datetime and naive_datetime for Ecto: https://hexdocs.pm/ecto/Ecto.Schema.html#module-...
New
axelson
This post is a wiki (feel free to hit the edit button near the bottom right of this post to add your own changes!) This post collects co...
239 45766 226
New
AstonJ
You’re a programmer, so you don’t need spoon feeding with the conventional drivel about “this is an integer.” No. You need to know what’s...
New
Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
New
vac
Hi, I'm quite new in Elixir and I'm trying to format a string to a PEM format. I have the certificate value like MIIDBTCCAe2...... and ...
New
mcarvalho
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
mgjohns61585
Could someone help me? I'm making my first elixir program, number guessing game. I can't figure out how to convert the user's guess from ...
New
minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
Qqwy
Original source of discussion: This topic on the Pragmatic Programmers' Functional Web Development with Elixir, OTP, and Phoenix forum. ...
New
lucidguppy
I have a super simple question about elixir - how would I take a file like this foo bar baz and output a new file that enumerates th...
New

Sub Categories:

We're in Beta

About us Mission Statement