Skip to content

VSCode Find All References Not Working for Imported Functions #59134

Open
@lblblong

Description

@lblblong

Type: Bug

Description

I am encountering an issue with the 'Find All References' feature in VSCode after updating to the latest version. When I export functions from a module and import them using import * as user from './user', the 'Find All References' feature does not find any references to the functions within the imported module.

Steps to Reproduce

  1. Create a file named user.ts with the following content:

    export function method1() {
        console.log('method1');
    }
    
    export function method2() {
        console.log('method2');
    }
  2. Create a file named api.ts with the following content:

    import * as user from './user';
    
    export const api = {
        user
    };
  3. Create a file named index.ts with the following content:

    import { api } from './api';
    
    api.user.method1();
    api.user.method2();

Expected Behavior

The 'Find All References' feature should find all references to method1 and method2 in the user module when invoked on any of these functions.

Actual Behavior

The 'Find All References' feature does not find any references to method1 and method2 in the user module.

Workaround

The issue can be temporarily resolved by exporting an object containing the functions instead of exporting the functions directly. For example, in user.ts, export an object like export const user = { method1, method2 } and then import this object in api.ts and index.ts.

System Info
Item Value
CPUs AMD Ryzen 7 7840HS w/ Radeon 780M Graphics (16 x 3793)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
Load (avg) undefined
Memory (System) 31.33GB (16.22GB free)
Process Argv --folder-uri file:///c:/Users/lblbl/i/mosschat-desktop --crash-reporter-id 1e1b7228-e9fd-45d6-931e-c87556e1dd9c
Screen Reader no
VM 0%
Item Value
Remote WSL: Ubuntu
OS Linux x64 5.15.153.1-microsoft-standard-WSL2
CPUs AMD Ryzen 7 7840HS w/ Radeon 780M Graphics (16 x 0)
Memory (System) 15.29GB (13.00GB free)
VM 0%
Extensions (25)
Extension Author (truncated) Version
codespaces Git 1.16.23
remote-containers ms- 0.369.0
remote-ssh ms- 0.112.0
remote-ssh-edit ms- 0.86.0
remote-wsl ms- 0.88.0
vscode-remote-extensionpack ms- 0.25.0
remote-explorer ms- 0.4.3
remote-server ms- 1.5.1
material-icon-theme PKi 5.1.0
svg-preview Sim 2.8.3
JavaScriptSnippets xab 1.8.0
path-intellisense chr 2.9.0
vscode-css-modules cli 0.5.1
vscode-deno den 3.37.1
prettier-vscode esb 10.4.0
vscode-expo-tools exp 1.5.0
copilot Git 1.208.0
copilot-chat Git 0.16.1
vscode-pull-request-github Git 0.90.0
git-graph mhu 1.30.0
vscode-docker ms- 1.29.1
vscode-language-pack-zh-hans MS- 1.90.2024061209
vscode-typescript-next ms- 5.6.20240629
cssvar pho 2.6.4
LiveServer rit 5.7.9
A/B Experiments
vsliv368:30146709
vspor879:30202332
vspor708:30202333
vspor363:30204092
vscorecescf:30445987
vscod805cf:30301675
binariesv615:30325510
vsaa593:30376534
py29gd2263:31024239
c4g48928:30535728
azure-dev_surveyone:30548225
a9j8j154:30646983
962ge761:30959799
pythongtdpath:30769146
pythonnoceb:30805159
asynctok:30898717
pythonregdiag2:30936856
pythonmypyd1:30879173
2e7ec940:31000449
pythontbext0:30879054
dsvsc016:30899300
dsvsc017:30899301
dsvsc018:30899302
cppperfnew:31000557
dsvsc020:30976470
pythonait:31006305
jchc7451:31067544
dsvsc021:30996838
01bff139:31013167
pythoncenvpt:31062603
a69g1124:31058053
dvdeprecation:31068756
dwnewjupyter:31046869
impr_priority:31082723

Metadata

Metadata

Assignees

Labels

Needs More InfoThe issue still hasn't been fully clarified

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions