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

VS Code doesn't highlight function delcared later in ipynb due to Pylance #6884

Closed
AmazingGabriel16 opened this issue Jan 23, 2025 · 2 comments
Assignees
Labels
needs repro Issue has not been reproduced yet

Comments

@AmazingGabriel16
Copy link

Type: Bug

In an ipynb file, VS Code does not highlight a called function that is declared later on in an ipynb file. Though the function is accessible when the code is executed, and is even stated to be a function when moving the mouse over the called function to check the issue, it still says that it is not defined by pylance and thus does not get highlighted by VS Code.

Extension version: 2024.12.1
VS Code version: Code 1.96.4 (cd4ee3b1c348a13bafd8f9ad8060705f6d4b9cba, 2025-01-16T00:16:19.038Z)
OS version: Windows_NT x64 10.0.19045
Modes:

System Info
Item Value
CPUs AMD Ryzen 9 5950X 16-Core Processor (32 x 3400)
GPU Status 2d_canvas: unavailable_software
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: disabled_software
multiple_raster_threads: enabled_on
opengl: disabled_off
rasterization: disabled_software
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: disabled_software
video_encode: disabled_software
vulkan: disabled_off
webgl: unavailable_software
webgl2: unavailable_software
webgpu: unavailable_software
webnn: unavailable_software
Load (avg) undefined
Memory (System) 127.91GB (108.04GB free)
Process Argv E:\Fun\Code\HEA-research --crash-reporter-id 19a2c745-f3e3-4229-bd43-0d6ba85f46d8
Screen Reader no
VM 0%
A/B Experiments
vsliv368:30146709
vspor879:30202332
vspor708:30202333
vspor363:30204092
vscod805cf:30301675
binariesv615:30325510
vsaa593:30376534
py29gd2263:31024239
c4g48928:30535728
azure-dev_surveyone:30548225
962ge761:30959799
pythonnoceb:30805159
pythonmypyd1:30879173
2e7ec940:31000449
pythontbext0:30879054
cppperfnew:31000557
dsvsc020:30976470
pythonait:31006305
dsvsc021:30996838
dvdeprecation:31068756
dwnewjupyter:31046869
newcmakeconfigv2:31071590
nativerepl1:31139838
pythonrstrctxt:31112756
nativeloc2:31192216
cf971741:31144450
iacca1:31171482
notype1cf:31157160
5fd0e150:31155592
dwcopilot:31170013
stablechunks:31184530
6074i472:31201624
dwoutputs:31217127
hdaa2157:31222309
copilot_t_ci:31222730

Images of the issue:

Image

Image

Image

Image

@github-actions github-actions bot added the needs repro Issue has not been reproduced yet label Jan 23, 2025
@AmazingGabriel16
Copy link
Author

Might be more related to VS Code bug than pylance, closed issue here

@rchiodo
Copy link
Contributor

rchiodo commented Jan 23, 2025

This is a Pylance issue actually but it's functioning as designed. If you have a notebook where you call cells out of order, Pylance cannot infer functions farther down.

Pylance treats cells as having imported the cells before them (that's how it finds functions defined in previous cells).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs repro Issue has not been reproduced yet
Projects
None yet
Development

No branches or pull requests

2 participants