-
Notifications
You must be signed in to change notification settings - Fork 50
Conversation
Thanks again for continuing to work on this! Can you fix the merge conflicts and make the renaming suggestion I put in the issue a few minutes ago? I'm not quite ready to dig into this pull request yet but I plan to get to it soon. |
@jasongilman good to go :) Don't worry about not knowing yet what I did. Take your time ;) I think it is very important (specially for you) to understand all of my changes and the reasons behind them, after all, people submit their issue to you. If you need to ask me something just pin me on slack or on the issue itself and I will try to explain things as good as I can. |
@carocad I tried it out and it's awesome. I'd really like to get this feature in Proto REPL. The highlighting is more useful than I thought it would be. Some notes:
|
@jasongilman cool :) I'm glad you like it. I also think that highlighting and hyperlinks are awesome ! Regarding your notes:
In any case, I would first like to get this feature out, get some user feedback and implementing other stacktrace parsers and then check how to implement the automatic & inline stacktrace. What do you think? |
I wrote up a bunch of stuff in response but my computer crashed so I'll attempt to recreate it. We can work around the nREPL bug. There are multiple ways to do that. One method I thought of was with a javascript timeout. We start a timeout (very short) on seeing the indication of an exception. We also clear any existing exception timeout when we do that. If we use that approach it will suppress running the code multiple times and only run the parsing and displaying on the last run. Can I'd prefer not to merge it in the current state where it changes how output is parsed. I think the minimum version should handle automatic printing of stack traces from code that generates an exception. I can understand that you've been working on this one a while and may be getting tired of continuing to fix things in it. It's so close now. I wouldn't mind taking over from here if you'd prefer me to figure out the best way to merge it in. I'll let you decide though. What you've created is awesome. If we go a little bit farther then I think it will have the best interaction and utility for the user. Example code for returning a stack trace data structure. This is based on code in
Sample output
|
hey @jasongilman I will try to put my thoughts on this as clear as possible but please be aware that this is a big and somehow philosophical matter as this is no longer about software but rather usability opinions. Also I'm not 100% sure that I have understood everything that you mean so ... hard to give proper feedback like that.
IMHO, I think the best way to proceed is to:
|
RE feature going out this way: I'm ok with that. I really want it to be automatic but if I care enough I can implement it. My one caveat is that I'd like the pst stacktrace command to still also go to the REPL. Is that possible? I like seeing the stack traces there so they can be copy and pasted or viewed there. RE "This is where we disagree." Proto REPL works much better with the proto repl library. You get completions and the save and recall feature. Cider requires middleware so it's not completely uncommon to require some additional project level configuration. I agree with you though that it's nice that it works without the library. If you're not going to implement the automatic portion now that I described it's a moot point anyway. The code wouldn't necessarily need to be put in the library. It could be sent at runtime instead of predefined as a function.
You've explained something that I didn't get before about your approach. I thought you were reliant on the way repl/pst displayed things but I missed that we could make the parsing dynamic. I had mentioned that in a previous comment about using that as an approach and I missed that's what you were doing. Do you think the code is ready for merging now? If so I'll merge it in and then I'll try it for a few days before doing a Proto REPL release with this code. |
@jasongilman I think we have been discussing over things that we both agree on but that we have said in different ways jeje :D After the last message I realized that it shouldn't be difficult to implement the automatic inline-exception so I will first implement that. This PR is ready for merging as it is, but I would like to implement first this feature as described in my last message. it would greatly help me if you could check some other stacktrace's libraries and implement their regexes to support this new feature. The |
@jasongilman now we should be good to go :) Please, by all means test this PR as much as possible before publishing it as I don't have much free time anymore since I started my new job. For the record:
TODO: allow exceptions to be copyable. I have already talked with the ink team about it but we haven't solved the problem yet. Once it is fixed, we should be able to copy the stacktrace content |
Thanks for the update. I've been a bit busy with work lately but I'm going to start trying it out. |
I started testing and found that running all the tests doesn't seem to be working or it's not producing the output. I'm using the proto repl demo project. I just get
And then no more output. There must be some problem with the output redirection. If I do this on master things are working. I haven't had a chance to look into it yet. |
I tried it and indeed there is a bug there. However, I am not sure if the bug is in my code or in the node-nrepl-client. The problem is that I 'unsubscribed' proto-repl from the messageStream here. My understanding was that ALL messages were collected and send back here. That approach worked for every case that I have tested. Nevertheless, for some reason when you run all tests, the MessageStream from both functions above are very different. The message collection only gets a fraction of the total amount of messages that are send to stdout. The output that you see in the repl is precisely the messages that are sent back. So there problem is not in the output redirection but rather where the messages are read and which messages do we consider valid. I don't know the reason of this difference and since you created the function that reads from the 'MessageSequence' you probably have a better understanding of why it is like that. I could change the code to behave like it did before. Nevertheless that would introduce a race condition between the MessageHandler and the ResultHandler since we modify a message here. I guess the bug is in the node-nrepl-client since I would expect the 'send' command to receive all messages back but please let me know if you have more insights into this. |
@mauricioszabo I just saw that you are doing a similar work on your plugin |
@carocad wow, nice! I'll look at it as soon as possible! Can we make a checklist to see which edge cases were already corrected, and to unify this information in a single place? |
Thanks @mauricioszabo and @carocad! |
@mauricioszabo this is the current workflow inside proto-repl to support this feature
Everything else should work as expected. There is one caveat though and it is precisely what we have not been able to solve: In order for the exceptions to be displayed in the console without duplicates we deactivated the stream of messages from the clojure repl (see here). Instead we rely on a bulk update from the repl (usually) send once the function execution ends. So far this approach works with the sole exception of the case mentioned by @jasongilman above. I also confirmed this behavior in my branch. For some reason, whenever the user requests a full One last comment. We currently don't support highlighting/hyperlinks to any external library (clojure itself included) because when an exception happens we immediately highlight the error lines. Since third-party code is compressed into jar files, we dont have a filename/path combination to pass to atom to perform the highlight/hyperlink. We could decompress them at runtime but so far I tried to keep it simple to avoid even more problematic behavior. I hope this helps, let me know if you have further questions. |
Those messages are always short so display them inline
…alue views/value.coffee created to handle results, exceptions and stacktraces rendering repl adapted accordingly nrepl message passing to resultHandler simplified
…for calls outside of the repl.coffee scope
avoid showing inline results for messages to stdout or stderr
cosmetic change: pre is in fact a div
first working prototype
BUG: filepath metadata could be a relative path
link regex added html objects for stackframes added
ValueRenderer renamed as Renderer inkResult method refactored to return only ink options render method now uses prettyExceptions as default
…clarity on value-rendering related functionality
space-pen used to generate specific html/js objects exception rendering functions simplified
…sers value::exception simplified using the stacktrace parser architecture
value directory deleted; all files moved to views
return stacktrace if a command returned eval-error repl/pst no longer has a special treatment
closing this due to lack of activity |
General notes on the implementation, features and changes
msg.error
is replaced bymsg
which has anerr
property by default. A new type of messagemsg.ex
is also accepted as a valid response for the resultHandlers.value.coffee
file can be extended to support new and customized ways to display different things/values inline. Supporting canvas/plots inline, docs and many more should be as easy as extending the render function to support a new case. (docs are already implemented)stacktraces.coffee
file can be extended to support new stacktraces regex patterns produced by exception-handling libraries other thanclojure.repl
. The idea is to be able to define and use a new regex pattern without having to modify any other post-processing codeI hope that you and other clojure users would like this :)