From d374d15359732455b92af38c4f65d60334654e0d Mon Sep 17 00:00:00 2001 From: Rich Chiodo Date: Fri, 21 Jan 2022 16:55:14 -0800 Subject: [PATCH 1/2] Fix problem with markdown being passed to pylance --- package-lock.json | 6 +++--- package.json | 2 +- .../notebook/intellisense/intellisenseProvider.ts | 5 ++++- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 535d1b04069..d67dfe378e1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3624,9 +3624,9 @@ } }, "@vscode/jupyter-lsp-middleware": { - "version": "0.2.34", - "resolved": "https://registry.npmjs.org/@vscode/jupyter-lsp-middleware/-/jupyter-lsp-middleware-0.2.34.tgz", - "integrity": "sha512-GT7ySQ11EE3Raj2TQcods9xGtCG8paOr5z4hX1uS2vqIuBTRGA3tiBgU0B+3bkNAe/wTWhLfMx7323L0/v9SSA==", + "version": "0.2.36", + "resolved": "https://registry.npmjs.org/@vscode/jupyter-lsp-middleware/-/jupyter-lsp-middleware-0.2.36.tgz", + "integrity": "sha512-oyYT8mdZolRuuen1brtjBSbjMypgmIjxpPL5M3JOAJv99LfRzjiHqVUS02mj6UJoYlnp588O88S+TzOB1TrBCw==", "requires": { "@vscode/lsp-notebook-concat": "^0.1.5", "fast-myers-diff": "^3.0.1", diff --git a/package.json b/package.json index ebbf679354a..1a5db75f933 100644 --- a/package.json +++ b/package.json @@ -2012,7 +2012,7 @@ "@jupyterlab/services": "^6.1.17", "@lumino/widgets": "^1.28.0", "@nteract/messaging": "^7.0.0", - "@vscode/jupyter-lsp-middleware": "^0.2.34", + "@vscode/jupyter-lsp-middleware": "^0.2.36", "ansi-to-html": "^0.6.7", "arch": "^2.1.0", "bootstrap": "^4.3.1", diff --git a/src/client/datascience/notebook/intellisense/intellisenseProvider.ts b/src/client/datascience/notebook/intellisense/intellisenseProvider.ts index 5410a86ce93..c7039be0915 100644 --- a/src/client/datascience/notebook/intellisense/intellisenseProvider.ts +++ b/src/client/datascience/notebook/intellisense/intellisenseProvider.ts @@ -185,7 +185,10 @@ export class IntellisenseProvider implements INotebookLanguageClientProvider, IE notebookId = activeInterpreter ? this.getInterpreterIdFromCache(activeInterpreter) : undefined; } - return interpreterId == notebookId; + // Cell also have to support python + const cell = notebook?.getCells().find((c) => c.document.uri.toString() === uri.toString()); + + return interpreterId == notebookId && (!cell || cell.document.languageId === 'python'); } private getNotebookHeader(uri: Uri) { From 1084ebd41e35df5c42343a2c54eca0ac43165321 Mon Sep 17 00:00:00 2001 From: Rich Chiodo Date: Fri, 21 Jan 2022 17:31:04 -0800 Subject: [PATCH 2/2] Add news entry --- news/2 Fixes/8769.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 news/2 Fixes/8769.md diff --git a/news/2 Fixes/8769.md b/news/2 Fixes/8769.md new file mode 100644 index 00000000000..bd690a9abbe --- /dev/null +++ b/news/2 Fixes/8769.md @@ -0,0 +1 @@ +Fix problem with markdown cells causing off by one errors in notebooks.