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
Better support when multiple renderers are installed #125876
Comments
Not sure yet if this should be a candidate, can't recall when/why the user setting to specify which extension/renderer has higher priority is gone. |
This is actually working 'as designed'. The mimetype for httpbook's custom renderer is text/html. When the user selects that, we remember that they prefer that as their renderer for the given mimetype. However maybe we should only remember that in the context of a single |
The catch here is users are very likely unaware that this extension contributes Also I'm wondering if some of the basic mime type renderers in the core should have higher priority than the custom ones. For example
@connor4312 this is not working right now. |
I think that's a good idea if we also have some notion of extension affinity, where a custom renderer for a built-in mimetype is preferred if the output was created by the same extension who contributed the renderer. If this is not the case, then it's a poor experience for notebooks that intend to have a custom renderer, since their users will manually need to switch their renderer. Or we just disallow people overwriting built-in mimetypes, and say to use a custom mimetype instead. |
Thought about this again, as a renderer author, my renderer offers rich rendering for Considering how I built the renderer, I don't think we can disallow people overwriting builtin mimetypes. |
Yeah I also don't like disallowing overriding builtin mimetypes but we can say that the default builtin mimetype is the preferred one unless the user selects a different one for the viewtype or the renderer extension itself contributed the renderer |
What happens if I select XYZ renderer for rendering HTML when looking at Notebook ABC (where both were contributed by two seprate extensions). Does this mean that XYZ will be used to render HTML output in httpbook? The user may not expect that to happen. |
This would be in addition to the |
So, something like a custom renderer for |
@nat1craft mentioned in REST Book that the last output renderer he selected isn't the default in the next cell run. @connor4312 is this expected? |
@tanhakabir I can confirm that the selected editor is not the default for the next run. I saw the separation between Notebook and NotebookRenderer and the possibility of different renderers for the same Mimetype as a feature. One use case for this would be rendering application/geo+json. Partly I want to see the representation as JSON, partly I want to view the data in a map view. However, I would leave it up to the user to decide how the default display should be (#123884 (comment)). |
yep. you should try this too: RandomFractals/vscode-data-table#23 (comment) |
@connor4312 this might require further investigation on your end for CSV data loading and renderers with support for mulitple mime types, csv and json in my prototype ... tanhakabir/rest-book#114 |
I don't really now if this is correct here, but this is the only issue that is related to the problem I am facing with. When I am using jupyter notebooks and there should be an image displayed in the output of a cell, there is only showed e.g. My point is, that as a user, I have to choose that different renderer over and over again for every cell. This is really slowing down developing. I tried to search for a solution, but I wasn't able to find something about a default renderer in the settings. Maybe here someone could help solving that problem (or it gives you a new hint for fixing it in general) :-) Specs: Jupyter Extension: v2021.9.1101343141 |
I think we should take care of this, it's a large paper cut. So how about this algorithm, for any given output with mimetype X:
Whenever a user changes the output renderer, persist the preference to use that renderer for mimetype X within the current notebook type in workspace storage. (Effectively |
@connor4312 I really like the proposed renderer selection strategy. I think it will make it work much better for the couple of simple data renders I've created for basic data and map views, without requiring to change default on every cell run. Thank you! I look forward to this implementation and release and open to assist with testing of this feature in insiders. |
@connor4312 what is rationale for saving this in a workspace scope versus the global scope? Extensions, mimetypes, and notebook types are all globally scoped entities, so to me it seems unexpected that I'd be configuring them at the workspace scope (and thus needing to reconfigure them for each new workspace, and have potential weirdness in empty workspaces, multi-root, opening a super/sub-folder of an existing workspace, etc.) I might suggest:
|
The rationale is if you're working with different types of data in different places and want to use different renderers for them. For example, if the user selects notebook Y's custom html renderer for a notebook in one workspace, but wants the ordinary renderer elsewhere. While these are all global things, the context in which I want to use any combination of could be local. It would be inconvenient to have to switch back and forth between them as you go from one workspace to the other. |
I think I verified this. Having a hard time getting two different custom notebook types to output the same type. |
@rchiodo I believe you already check it out, but you can use my notebook examples from the simple data table renderer: https://github.com/RandomFractals/vscode-data-table @connor4312 thanks for making those changes to support workspace and individual notebook cell output rendrerer preferences. |
Thanks @RandomFractals. I don't believe this is behaving as expected then. I open a rest notebook, run a cell, chose the data table renderer and get this: I open an http notebook, run a cell, but don't choose anything and I get the renderer from the other notebook being used @connor4312 is that the expected behavior? Maybe I'm misinterpreting the algorithm. |
@rchiodo what extensions are you using for the two different notebooks? |
First one has the rest notebook extension installed to run it and the 'Data Table renderer' to render it. |
Here's the exact extension information: Name: REST Book Name: Data Table Name: httpBook - Rest Client |
Fixed: the 3rd and 4th choices were swapped (built-in renderers were not chosen by default) |
Steps to Reproduce:
I would expect that a custom renderer that only works with certain filetypes (http) to only appear for those notebooks, not all notebooks. I'd also hope for an easy way to set the default renderer for certain notebook types.
The text was updated successfully, but these errors were encountered: