tmbb
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 · GitHub
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
Trending in Announcing
Other Trending Topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #blog-post
- #elixir-ls
- #ai
- #elixirconf-us
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming













Showing Posts 1 to 5- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
Eiji
@tmbb Hmm … honestly I do not see why it’s a standalone library … If I remember correctly
makeupis used even inex_doc, so I do not see why it could not be a part ofphoenix… Did you proposed this enhancement before? If so can you please link to such discussion for a reference, please?tmbb
The debugger is part of Plug and not Phoenix. I’ve proposed to add syntax highlighting to Plug here: Syntax highlihting for the Debugger: minimum viable PR; needs cleaning by tmbb · Pull Request #763 · elixir-plug/plug · GitHub
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.Endpointmodule (as my last message from that PR explains).Eiji
Sorry, my mistake. I mean exactly what you wrote here:
Thanks! Now I can see the case …
This is exactly what I had in mind …
and that’s your answer.
I quoted those parts as I believe there are the most interesting for other people interested in this topic.
I have only one question …
Can you please describe if and how it’s possible to write said debuggers and have your syntax highlighting at the same time? From what I can see
PhoenixWithPrettyDebugger.Plug.PrettyDebugger.Highlightermodule is private (@moduledoc false), so you do not exposing it’s API, right?tmbb
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.
tmbb
I’ve added some new capabilities to my debugger. You can now (using the debugger page) add breakpoints to a function in on any of the frames and replay the request handling with that breakpoint (and pry that breakpoint in IEx). You have to start your phoenix app
It’s not as useful as I though it would be (beam stack frames aren’t that awesome and they lose a lot of information), but its pretty cool. It can also serve as an example for other who might want to extend Phoenix’s debugger.
You can get it from github master.