Skip to content
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

KQL syntax stopped working #6253

Closed
digitarald opened this issue Jun 10, 2021 · 15 comments
Closed

KQL syntax stopped working #6253

digitarald opened this issue Jun 10, 2021 · 15 comments
Labels
bug Issue identified by VS Code Team member as probable bug language-any Area covering general issues geared to supporting any language (not just Python) notebook-intellisense Intellisense & other language features in notebook cells for any language
Milestone

Comments

@digitarald
Copy link

Environment data

  • Language Server version: 2021.6.2-pre.1
  • OS and version: linux x64
  • Python version (and distribution if applicable, e.g. Anaconda):
  • python.analysis.indexing: undefined
  • python.analysis.typeCheckingMode: off

Expected behaviour

Can use %kql

Actual behaviour

Pylance puts errors everywhere.

image

Code Snippet / Additional information

%%kql RetainedByCohort <<
let cohortWindow = 7d;
@judej
Copy link

judej commented Jun 10, 2021

The code snippet is not Python. Not sure how Pylance is involved. @DonJayamanne

@jakebailey
Copy link
Member

This seems like a notebooks bug to me; non-python cells should not be treated as python code and given to language servers.

@jakebailey
Copy link
Member

Related is microsoft/pylance-release#894, but the code snippet given in the issue isn't Python.

The screenshot seems sort of like a magic command in a Python cell, maybe? That, I'm not sure without more context.

@digitarald
Copy link
Author

Forgot to add: This works with Jedi.

@jakebailey
Copy link
Member

Jedi isn't a language server (at least not yet), so the notebook APIs don't try and use it. If you use JediLSP, I'm guessing you'll see it break as well.

@DonJayamanne
Copy link
Contributor

FYI Installing https://marketplace.visualstudio.com/items?itemName=donjayamanne.kusto will give you code completions for KQL in Jupyter notebooks.

@digitarald
Copy link
Author

Thanks @DonJayamanne, I have it installed and am an avid fan.

@claudiaregio
Copy link
Contributor

@jakebailey Does this need to be transferred to vscode-jupyter? Sounds like the recommendation above of not marking these cells as python cells and passing them to the language server would be work on jupyter?

@jakebailey
Copy link
Member

Yes, I'll transfer it for you.

@jakebailey jakebailey transferred this issue from microsoft/pylance-release Jun 11, 2021
@DonJayamanne
Copy link
Contributor

This isn't something we did in the past, hence not sure what you (@digitarald ) mean by stopped working?
@digitarald Pleaes could you provide the following info:

  • Version of VS Code
  • Version of Jupyter extension

@DonJayamanne DonJayamanne added the info-needed Issue requires more information from poster label Jun 14, 2021
@jakebailey
Copy link
Member

I think the confusing thing is why the KQL cell is being sent to Pylance at all...

@digitarald
Copy link
Author

This isn't something we did in the past,

When I said it worked in the past I meant it worked before Pylance rolled out. Using Jedi works.

@DonJayamanne
Copy link
Contributor

think the confusing thing is why the KQL cell is being sent to Pylance at all...

thats because its a Python cell, %kql is a Python magic, meaning this code is executed in the Python kernel.
Thats why my extension chagnes the language of the cell from Python to Kql so that we dont get Python language server getting messages for this cell.

@DonJayamanne DonJayamanne added enhancement and removed info-needed Issue requires more information from poster labels Jun 21, 2021
@greazer greazer added notebook-intellisense Intellisense & other language features in notebook cells for any language bug Issue identified by VS Code Team member as probable bug regression and removed enhancement labels Aug 7, 2021
@DonJayamanne DonJayamanne removed their assignment Oct 11, 2021
@DonJayamanne DonJayamanne added the language-any Area covering general issues geared to supporting any language (not just Python) label Oct 14, 2021
@DonJayamanne
Copy link
Contributor

TODO:

  • When opening a notebook, ensure we look for cell magics & set language appropriately
  • When typing look for magics & change language accordingly

@rchiodo
Copy link
Contributor

rchiodo commented Jan 20, 2022

Dupe of #4588

@rchiodo rchiodo closed this as completed Jan 20, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 28, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug language-any Area covering general issues geared to supporting any language (not just Python) notebook-intellisense Intellisense & other language features in notebook cells for any language
Projects
None yet
Development

No branches or pull requests

7 participants