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


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I just uploaded the videos here: <a href="https://www.dropbox.com/scl/fo/oexuz4i2oozp4ck3covab/AJkMiUOWemQQmINX5PmBKYc?rlkey=fu6z1t5j4vweh62r9eiu56wdl&amp;st=f207nixp&amp;dl=0" class="inline-onebox" rel="noopener nofollow ugc">Dropbox</a></p>
<p>Note that it is possible to drop in an LSP server that <em>only</em> does code evaluation, which eliminates most of the concerns about heaviness. (I built an earlier prototype that was exactly that, based on the code for Credo Language Server, but with all the Credo-specific stuff deleted. I ended up re-implementing on top of Next LS only because Credo Language Server uses an old version of GenLSP and I was hitting a bug and it was faster to just use Next LS as the base.)</p>
<p>That being said, nREPL <em>is</em> a better approach: it’s more efficient, has less moving parts than LSP, etc. If you’d like to contribute (awesome!) you can ignore the LSP prototype and start looking at the nexrepl source.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="340896" data-batch-url="/posts/batch_likers">
                        2
                      </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/extending-iex-to-have-nrepl-capabilities/64872/22">Post #21</a>
	                </div>
	            </div>
              <div id="likers-container-340896" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="340896"
                     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 #21"></div>
  </section>
</div>
    <div class="postbit" id="340897" data-post-id="340897">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>What we really need is some code that can take Elixir source code (as text) and a cursor position and return the minimum amount of code (text) that needs to be evaluated.</p>
<p>For example, given the following:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">defmodule Foo
  def foo do
    1+1
    2+2
  end

  def bar do
    3+3
  end
end
</code></pre>
<p>Some cases to handle:</p>
<ul>
<li>If my cursor is on or after the <code>end</code> for <code>foo</code>, then we need to return the entire <code>Foo</code> module (as there’s no way to just update the <code>foo</code> implementation, afaik?).</li>
<li>If my cursor is on <code>1+1</code>, then we would return <code>1+1</code>, as that can be evaluated in isolation.</li>
<li>etc.</li>
</ul>
<p>(I’m sure it gets a lot more complicated than this, especially when macros are involved, but this is a starting point at least.)</p>
<p>We could do some of this either on the client or server (on the client, treesitter probably makes this somewhat easy and would reduce the amount of data that needs to be sent over the wire) but dong this server-side is more flexible and will work with more existing clients (whether they’re nREPL clients or LSP clients). And there might already be code in the <code>Code</code> module that can do a lot of the heavy lifting.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="340897" 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/extending-iex-to-have-nrepl-capabilities/64872/23">Post #22</a>
	                </div>
	            </div>
              <div id="likers-container-340897" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="340897"
                     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 #22"></div>
  </section>
</div>
    <div class="postbit" id="340903" data-post-id="340903">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="mjrusso" data-post="23" data-topic="64872">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/mjrusso/48/29805_2.png" class="avatar"> mjrusso:</div>
<blockquote>
<p>We could do some of this either on the client or server (on the client, treesitter probably makes this somewhat easy and would reduce the amount of data that needs to be sent over the wire) but dong this server-side is more flexible and will work with more existing clients (whether they’re nREPL clients or LSP clients). And there might already be code in the <code>Code</code> module that can do a lot of the heavy lifting.</p>
</blockquote>
</aside>
<p>How big a concern is sending a lot of data over the wire assuming you aren’t doing it on every keystroke?  I probably have a bit of tunnel vision on my own usecase as I assume you need to for things like as-you-type auto-complete <img src="https://forum.elixirforum.com/images/emoji/apple/thinking.png?v=15" title=":thinking:" class="emoji" alt=":thinking:" loading="lazy" width="20" height="20">  It’s been a very long time since I used nRPL and was never a serious clojure dev, so I’m a bit out of my depth talking about this at the moment, heh.</p>
<p>PS, thanks for the dropbox upload!</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="340903" 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/extending-iex-to-have-nrepl-capabilities/64872/24">Post #23</a>
	                </div>
	            </div>
              <div id="likers-container-340903" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="340903"
                     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 #23"></div>
  </section>
</div>
    <div class="postbit" id="340905" data-post-id="340905">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Practically speaking, I don’t think it’s a concern worth worrying about, and certainly not if  autocompletion is on the table. <img src="https://forum.elixirforum.com/images/emoji/apple/slight_smile.png?v=15" title=":slight_smile:" class="emoji" alt=":slight_smile:" loading="lazy" width="20" height="20"></p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="340905" 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/extending-iex-to-have-nrepl-capabilities/64872/25">Post #24</a>
	                </div>
	            </div>
              <div id="likers-container-340905" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="340905"
                     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 #24"></div>
  </section>
</div>
    <div class="postbit" id="340939" data-post-id="340939">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I was thinking more generally to appease a wider audience but of course this wouldn’t replace LSP so ya, sending the whole thing would probably be for many use-cases.  I actually <em>do</em> like error checking and some autocomplete, I just haven’t been able to set it up to my liking with LSP plugins.  I do like seeing errors and I like having auto-complete available but not <em>as I type</em> (after I hit save would be sufficient).  Basically I’m very sensitive to crap flying in my face as I’m editing.  I also don’t like reading documentation in pop-up windows.  I used to turn this stuff off even in my IDE days.  LSP plugins do have settings for this but they all don’t work quite right.  Which is all to say what you and <a class="mention" href="/u/cevado" rel="nofollow">@cevado</a> have already said: IEx integration would open up more powerful personal customizations that go beyond even LSP’s capabilities but of course with the caveat that’s it’s back to being language (obviously) and editor specific.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="340939" 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/extending-iex-to-have-nrepl-capabilities/64872/26">Post #25</a>
	                </div>
	            </div>
              <div id="likers-container-340939" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="340939"
                     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 #25"></div>
  </section>
</div>
    <div class="postbit" id="340945" data-post-id="340945">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Re:</p>
<blockquote>
<p>What we really need is some code that can take Elixir source code (as text) and a cursor position and return the minimum amount of code (text) that needs to be evaluated.</p>
</blockquote>
<p>Oooh, looks like a ton of heavy lifting is already done <img src="https://forum.elixirforum.com/images/emoji/apple/eyes.png?v=15" title=":eyes:" class="emoji" alt=":eyes:" loading="lazy" width="20" height="20"></p>
<pre data-code-wrap="elixir"><code class="lang-elixir">Code.string_to_quoted!("""
  defmodule Foo do
    def foo do
      1+1
      2+2
    end
  end
""", columns: true)
</code></pre>
<p>Returns:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">{:defmodule, [line: 1, column: 3],
 [
   {:__aliases__, [line: 1, column: 13], [:Foo]},
   [
     do: {:def, [line: 2, column: 5],
      [
        {:foo, [line: 2, column: 9], nil},
        [
          do: {:__block__, [],
           [{:+, [line: 3, column: 8], [1, 1]}, {:+, [line: 4, column: 8], [2, 2]}]}
        ]
      ]}
   ]
 ]}
</code></pre> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="340945" 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/extending-iex-to-have-nrepl-capabilities/64872/27">Post #26</a>
	                </div>
	            </div>
              <div id="likers-container-340945" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="340945"
                     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 #26"></div>
  </section>
</div>
    <div class="postbit" id="341006" data-post-id="341006">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Note that ideally you’d want to be able to evaluate the relevant expression-at-cursor even if there’s an unrelated syntax error somewhere else in the file. (That’s probably a nice-to-have for a follow-up though.)</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="341006" 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/extending-iex-to-have-nrepl-capabilities/64872/28">Post #27</a>
	                </div>
	            </div>
              <div id="likers-container-341006" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="341006"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-last-post cat-last-post" title="Last post!"></div>
  </section>
</div>
</template></turbo-stream><turbo-stream action="replace" target="load-more-container"><template><div id="load-more-container" class="load-more-container">
    <span class="all-loaded">— All posts loaded —</span>
</div></template></turbo-stream>