Skip to content

Cannot properly Find All References in VSCode even when using nx --workspaces with project references #30378

@GautierBlandin

Description

@GautierBlandin

Current Behavior

Despite setting up project references using the --workspaces option, Find All References still does not work under the default tsconfig setup.

Expected Behavior

When properly setting up project references, the problems encountered in #3106 should be fixed and Find All References should properly work when using VS Code as an IDE.

GitHub Repo

https://github.com/GautierBlandin/nx-vscode-issue

Steps to Reproduce

  1. Create an nx workspace using the latest CLI version and using the --workspace to setup project references: npx create-nx-workspace@latest tsmono --workspaces. To make the reproduction as simple as possible, I chose:
  • Stack: node
  • Framework: none
  • Application name: server
  • Generate a dockerfile: no
  • Test runner: none
  • ESLint: no
  • Prettier: no
  • CI: skip
  • Remote caching: skip
  1. Create a simple, non-buildable library: nx g lib libs/mytslib. Options:
  • Generator: @nx/js:library
  • Linter: none
  • Test runner: none
  1. Update main.ts in the server app to import from mytslib:
// main.ts
import { mytslib } from "@tsmono/mytslib";

console.log(mytslib());
  1. Run nx sync so that the server's tsconfig references the library's tsconfig.

  2. Close all files in the IDE, and open only libs/mytslib/src/lib/mytslib.ts

  3. Restart the typescript server, or restart the IDE

  4. Right-click on mytslib, and use the Find All References action. Only one reference will be found (the current file), where two should be (the current file and main.ts).

Nx Report

Node           : 23.9.0
OS             : darwin-arm64
Native Target  : aarch64-macos
npm            : 10.9.2

nx (global)    : 20.0.4
nx             : 20.5.0
@nx/js         : 20.5.0
@nx/jest       : 20.5.0
@nx/eslint     : 20.5.0
@nx/workspace  : 20.5.0
@nx/devkit     : 20.5.0
@nx/esbuild    : 20.5.0
@nx/node       : 20.5.0
typescript     : 5.7.3
---------------------------------------
Registered Plugins:
@nx/js/typescript
@nx/js/typescript

Failure Logs

Package Manager Version

No response

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

Adding "include": ["src/**/*.ts"], to the library's tsconfig.json file seems to fix the problem. However, this means that two tsconfig files now include mytslib.ts. I am not sure of the consequences that this may have, and seems undesirable. However, no amount of tinkering with projects references on my side managed to fix the issue.

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions