-
Notifications
You must be signed in to change notification settings - Fork 319
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
[WIP] Add colours for files in file browser #885
base: main
Are you sure you want to change the base?
Conversation
13377aa
to
6921f9d
Compare
6921f9d
to
378d611
Compare
Ready for feedback. I listed two known issues which would be nice to get feedback on. The third issue is getting the setters exposed in JupyterLab. I will submit PR if you agree that this is a good approach for now (by now I mean JupyterLab 3.x). @telamonian, is your new file browser on roadmap for JupyterLab 4.0, or more like 5.0? |
While this PR does not add another column with an icon to the right, it would be easily possible by:
So we could implement the design from #124 fully using this approach (in particular the right-most panel of #124 (comment)). I am not full convinced on the utility of such design - colors work for me well enough, but if there is a consensus that another column should be added in addition to the colors I would be happy to tackle this (we could make it customizable with showStatusColor: boolean, showStatusColumn: boolean) Alternatively, the file icons could get an overlay by simply adding a CSS style like
It would look crammed to me though... |
I implemented the @weihwang's indicator design from #124 (comment) and added settings so either the indicator, coloring or both can be disabled/enabled. I would really appreciate an early feedback on whether you want to go this path (i.e. I should open a PR in JupyterLab to expose the renderer), or not. |
Thanks @krassowski This is awesome work. The design of #124 is certainly heavily inspired by VS Code. A reason for adding a DOM element with the file status may be accessibility (this is purely a guess) - coloring being probably though to translate for screenreader. The trouble at JupyterLab level is indeed if multiple extensions want to apply a custom styles. In VS Code they use the additional columns to concatenate the information. For example in the screenshot below, the 4 states that there are 4 warnings and M that the file is modified - according to git. The style are ranked as can be seen on As I'm using VS Code daily. So my opinion is biased towards having a indicator in addition of the color 😁 But I agree with you stacking it with the file type icon is not easy to ready. And I found the @weihwang's indicator a bit to eye catchy. I prefer the more discrete approach of VS Code of a single colored letter. Regarding ignored files, it won't be easy. We should list them as much as possible. So the best approach seems to focus on testing only the files displayed in the file browser. I dig into VS Code logic. They are using the command
|
PyCharm on the other hand uses only colors to indicate git status (no letter indicators).
I'm also hitting the limits of the current Renderer pattern in the LSP extension when it comes to comlpeter. It feels like hooks could be easily implemented using |
Yes this is gonna be definitely a point to monitor. Especially if there are lots of items - it may require implementing windowing the listing view.
Definitely worth experimenting and this extension offers a good opportunity. @ianhi did some testing on the changed files list in #667 (comment). It may be a source of inspiration to challenge the JupyterLab file browser with such signal. It is certainly a good subject to bring at the JupyterLab developer meeting to. |
@all-contributors please add @krassowski for code, review and bug |
I've put up a pull request to add @krassowski! 🎉 |
Further exploring the proof-of-concept from jupyterlab/jupyterlab#5499 (comment).
Can fix #124 (the issue was open for a long time, it would be nice to resolve it for users who need it here and now).
To compare changes without the Git context menu: krassowski/jupyterlab-git@add-browser-context-menu...krassowski:colour-files-in-browser
Demo GIF:
Instructions for easy testing on binder
To test on binder open console and paste
If in need, consult:
To avoid the requirement of using a manual action to refresh the status (triggering context menu, or visiting the GitPanel) I connected signals that:
Known issues:
status.files: IStatusFile[]
property. TherefreshStatus()
method uses thestatus
endpoint which does not return ignored files (which might be good for performance).