-
Notifications
You must be signed in to change notification settings - Fork 417
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add doctest circle indicator on editor (Looking for early feedback) #1789
Conversation
tests = | ||
test_module.tests | ||
|> Enum.sort_by(& &1.tags.doctest_line) | ||
|> Enum.map(&run_test/1) | ||
|
||
formatted = format_results(tests) | ||
put_output({:text, formatted}) | ||
# put_output({:doctest_results, doctest_results}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this would be the line which initiates the signal that should arrive at the editor to indicate doctest line numbers
lib/livebook/session.ex
Outdated
# I am under hte assumption that in some place inside | ||
# this method the operations get sent to session_live.ex, | ||
# is this correct? If so, which code is in charge of doing so? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a little lost here. It looks like session_live
does get the :add_cell_evaluation_output
operation from this function. Where does that happen?
# {:add_cell_doctest, } | ||
# similar to :add_cell_evaluation_output but instead | ||
# this will add the information of doctests that | ||
# pass or fail and their line number | ||
# to the CellEditor attributes, then the CellEditor | ||
# will react to it through a MutationObserver to | ||
# apply the styling into the Monaco editor |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this would send an update to the cell_editor_component
in order to update its data-doctest-results
attribute, that's how the editor will know to update doctest decorations
# defp io_request({:livebook_put_doctest, output}, state) do | ||
# state = flush_buffer(state) | ||
# send(state.send_to, {:runtime_doctest_output, state.ref, output}) | ||
# {:ok, state} | ||
# end | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure why/what is the function of io_proxy.ex
but I am following the same pattern for delivering messages as :livebook_put_output
, which goes through this module
Hey @Sleepful, thanks for the PR and sorry for the late feedback! I would start with this flow:
@josevalim if you have any concerns with this flow let me know :) Also, note to self: it's fine to change Runtime messaging around doctests at any point, because both the sending and receiving side is in Livebook (and not in Kino). |
@jonatanklosko no worries on delay. Your explanation is crystal clear, thanks for that! I will delay a little bit on the delivery, I hope that's okay, so just FYI I will have an update with code in approximately 2 weeks. TTYL 😁 |
@Sleepful sure, there's definitely no rush! |
I did not mean to close it, oops 😅 |
@jonatanklosko one question, does My concern might be unfounded, but suppose Typical HTTP request issue, but we are using LiveView so probably a non-issue. |
@Sleepful the events arrive at the same order as they are sent from the server. On a technical side, events go via the same websocket connection :) |
After running doctests inside livebook, add a circle inside the editor to indicate the
iex>
prompts that succeeded or failed after evaluation.Example:
Currently lacking some details but I tried to illustrate the main idea before turning it into a functional implementation. I want to get some approval on what I intend to do before moving into coding it properly. Do tell me if any of the commented code looks like it is in the wrong place. I also left a question in one of the comments.