<turbo-stream action="append" target="posts_list"><template>    <div class="postbit" id="293098" data-post-id="293098">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="w0rd-driven" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/w0rd-driven/120/18448_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  w0rd-driven
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>There’s also <a href="https://github.com/kagux/ex_debug_toolbar" class="inline-onebox" rel="noopener nofollow ugc">GitHub - kagux/ex_debug_toolbar: A debug web toolbar for Phoenix projects to display all sorts of information about request · GitHub</a> which is likely no longer active, <a href="https://github.com/mcrumm/phoenix_profiler" class="inline-onebox" rel="noopener nofollow ugc">GitHub - mcrumm/phoenix_profiler: Web Profiler and Debug Toolbar for Phoenix Framework · GitHub</a>, and <a href="https://github.com/caleb-bb/periscope" class="inline-onebox" rel="noopener nofollow ugc">GitHub - caleb-bb/periscope: Tools for analyzing Phoenix Liveview applications · GitHub</a> which were both updated this year. I mention them all for inspiration as there may be approaches that don’t require so much manual intervention.</p>
<p>I also see you’re using System.cmd to launch VSCode when you could take the approach from <a href="https://angelika.me/2020/03/22/link-phoenix-debug-page-stack-trace-to-your-editor/" class="inline-onebox" rel="noopener nofollow ugc">Link Phoenix debug page stack trace to your editor | Angelika.me</a> using a custom url scheme to open most editors. I could see wanting to use Zed for instance but I don’t know if it supports url schemes yet.</p>
<p>I’ve been pining for a LiveView tools chrome extension that is as good as Vue tools but it doesn’t exist. It possibly requires packaging Erlang and Elixir which seems possible but tricky. It may not technically require a runtime if extension points were exposed but I haven’t deeply explored Vue tools to see what would be necessary. This is a great step in that direction though so thanks.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="293098" data-batch-url="/posts/batch_likers">
                        4
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/made-a-source-code-inspector-useful-in-big-projects-or-large-teams/56792/12">Post #11</a>
	                </div>
	            </div>
              <div id="likers-container-293098" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="293098"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #11"></div>
  </section>
</div>
    <div class="postbit" id="293100" data-post-id="293100">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="derpycoder" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/derpycoder/120/31388_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  derpycoder
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group quote-modified" data-username="w0rd-driven" data-post="12" data-topic="56792">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/w0rd-driven/48/18448_2.png" class="avatar"> w0rd-driven:</div>
<blockquote>
<p>Link Phoenix debug page stack trace to your editor | <a href="http://Angelika.me" rel="noopener nofollow ugc">Angelika.me</a></p>
</blockquote>
</aside>
<p>Thanks for sharing this treasure trove of useful debug tools. Really inspiring.</p>
<p>It makes me wonder, how LiveView tooling will look in the browser.</p>
<p>And I’m definitely going to take ideas from Angelika.</p>
<hr>
<p>Here’s what I’m thinking to add to my project.</p>
<p>An Inspector module that can solve all the problems I face, one by one:</p>
<ol>
<li>Jump to source code, from a component, or from an error page.</li>
<li>Tell me the Git branch and current release tag. (Helpful for QA, so they can know they are testing the proper release)</li>
<li>Give me all the socket assigns.</li>
<li>Ping latency.<br>
…</li>
</ol> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="293100" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/made-a-source-code-inspector-useful-in-big-projects-or-large-teams/56792/13">Post #12</a>
	                </div>
	            </div>
              <div id="likers-container-293100" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="293100"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #12"></div>
  </section>
</div>
    <div class="postbit" id="293129" data-post-id="293129">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="derpycoder" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/derpycoder/120/31388_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  derpycoder
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Now, I won’t get lost trying to find the page where Auth-related code exists.</p>
<p><img src="https://forum.elixirforum.com/uploads/default/original/3X/f/f/ff2fbddb756cbd5efee984a5da0269c907a1ade4.gif" alt="Source Inspector Auth Pages" data-base62-sha1="Apu2xlVzRhBpeA6PCZhPF9im4jG" width="656" height="600" class="animated"></p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="293129" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/made-a-source-code-inspector-useful-in-big-projects-or-large-teams/56792/14">Post #13</a>
	                </div>
	            </div>
              <div id="likers-container-293129" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="293129"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #13"></div>
  </section>
</div>
    <div class="postbit" id="293188" data-post-id="293188">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="tmbb" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  tmbb
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I’ve really enjoyed this idea! And, true to form, I’ve decided to try and package it into a neat and very opinioinanted library which can be used in any project. You can find it here: <a href="https://github.com/tmbb/source_inspector" class="inline-onebox" rel="noopener nofollow ugc">GitHub - tmbb/source_inspector: Source Inspector for your LiveView components · GitHub</a>. Although many steps are still very manual (you need to specify where you want to add “html breakpoint” and which components you want to expose to the source inspector), the library itself doesn’t contain any project-specific code. The HTML representation isn’t actually as pretty, but I think is definitely quite functional.</p>
<p>The main concepts in this library are inspired by the default Elixir debugging features:</p>
<ul>
<li>
<p><code>SourceInspector.inspeectable()</code> (macro) - marks a LiveView component as inspectable. It adds a number of attributes to the component (which are opaque to the user) that allow us to set breakpoints and <code>pry()</code> on the component.</p>
</li>
<li>
<p><code>SourceInspector.breakpoint()</code> (macro) - establishes a place in an HTML element that can work as a “debugging breakpoint”. When added to an HTML element (not to a component!), it allows the user to right-click the HTML element and open the file that defines the <em>component</em> that returns the HTML.</p>
</li>
<li>
<p><code>SourceInspector.pry()</code> (macro) - activates the breakpoint(s) in a component: when a component is activated with <code>SourceInspector.pry()</code>, clicking the HTML defined by the element will send the user to the file and line where the component is called (i.e., to teh line where the <code>SourceInspector.pry()</code> macro is used.</p>
</li>
</ul>
<p>This is all a bit abstract, so let’s see (parts of) a practical example:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">        @doc """
        Component for a navbar link.
        """

        attr(:active, :boolean, default: false)
        attr(:disabled, :boolean, default: false)
        attr(:class, :string, default: "", doc: "extra classes added to the navbar link")
        attr(:to, :string, doc: "the destination for your navbar link")
        attr(:method, :string, default: "get")

        slot(:inner_block, required: true)

        # mark the component as inspectable
        SourceInspector.inspectable()

        def navbar_link(assigns) do
          unquote_splicing(maybe_raise_not_implemented)
          ~H"""
          &lt;.link class={[
                "nav-link",
                if @active do "active" else "" end,
                if @disabled do "disabled" else "" end,
                @class
              ]}
              href={@to}
              method={@method}
              {SourceInspector.breakpoint()}&gt;
            &lt;%= render_slot(@inner_block) %&gt;
          &lt;/.link&gt;
          """
        end
      end
</code></pre>
<p>Note how we use <code>SourceInspector.inspectable()</code> to tell the system that we want the component to be inspectable. Then, we set a breakpoint by calling <code>{SourceInspector.breakpoint()}</code> inside the HTML attributes inside the <code>~H"..."</code> sigil. That code will allow us to <code>pry()</code> into the <code>navbar_link</code> component whenever we call it.</p>
<p>Now, after defining the <code>navbar_link/1</code> component (either inside or outseide our application), we can use <code>SourceInspect.pry()</code> to activate the Source Inspector on the function calls. For example:</p>
<pre><code class="lang-plaintext">&lt;.navbar {SourceInspector.pry()}&gt;
  &lt;:brand&gt;Demo17&lt;/:brand&gt;
  &lt;:start_group&gt;
    &lt;.navbar_link to={~p"/data_entry"} {SourceInspector.pry()}&gt;Home&lt;/.navbar_link&gt;
  &lt;/:start_group&gt;
  &lt;:end_group&gt;
    &lt;%= if @current_user do %&gt;
      &lt;%= if @current_user.email do %&gt;
        &lt;.navbar_link to={~p"/auth/users/settings"} {SourceInspector.pry()}&gt;Settings&lt;/.navbar_link&gt;
        &lt;.navbar_link to={~p"/auth/users/log_out"} method="delete" {SourceInspector.pry()}&gt;Log out&lt;/.navbar_link&gt;
      &lt;% end %&gt;
    &lt;% else %&gt;
      &lt;.navbar_link to={~p"/auth/users/register"} {SourceInspector.pry()}&gt;Register&lt;/.navbar_link&gt;
      &lt;.navbar_link to={~p"/auth/users/log_in"} {SourceInspector.pry()}&gt;Log in&lt;/.navbar_link&gt;
    &lt;% end %&gt;
  &lt;/:end_group&gt;
&lt;/.navbar&gt;
</code></pre>
<p>Note the fragments such as <code>&lt;.navbar_link to={~p"/data_entry"} {SourceInspector.pry()}&gt;Home&lt;/.navbar_link&gt;</code>. When we call <code>{SourceInspector.pry()}</code> in the attribute list of the component, this will ensure that each time we right-click on the HTML generated by the component.</p>
<p>For example, see the following <a href="https://imgur.com/a/dBVclm3" rel="noopener nofollow ugc">screencast</a>.</p>
<p>The output is quite similare to the one shown in the cressncasts in this thread, although not as pretty. The advantage is that my output is generaed by dead-simple CSS and doesn’t’ change the metrics of the eelements by much, which means it probably has less interference with the HTML elements.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="293188" data-batch-url="/posts/batch_likers">
                        3
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/made-a-source-code-inspector-useful-in-big-projects-or-large-teams/56792/15">Post #14</a>
	                </div>
	            </div>
              <div id="likers-container-293188" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="293188"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #14"></div>
  </section>
</div>
    <div class="postbit" id="293196" data-post-id="293196">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="derpycoder" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/derpycoder/120/31388_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  derpycoder
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Finally, someone with Macro knowledge!</p>
<p>This is exactly why I shared that idea so many times.</p>
<p>So someone with more experience than me, will make it succinct and seamless to use. <img src="https://forum.elixirforum.com/images/emoji/apple/star_struck.png?v=15" title=":star_struck:" class="emoji" alt=":star_struck:" loading="lazy" width="20" height="20"></p>
<p><a class="mention" href="/u/tmbb" rel="nofollow">@tmbb</a>,</p>
<ol>
<li>Is it possible to have this enabled for every component? That way, no one has to make a component inspectable or use pry. Every component is supposed to be inspectable. <img src="https://forum.elixirforum.com/images/emoji/apple/smiling_face_with_sunglasses.png?v=15" title=":smiling_face_with_sunglasses:" class="emoji" alt=":smiling_face_with_sunglasses:" loading="lazy" width="20" height="20"></li>
<li>Instead of right click, how about the context menu to navigate. (e.g. Similar to the context menu used by LiveBook.)</li>
<li>Using outline instead of border or using the border box css to fix the component from jittering when we hover over them.</li>
</ol>
<p>P.S. I’m still biased towards a bit of JS, because the tooltip can also contain the name of the component and lead to VS code or GitHub or Storybook.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="293196" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/made-a-source-code-inspector-useful-in-big-projects-or-large-teams/56792/16">Post #15</a>
	                </div>
	            </div>
              <div id="likers-container-293196" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="293196"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #15"></div>
  </section>
</div>
    <div class="postbit" id="293206" data-post-id="293206">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="tmbb" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  tmbb
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="derpycoder" data-post="16" data-topic="56792">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/derpycoder/48/31388_2.png" class="avatar"> derpycoder:</div>
<blockquote>
<p>Is it possible to have this enabled for every component? That way, no one has to make a component inspectable or use pry. Every component is supposed to be inspectable.</p>
</blockquote>
</aside>
<p>I believe it’s possible if you’re willing to write a custom EEx engine or a custom <code>sigil_H</code> macro that somehow keeps track of the line no numbers of all function calls and HTML element definitions and maybe keep a call tree in the process dictionary or something like that. Not calling pry() manually means you lose control on which components are meant to be clicked, which can be a bad thing: it might cause you to go somewhere which is “too low level”, like the default live view components or components defined in another app, which is probably not what you want.</p>
<p>I can probably make everything inspectable, but with the current architecture the <code>pry()</code> calls are very important to tell the Source Inspector which file and line should be opened.</p>
<aside class="quote no-group" data-username="derpycoder" data-post="16" data-topic="56792">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/derpycoder/48/31388_2.png" class="avatar"> derpycoder:</div>
<blockquote>
<p>Instead of right click, how about the context menu to navigate. (e.g. Similar to the context menu used by LiveBook.)</p>
</blockquote>
</aside>
<p>As long as you can make the JS code independent of a specific framework (and independent of tailwind!) I’m ok with using JS instead of CSS for the highlights, and even to show a menu. It would have the advantage of not breaking the usual right-click behaviour.</p>
<aside class="quote no-group" data-username="derpycoder" data-post="16" data-topic="56792">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/derpycoder/48/31388_2.png" class="avatar"> derpycoder:</div>
<blockquote>
<p>Using outline instead of border or using the border box css to fix the component from jittering when we hover over them.</p>
</blockquote>
</aside>
<p>Using outline instead of the border is probably a good idea, yes.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="293206" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/made-a-source-code-inspector-useful-in-big-projects-or-large-teams/56792/17">Post #16</a>
	                </div>
	            </div>
              <div id="likers-container-293206" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="293206"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #16"></div>
  </section>
</div>
    <div class="postbit" id="293211" data-post-id="293211">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="tmbb" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  tmbb
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>NOTE: I can’t think of a way of safely adding support for breakpoints in slots automatically</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="293211" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/made-a-source-code-inspector-useful-in-big-projects-or-large-teams/56792/18">Post #17</a>
	                </div>
	            </div>
              <div id="likers-container-293211" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="293211"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #17"></div>
  </section>
</div>
    <div class="postbit" id="293252" data-post-id="293252">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="tmbb" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  tmbb
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I’m unsure on what is the correct behavior for a source code inspector… When the user clicks on a HTML element, should the source code editor open 1) the line where the HTML element appears (i.e., in the body of the template inside a component), which might be in a dependency of the current application or 2) the function call of the component that renders the HTML element (which is probably ina  template inside the user’s application)</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="293252" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/made-a-source-code-inspector-useful-in-big-projects-or-large-teams/56792/19">Post #18</a>
	                </div>
	            </div>
              <div id="likers-container-293252" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="293252"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #18"></div>
  </section>
</div>
    <div class="postbit" id="293270" data-post-id="293270">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="mayel" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/mayel/120/26431_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  mayel
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>IMO the line where the HTML element appears seems more useful, though having the option of both may be good (if using a context menu or something).</p>
<p>I played with the library and defining this macro accomplished that, used by calling it by putting <code>{...pry()}</code> in an element’s HTML attributes (no need for two macros in this case):</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">  defmacro pry(opts \\ []) do
    quote do
      # Let's see if we want to actually activate Source Inspector or not
      if Application.get_env(:source_inspector, :enabled, false) do
        # The config option is set, so we return a number of attributes
        if Keyword.get(unquote(opts), :random_id, true) == true do
          %{id: Utils.random_string()}
        else
          %{}
        end
        |&gt; Map.merge(%{
          "data-source-inspector": "true",
          "data-source-inspector-file": unquote(__CALLER__.file),
          "data-source-inspector-line": unquote(__CALLER__.line),
          title: SourceInspector.debuggable_element_title(),
          "phx-hook": "SourceInspect"
        })
      else
        # The config option is not set, so we return an empty map
        %{}
      end
    end
  end
</code></pre>
<p>PS: I had to remove the Mix.env check since that doesn’t work (always returns :prod) if the component is inside a library.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="293270" data-batch-url="/posts/batch_likers">
                        3
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/made-a-source-code-inspector-useful-in-big-projects-or-large-teams/56792/20">Post #19</a>
	                </div>
	            </div>
              <div id="likers-container-293270" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="293270"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #19"></div>
  </section>
</div>
    <div class="postbit" id="293271" data-post-id="293271">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="chrismccord" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/chrismccord/120/24233_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  chrismccord
                  </h3>
		          </div>
						
			          <div class="user-title">
									<span>Creator of Phoenix</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Nice work! The goal in the linked issue is to add this to the HTML engine and have it inject whatever is needed to do this kind of thing. If you’d like to get involved with that issue, please let me know!</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="293271" data-batch-url="/posts/batch_likers">
                        7
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/made-a-source-code-inspector-useful-in-big-projects-or-large-teams/56792/21">Post #20</a>
	                </div>
	            </div>
              <div id="likers-container-293271" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="293271"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #20"></div>
  </section>
</div>
</template></turbo-stream><turbo-stream action="replace" target="load-more-container"><template><div id="load-more-container" class="load-more-container">
    <a class="load-more-button" data-turbo-stream="true" href="/topics/56792/load_more?page=3">Load more posts (7 remaining)</a>
</div></template></turbo-stream>