Closed joyceerhl closed 2 years ago
Are we sure this isn't a bug in the concat document logic for mapping locations? I'm not sure this breaks in a regular Python file.
Ahh sorry, the problem went away when I switched the language server to Jedi, but I just tried switching it to JediLSP and I do repro the same issue with that, so it's not Pylance specific. Thanks for asking. Transferring this one to vscode-jupyter for us to deal with.
Actually I don't have permissions to move issues in this repo. Would you mind transferring it please @jakebailey?
Sure. Not sure why you don't, though... 🙂
Any updates or workarounds about this issue? I'm facing this issue now after the big UI update of the jupyter extention (v2021.6.999662501).
(Coming in from https://github.com/microsoft/vscode-jupyter/issues/6461)
@joyceerhl @jakebailey @greazer Would it please be possible, until you find time to investigate this bug, stop registering a document highlight provider? A document highlight provider that returns garbage ranges decreases from the value of vscode. It is better that the UI falls back to the word based highlighter if the language server always returns bad ranges.
cc @jrieken @kieferrm
There's nothing wrong with the underlying language server, this is a bug with the concat doc layer used to give the language server a document that looks like the cells (then convert back to cell locations). It appears to be incorrectly converting the locations.
Since the LSP is not cell aware, I believe all of the handlers are hooked up in one of the extensions directly, so could be disabled. (But, I'm not really sure how this fails but calls that do the same thing like diagnostics or references work fine.)
This requires changes similar to #6799. On the to do list.
This requires changes similar to #6799. On the to do list.
@rchiodo Can you shed some light? My understanding is that for #6799 the logic for how providers are being handled needed to change. My understanding of this issue is the following:
My understanding is that something in step 4 fails and that all highlight ranges are returned.
@jrieken Yes that is exactly what needs to happen. The translation in step 4 is not happening at the moment. In the work I did in #6799 I implemented that for semantic tokens.
ok. thanks for clarifying
@jrieken @rchiodo This issue was raised in May, and moved from the September milestone to the November milestone. Can it be closed in the near future?
Can it be closed in the near future?
The intent is to work on it for November. It may or not be closed by then.
@rchiodo I have taken a stab at this: https://github.com/microsoft/vscode-jupyter-lsp-middleware/pull/20
Thanks @jrieken . Your PR looks good to me. Once that goes through I can update the package.json in the jupyter repro
Verification steps:
Environment data
Expected behaviour
Editor highlights in a notebook cell should appear only for occurrences in the current cell.
Actual behaviour
Editor highlights in a notebook cell appear for occurrences in the current cell plus any occurrences in the rest of the document applied to the current editor, i.e. same line and column start/end but different cell editors. This behavior occurs with both Pylance and JediLSP, so most likely is not a Pylance specific problem.
Create a notebook with >=2 cells with text in them, e.g.
and
Highlight
pd
in the first cell. A highlight corresponding to the column start and end ofpd
in the second cell is also applied to the first cell editor:Logs
Code Snippet / Additional information