-
Notifications
You must be signed in to change notification settings - Fork 270
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
Tolerance of ipython cell magics in source code cells #1497
Comments
FYI there is a way to turn off the syntax errors (the docs are in the process of being written and I'm pressed for time, else I would look it up for you). |
Moving back to new issues to triage. |
I think this can be closed, as it looks like the python extension now supports this via comments that begin with
EDIT: I think #3263 contains more details. |
I wonder if we should filter out these set of errors in the notebook language client middleware, @rchiodo do you think that's the right layer? |
@rebornix, yes I think so. I believe we have another issue we're we recommended just that: #6635 |
Sorry closed prematurely. This issue is I believe about magics in python files, not notebooks. Python files would not be handled by the middleware piece we have. Although maybe we'd do something similar. |
Closing for now as the workaround described above should work. Otherwise we'd have to special case python files with cell markers. |
Environment data
Actual behavior
When using a python file as a makeshift Jupyter notebook (with use of the VSCode Jupyter extension), valid ipython kernel code is flagged as invalid by the Python parser. For instance, cell magics, which begin with one or two percent signs, are flagged as syntax errors
Expected behavior
The parser should ignore valid ipython cell magic syntax; flagging these as problems just adds noise. A good solution might be to have the Python extension have its own internal Jupyter flag, which when enabled would understand that ipython cell magics are syntactically correct, but when disabled would treat the file as vanilla Python for the purpose of checking syntax.
Steps to reproduce:
Write e.g.,
%matplotlib inline
at the top of the file.The text was updated successfully, but these errors were encountered: