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
VSCode's intellisense misses variables from blocks that contain "import" statements #56
Comments
For the time being, here are a couple of workarounds to get both Intellisense and execution working for node modules that export objects// import * as tslab from "tslab"; // If I use this line, nothing declared in this block is visible in other blocks
const tslab = require("tslab") as typeof import('tslab')
// import { newPlot } from "./plot"
const { newPlot } = require('./plot') as typeof import('/...full-absolute-path-to-project.../src/plot') // (*)
// use tslab in this or any subsequent block (*) Intellisense seems to be completely lost about the CWD. I can't get any relative path to work with imports. I think when classes are exported this method throws an error: if that doesn't workblock 1: // @ts-ignore
import PriorityQueue_ from 'js-priority-queue'; // with this line, nothing declare in this block is visible for Intellisense in other blocks block 2: // @ts-ignore
const PriorityQueue = PriorityQueue_ as typeof import('js-priority-queue') // Intellisense will complain about PriorityQueue_ not being defined
// use PriorityQueue in this or any subsequent block |
Here are some clues:
Therefore:
|
Also reported here: microsoft/vscode#130000 |
This issue is not related to Jupyter. When working on a browser (with jupyter-notebook), Jupyter helps me when I type something from the block with an import and pressing on tab; but the imports and variables on import blocks give error on vs code with tslab. |
Btw, the workarounds did not work for me. |
Neither? Interesting, I'm using those |
Tried again, now it works, but I couldn't understand why. Thanks for your workaround: |
This workaround worked perfectly for me. Maybe a wiki page or something to make this easier to find? |
@dbuezas I'm also facing this issue, but, on top of that, execution also doesn't work for me inside VSCode. However, it does work when I execute notebooks inside Jupyter Lab. I did install everything locally as explained in the README, and actually see the kernels listed in the terminal. Is there some extra step needed to make VSCode work with the tslab TypeScript kernel? |
@aecorredor maybe you didn't select tslab as kernel for the notebook in vscode? |
I did. That's the weird thing. Here's a more complete error log: I did. That's the weird thing. I guess the question is, did it just work out of the box for you once you had the kernel installed? Here's a more complete error log:
|
Execution obviously works as intended, but error reporting (squiggle lines) and code autocompletion (outside of the block) break as soon as an
import
statement is used.This doesn't happen if I use
const { display } = require("tslab")
, but thendisplay
is of typeany
The text was updated successfully, but these errors were encountered: