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

Jupyter language server considers cells separately - regression in v1.37.2 #20920

Closed
mrgrain opened this issue Oct 16, 2023 · 2 comments
Closed

Comments

@mrgrain
Copy link

mrgrain commented Oct 16, 2023

Consider the following simple notebook:
image

This notebook works as expected. It defines the variable hello in cell 1 and has no problem printing it from cell 2.
The issue is that the language server incorrectly evaluates the context of each cell separately and fails to find the hello variable in cell 2 (red squiggly line, see screenshot below). This used to work correctly in v1.37.1.

image

There is a variation of this issue involving globalThis. Also used to work in v1.37.1.
image
With stuff.ts being:

globalThis.hello2 = 'also world';

Full notebook source:

{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "const hello = \"world\";"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "world\n"
     ]
    }
   ],
   "source": [
    "console.log(hello);"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Deno",
   "language": "typescript",
   "name": "deno"
  },
  "language_info": {
   "file_extension": ".ts",
   "mimetype": "text/x.typescript",
   "name": "typescript",
   "nb_converter": "script",
   "pygments_lexer": "typescript",
   "version": "5.2.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
@nayeemrmn
Copy link
Collaborator

Tracked in denoland/vscode_deno#932.

I believed it worked in previous versions because the Deno LSP wasn't being used at all, and it wouldn't have worked for cells containing imports. Correct me if I'm wrong.

@mrgrain
Copy link
Author

mrgrain commented Oct 16, 2023

Ah apologies for the duplicate. 🙏🏻

I believed it worked in previous versions because the Deno LSP wasn't being used at all, and it wouldn't have worked for cells containing imports. Correct me if I'm wrong.

This might well be the case, but I don't know for sure 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants