pylance-release
pylance-release copied to clipboard
Support language features for other languages when using cell magics
When using cell magics such as %%html, %%sql, %%js, %%kql, etc and other such magics, Pylance does not recognize the contents after the text. Text after such magics are treated a Python code, thats incorrect. Pylance can instead utilize language request forwarding to allow VS Code to provide the language features for languages embedded via cell magics https://code.visualstudio.com/api/language-extensions/embedded-languages#request-forwarding
The question now is who manages the list of these cell magics
- It can be hardcoded
- a configuration to map cell magics to langauges woudl also be useful.
E.g. mapping %%kql to kusto language is something the user can add
I swear we already had this issue? Yeah this is a dupe of this discussion item here: https://github.com/microsoft/pylance-release/discussions/3851
Maybe it's not exactly a dupe. Reopening.
Triage: next step - investigation of cost.
Instead of expecting Pylance to automagically handle every scenario, including those involving multiple languages, maybe we start with a fairly simple configuration option. This would allow users/devs to set up mappings for Pylance.. A simple configuration, similar to a gitignore file, could be implemented. For example:
- If the scenario is "%%time+simple", ignore only that part.
- If it's "%%sql+block", ignore the entire section as it's not Python.
- All other %% - default to ignoring
I use Jupyter with Python in VSCode and would be happy to assist with testing.
this would be awesome. Please allow specifying any supported language using vscode's identifier for that language.
Not just common ones like SQL. For example I would like to create my own cell magic %%cypher for the cypher graph query language.
Perhaps there could be a mapping between cell magic name and the vscode identifier in settings?
I'd love this! I think there's a very valid usecase for custom languages with cell magic and more integrated support would be awesome