-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
Changing Language modes for cells permanently #140673
Comments
@teddywaweru My apologies, I'm a bit unsure of what you are referring to here. For each cell there is a language selector that should be permanent after you change it. Are you changing the language modes and that is not being persisted somehow? A screenshot might help here with illustrating what the issue is. |
Yes, that's exactly it. Once you change it, it's only persistent for as long as the editor is open. If it's closed & reopened, the language modes for all cells default back to Python. |
@teddywaweru Thanks for the info. I actually do repro this issue. Seems like this might be due to this being a "Python" kernel that can execute SQL or Javascript via magics like %%SQL or %%javascript. I think that when the file is reopened that it might be picking up Python due to the Kernel that is selected, even though python kernels can run SQL or JS code. When I don't have a kernel selected yet (just after creating a new document) the language selector works fine and does retain the selected language. It's when I pick a python kernel that this issue starts to crop up for me. I might look at this myself, but I'm actually going to transfer this issue as the language selector is part of the core vs code notebook support versus the Jupyter extension. |
That would make sense, but I'm unable to reproduce it. I've tried opening a new Jupyter Notebook in a new editor instance without the kernel selected & randomly changing the cell languages. Upon saving the document, all the cells immediately refreshed & defaulted back to Python Language on the open editor. The only other language change that 'sticks' is the markdown, which is also expected for .ipynb files... |
Doesn't appear that changing the language for a cell is persisted at all, since on opening the ipynb as json language is not stored per cell. I expected to see something in the cell metadata. Even if there is no metadata notebook standard for this, it seems like we should be persisting and setting it ourselves so the user can actually make use of the language selectors as intended. |
@roblourens I think we should think about saving the language info in custom cell metadata when users pick a language which is different from the global language (say Python). There is no Jupyter standard for it yet but maybe this can be one JEP from us. |
This particular issue is a duplicate of microsoft/vscode-jupyter#4757. It's related to polyglot and cell magics. I don't think we currently have a story for it yet. @greazer you have put it in the March milestone, do you expect anything in particular for this to be done this month? |
Not sure if VS Code allows for this, but would it be possible to permanently change a cell's language mode even after the text editor is closed? This is applicable in my case when running SQL scripts in Jupyter cells. Currently, once the text editor is closed, the user has to manually change each cell, which is futile if the editor is to be closed later.
The text was updated successfully, but these errors were encountered: