-
Notifications
You must be signed in to change notification settings - Fork 16
Improve readability by formatting code within brackets. #220
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
Comments
Example code using
->
|
Hi @junhaoliao , I have started looking into this. But I find I am still not familar with React framework enough, so it took longer time than I thought :( I feel the I am also thinking of some problems:
|
@zzxthehappiest thanks for looking into this promptly!
Right, this is expected. We currently don't really cache the last opened file in the log-viewer, so it is expected that whenever user refreshes the browser page, the last opened file is lost. That said, I believe it is possible with the latest web standards (Origin private file system or IndexedDB) @coderabbitai can you help create a feature request to track this?
Getting this prettifier feature done is actually more important for us because it helps us to reach feature parity with a private deprecated edition of the log-viewer (see below). The log level filter, though broken for Python logs, has already had some great improvements than the one in the deprecated edition. Let's get #220 done first if you may. @kirkrodrigues and I had an offline discussion about this feature request. In fact, we previously had an implementation of a simple formatter in a private branch: https://github.com/junhaoliao/yscope-log-viewer/blob/beta-release/src/Viewer/services/decoder/SimplePrettifier.js because Let's split the code changes into two PRs so it becomes easier for us all to see progresses:
Feel free to share your thoughts on those. |
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain@junhaoliao I've created a feature request for caching the last opened file in the log-viewer. This would allow the application to persist files between browser refreshes using modern web APIs like Origin Private File System or IndexedDB. Now regarding the prettifier feature, your implementation plan looks well-structured:
The performance difference (30x faster with your implementation) is significant and definitely justifies this approach. Breaking it into two PRs will make the changes more manageable and easier to review. 🏁 Script executed:
Length of output: 1166 @junhaoliao I've created a feature request for caching the last opened file in the log-viewer at issue #221. This will track the implementation of file persistence between browser sessions. Regarding your prettifier implementation plan, I think splitting it into two PRs is an excellent approach:
The 30x performance improvement with your custom implementation definitely justifies this two-step approach. Breaking the work into these logical stages will make the changes more manageable while still delivering the functionality quickly. The step-by-step instructions you've provided are clear and comprehensive, making it easy for the developer to implement this feature effectively. |
Thank you very much! This is much clearer now, and thanks for pointing me where to write the code (because I was heavily using Ctrl&F to search keywords to add the code, I will try my best to get myself familar with React and the project's code base as soon as possible!) |
It took some time on debugging React's hook ˃̣̣̥᷄⌓˂̣̣̥᷅ (I will proactively learn more basics). Anyways, I am finishing the implementatione of the first task and about to write unit tests. In terms of the unit tests, could you @junhaoliao give some tips on what should I focus on :) PS: I also have a question, when loading file, if the URL contains |
No worries. Some code was checked-in in a very rush manner, and the fact that you managed to understand it without any assistance is truly remarkable. (We should write better docs in the first place. )
Though non-ideal, we only set up unit test cases for the utility functions in
is sufficient. When adding the
Good catch! Yes, we want to change @coderabbitai Let's create an issue to track the refactoring effort to decouple page loading from the |
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chainThe key task is to create an issue for tracking the refactoring effort to decouple page loading as requested. I'll create this issue now: @junhaoliao I've created an issue to track the refactoring effort as requested. The issue focuses on decoupling page loading from the The refactoring will ensure that any existing You can find the new issue in the repository's issue tracker. Let me know if you need any additional information or adjustments to the issue description. 🏁 Script executed:
Length of output: 9540 🏁 Script executed:
Length of output: 1110 @junhaoliao I've created an issue to track the refactoring effort as requested. The issue has been created as #222 in the yscope-log-viewer repository. The issue details the proposed refactoring to decouple page loading from the |
Request
Add functionality to automatically format and indent code or JSON-like structures enclosed within brackets
{}
or[]
in log messages. This would significantly improve readability and facilitate faster debugging and analysis.Possible implementation
js-beautify
, to automatically format and indent structured data within each log entry upon toggling.The text was updated successfully, but these errors were encountered: