Repository: TypeScript
Issue: REOPEN: Classes that extend other Classes are not properly parsed by the JS Editor
Labels: Needs More Info

Type: <b>Bug</b>

It seems if you have a class (e,g. AgentActivity) which extends another class (e.g., Activity) and you import the extended class (AgentActivity) into JS code, the editor initially fails to recognize the class as a class object until a change is made above the import, even if the change is to retype a colon.
Once the change is made, the class import turns green and it's methods are recognized in the body of the code.
This only lasts until the JS code file is reloaded for editing at some later time, whereupon the same problem recurs every time.

Sample code segment:

// Database
const BusinessUnit = require('../db/BusinessUnit');
const Activity = require('../db/Activity');
const AgentActivity = require('../db/AgentActivity');
const TimedActivity = require('../db/TimedActivity');
Note: AgentActivity extends Activity but shows in blue, and any attempt to use F12 (go to definition) on any of its methods results in a 'No Definition found for xxx' error. The rest of the classes are the correct green.

If I retype the colon or make any textual change in any line above the AgentActivity include, it turns green and its methods are now recognized in the JS code referencing it.

I cannot recreate this by simply creating classes, but I can demonstrate the issue by way of a screen recording. It is attached.
You'll need to unzip it. It is an MP4 file.

First I highlight that the Class name is not green in the body of the code when it is instantiated.
I attempt to use F12 to go to that method being used - it fails.
I then scroll to the Class import and show it is also not green.
I then add a single space at the end of a line above it.
I show the class name has now turned green.
I scroll back to the body of the code, note the Class name is now green here too.
I show I can now use the F12 key successfully.


VS Code version: Code 1.79.2 (695af097c7bd098fbf017ce3ac85e09bbc5dda06, 2023-06-14T08:57:04.379Z)
OS version: Windows_NT x64 10.0.22621
Modes:

<details>
<summary>System Info</summary>

|Item|Value|
|---|---|
|CPUs|Intel(R) Core(TM) i7-9850H CPU @ 2.60GHz (12 x 2592)|
|GPU Status|2d_canvas: enabled<br>canvas_oop_rasterization: disabled_off<br>direct_rendering_display_compositor: disabled_off_ok<br>gpu_compositing: enabled<br>multiple_raster_threads: enabled_on<br>opengl: enabled_on<br>rasterization: enabled<br>raw_draw: disabled_off_ok<br>video_decode: enabled<br>video_encode: enabled<br>vulkan: disabled_off<br>webgl: enabled<br>webgl2: enabled<br>webgpu: enabled|
|Load (avg)|undefined|
|Memory (System)|31.79GB (14.48GB free)|
|Process Argv|--crash-reporter-id 0d2f66ee-101b-4d7e-946b-87ab844b5438|
|Screen Reader|no|
|VM|50%|
</details><details><summary>Extensions (19)</summary>

Extension|Author (truncated)|Version
---|---|---
cform|aws|0.0.24
vscode-eslint|dba|2.4.2
vscode-firefox-debug|fir|2.9.8
cloudcode|goo|1.21.8
vscode-docker|ms-|1.25.2
vscode-kubernetes-tools|ms-|1.3.13
remote-containers|ms-|0.299.0
remote-wsl|ms-|0.79.5
live-server|ms-|0.4.8
java|red|1.20.0
vscode-yaml|red|1.13.0
snyk-vulnerability-scanner|sny|1.21.0
intellicode-api-usage-examples|Vis|0.2.7
vscodeintellicode|Vis|1.2.30
vscode-java-debug|vsc|0.52.0
vscode-java-dependency|vsc|0.23.0
vscode-java-pack|vsc|0.25.12
vscode-java-test|vsc|0.39.0
vscode-maven|vsc|0.41.0


</details><details>
<summary>A/B Experiments</summary>

```
vsliv368cf:30146710
vsreu685:30147344
python383:30185418
vspor879:30202332
vspor708:30202333
vspor363:30204092
vslsvsres303:30308271
vserr242:30382549
pythontb:30283811
vsjup518:30340749
pythonptprofiler:30281270
vshan820:30294714
vstes263:30335439
vscoreces:30445986
vscod805:30301674
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
vsaa593cf:30376535
pythonvs932:30410667
py29gd2263:30776702
vsclangdf:30486550
c4g48928:30535728
dsvsc012:30540252
pynewext54:30695312
azure-dev_surveyone:30548225
3biah626:30602489
pyind779:30671433
f6dab269:30613381
pythonsymbol12:30671437
showlangstatbar:30737416
vsctsb:30748421
pythonms35:30701012
03d35959:30757346
7ij38806:30736111
pythonfmttext:30731395
pythoncmvfstrcf:30756944
fixshowwlkth:30771522
hideindicator:30766889
pythongtdpath:30769146
bgfeh915:30780428
pythonnosmt12:30779714
pythonidxpt:30784022
pythonnoceb:30776495

```

</details>

<!-- generated by issue reporter -->
[VisualStudioEditorClassFail.zip](https://github.com/microsoft/vscode/files/11973151/VisualStudioEditorClassFail.zip)