microsoft / TypeScript

TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
https://www.typescriptlang.org
Apache License 2.0
101.12k stars 12.5k forks source link

Rush's node_modules structure is not resolved in vscode correctly #28689

Closed nfour closed 4 years ago

nfour commented 5 years ago

When trying to auto-import node modules within a rush project, intellisense will not locate dependencies. This also results in the editor crashing or re-initializing the TS server somewhat often.

This is likely due to rush's unique node module structure, and it's unclear if this ever worked as I have only adopted rush somewhat recently.

Steps to Reproduce:

You can replicate this issue within the web-build-tools repo itself.

  1. Open https://github.com/Microsoft/web-build-tools/blob/master/libraries/ts-command-line/src/index.ts
  2. type Colors in the top level (from the colors module). You shouldn't be able to resolve the symbol.

eg.

const foo: Colors = {};

export {
  CommandLineAction,
  ICommandLineActionOptions
} from './CommandLineAction';

This also seems to correlate with the editor's TS server crashing intermittently, but its not clear how to reproduce.

Does this issue occur when all extensions are disabled?: Yes

Versions tested:

Workaround

If you execute the below script to replace symlinks with real files:

mv node_modules node_modules_old
rsync node_modules_old/ node_modules/ -a --copy-links -v

Everything should work as expected.

There seems to be an issue with symlinks.

Related: https://github.com/Microsoft/web-build-tools/issues/955

octogonz commented 5 years ago

@mjbvz let us know if there's any help you need investigating this issue. Rush is pretty widely used internally at Microsoft, so if there is a problem with its symlinking strategy, we'd like to get that fixed.

I'll point out that the symbolic links were recently converted to use relative paths. I wonder if that could be related...

nfour commented 5 years ago

Seems I am getting this error in the TSServer output panel of vscode:

[Error  - 10:56:03 AM] 'signatureHelp' request failed with error.
Error processing request. Cannot read property 'pos' of undefined
TypeError: Cannot read property 'pos' of undefined
    at Object.rangeContainsRange (/opt/visual-studio-code-insiders/resources/app/extensions/node_modules/typescript/lib/tsserver.js:92870:41)
    at _loop_6 (/opt/visual-studio-code-insiders/resources/app/extensions/node_modules/typescript/lib/tsserver.js:103736:36)
    at getContainingArgumentInfo (/opt/visual-studio-code-insiders/resources/app/extensions/node_modules/typescript/lib/tsserver.js:103743:31)
    at Object.getSignatureHelpItems (/opt/visual-studio-code-insiders/resources/app/extensions/node_modules/typescript/lib/tsserver.js:103358:32)
    at Object.getSignatureHelpItems (/opt/visual-studio-code-insiders/resources/app/extensions/node_modules/typescript/lib/tsserver.js:117586:37)
    at IOSession.Session.getSignatureHelpItems (/opt/visual-studio-code-insiders/resources/app/extensions/node_modules/typescript/lib/tsserver.js:125409:62)
    at Session.handlers.ts.createMapFromTemplate._a.(anonymous function) (/opt/visual-studio-code-insiders/resources/app/extensions/node_modules/typescript/lib/tsserver.js:124364:61)
    at /opt/visual-studio-code-insiders/resources/app/extensions/node_modules/typescript/lib/tsserver.js:125830:88
    at IOSession.Session.executeWithRequestId (/opt/visual-studio-code-insiders/resources/app/extensions/node_modules/typescript/lib/tsserver.js:125821:28)
    at IOSession.Session.executeCommand (/opt/visual-studio-code-insiders/resources/app/extensions/node_modules/typescript/lib/tsserver.js:125830:33)
    at IOSession.Session.onMessage (/opt/visual-studio-code-insiders/resources/app/extensions/node_modules/typescript/lib/tsserver.js:125852:35)
    at Interface.<anonymous> (/opt/visual-studio-code-insiders/resources/app/extensions/node_modules/typescript/lib/tsserver.js:127112:27)
    at emitOne (events.js:116:13)
    at Interface.emit (events.js:211:7)
    at Interface._onLine (readline.js:282:10)
    at Interface._normalWrite (readline.js:424:12)
    at Socket.ondata (readline.js:141:10)
    at emitOne (events.js:116:13)
    at Socket.emit (events.js:211:7)
    at addChunk (_stream_readable.js:263:12)
    at readableAddChunk (_stream_readable.js:250:11)
    at Socket.Readable.push (_stream_readable.js:208:10)
    at Pipe.onread (net.js:594:20)
[Error  - 11:12:41 AM] 'signatureHelp' request failed with error.

This correlates with the TS Server showing Loading... on hover over stuff that should be typed.

The tsserver-log contains the below around that time (before).

[11:6:20.480] Got install request {"projectName":"/dev/null/inferredProject1*","fileNames":["/opt/visual-studio-code-insiders/resources/app/extensions/node_modules/typescript/lib/lib.es5.d.ts","/opt/visual-studio-code-insiders/resources/app/extensions/node_modules/typescript/lib/lib.es2015.d.ts","/opt/visual-studio-code-insiders/resources/app/extensions/node_modules/typescript/lib/lib.es2016.d.ts","/opt/visual-studio-code-insiders/resources/app/extensions/node_modules/typescript/lib/lib.dom.d.ts","/opt/visual-studio-code-insiders/resources/app/extensions/node_modules/typescript/lib/lib.dom.iterable.d.ts","/opt/visual-studio-code-insiders/resources/app/extensions/node_modules/typescript/lib/lib.webworker.importscripts.d.ts","/opt/visual-studio-code-insiders/resources/app/extensions/node_modules/typescript/lib/lib.scripthost.d.ts","/opt/visual-studio-code-insiders/resources/app/extensions/node_modules/typescript/lib/lib.es2015.core.d.ts","/opt/visual-studio-code-insiders/resources/app/extensions/node_modules/typescript/lib/lib.es2015.collection.d.ts","/opt/visual-studio-code-insiders/resources/app/extensions/node_modules/typescript/lib/lib.es2015.generator.d.ts","/opt/visual-studio-code-insiders/resources/app/extensions/node_modules/typescript/lib/lib.es2015.iterable.d.ts","/opt/visual-studio-code-insiders/resources/app/extensions/node_modules/typescript/lib/lib.es2015.promise.d.ts","/opt/visual-studio-code-insiders/resources/app/extensions/node_modules/typescript/lib/lib.es2015.proxy.d.ts","/opt/visual-studio-code-insiders/resources/app/extensions/node_modules/typescript/lib/lib.es2015.reflect.d.ts","/opt/visual-studio-code-insiders/resources/app/extensions/node_modules/typescript/lib/lib.es2015.symbol.d.ts","/opt/visual-studio-code-insiders/resources/app/extensions/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","/opt/visual-studio-code-insiders/resources/app/extensions/node_modules/typescript/lib/lib.es2016.array.include.d.ts","/opt/visual-studio-code-insiders/resources/app/extensions/node_modules/typescript/lib/lib.es2016.full.d.ts","/home/sam/.cache/typescript/3.2/node_modules/@types/bluebird/index.d.ts","/home/sam/.cache/typescript/3.2/node_modules/@types/execa/index.d.ts","/home/sam/.cache/typescript/3.2/node_modules/@types/fs-extra/index.d.ts","/home/sam/.cache/typescript/3.2/node_modules/@types/inquirer/index.d.ts","/home/sam/.cache/typescript/3.2/node_modules/@types/jest/index.d.ts","/home/sam/.cache/typescript/3.2/node_modules/@types/js-yaml/index.d.ts","/home/sam/.cache/typescript/3.2/node_modules/@types/lodash/common/common.d.ts","/home/sam/.cache/typescript/3.2/node_modules/@types/lodash/common/array.d.ts","/home/sam/.cache/typescript/3.2/node_modules/@types/lodash/common/collection.d.ts","/home/sam/.cache/typescript/3.2/node_modules/@types/lodash/common/date.d.ts","/home/sam/.cache/typescript/3.2/node_modules/@types/lodash/common/function.d.ts","/home/sam/.cache/typescript/3.2/node_modules/@types/lodash/common/lang.d.ts","/home/sam/.cache/typescript/3.2/node_modules/@types/lodash/common/math.d.ts","/home/sam/.cache/typescript/3.2/node_modules/@types/lodash/common/number.d.ts","/home/sam/.cache/typescript/3.2/node_modules/@types/lodash/common/object.d.ts","/home/sam/.cache/typescript/3.2/node_modules/@types/lodash/common/seq.d.ts","/home/sam/.cache/typescript/3.2/node_modules/@types/lodash/common/string.d.ts","/home/sam/.cache/typescript/3.2/node_modules/@types/lodash/common/util.d.ts","/home/sam/.cache/typescript/3.2/node_modules/@types/lodash/index.d.ts","/home/sam/.cache/typescript/3.2/node_modules/@types/puppeteer/index.d.ts","/home/sam/.cache/typescript/3.2/node_modules/@types/uuid/index.d.ts","/home/sam/.cache/typescript/3.2/node_modules/@types/yargs/index.d.ts","/home/sam/W/TEMANDO/temonodo/tests/suite/node_modules/aws-sdk/index.d.ts","/home/sam/W/TEMANDO/temonodo/tests/suite/node_modules/moment/moment.d.ts","/home/sam/W/TEMANDO/temonodo/tests/suite/node_modules/ts-jest/dist/index.d.ts","/home/sam/W/TEMANDO/temonodo/tests/suite/node_modules/ts-node/dist/index.d.ts","/home/sam/W/TEMANDO/temonodo/tests/suite/node_modules/tslint/lib/index.d.ts","/home/sam/W/TEMANDO/temonodo/tests/suite/node_modules/typescript/lib/typescript.d.ts"],"compilerOptions":{"module":1,"target":3,"jsx":1,"checkJs":true,"allowJs":true,"allowSyntheticDefaultImports":true,"allowNonTsExtensions":true,"noEmitForJsFiles":true},"typeAcquisition":{"enable":true,"include":[],"exclude":[]},"unresolvedImports":["make-error"],"projectRootPath":"/home/sam/W/TEMANDO/temonodo/tests/suite","kind":"discover"}
[11:6:20.480] Explicitly included types: []
[11:6:20.481] Typing names in '/home/sam/W/TEMANDO/temonodo/tests/suite/package.json' dependencies: ["@temando/errors","@temando/marco","@temando/schemas","@temando/sdk","@types/bluebird","@types/execa","@types/fs-extra","@types/inquirer","@types/jest","@types/js-yaml","@types/lodash","@types/node","@types/puppeteer","@types/uuid","@types/yargs","aws-sdk","bluebird","colors","execa","fermenter","fs-extra","inquirer","jest-environment-node","jest","js-yaml","lodash","moment","puppeteer","signal-exit","ts-jest","ts-node","tslint-config-temando","tslint","typescript","uuid","yargs"]
[11:6:20.503] Searching for typing names in /home/sam/W/TEMANDO/temonodo/tests/suite/node_modules; all files: ["/home/sam/W/TEMANDO/temonodo/tests/suite/node_modules/aws-sdk/package.json","/home/sam/W/TEMANDO/temonodo/tests/suite/node_modules/bluebird/package.json","/home/sam/W/TEMANDO/temonodo/tests/suite/node_modules/colors/package.json","/home/sam/W/TEMANDO/temonodo/tests/suite/node_modules/execa/package.json","/home/sam/W/TEMANDO/temonodo/tests/suite/node_modules/fermenter/package.json","/home/sam/W/TEMANDO/temonodo/tests/suite/node_modules/fermenter/tsconfig.json","/home/sam/W/TEMANDO/temonodo/tests/suite/node_modules/fermenter/tslint.json","/home/sam/W/TEMANDO/temonodo/tests/suite/node_modules/fs-extra/package.json","/home/sam/W/TEMANDO/temonodo/tests/suite/node_modules/inquirer/package.json","/home/sam/W/TEMANDO/temonodo/tests/suite/node_modules/jest/package.json","/home/sam/W/TEMANDO/temonodo/tests/suite/node_modules/jest-environment-node/package.json","/home/sam/W/TEMANDO/temonodo/tests/suite/node_modules/jest-spec-reporter/package.json","/home/sam/W/TEMANDO/temonodo/tests/suite/node_modules/js-yaml/package.json","/home/sam/W/TEMANDO/temonodo/tests/suite/node_modules/lodash/package.json","/home/sam/W/TEMANDO/temonodo/tests/suite/node_modules/moment/package.json","/home/sam/W/TEMANDO/temonodo/tests/suite/node_modules/puppeteer/package.json","/home/sam/W/TEMANDO/temonodo/tests/suite/node_modules/signal-exit/package.json","/home/sam/W/TEMANDO/temonodo/tests/suite/node_modules/ts-jest/package.json","/home/sam/W/TEMANDO/temonodo/tests/suite/node_modules/ts-jest/tsconfig.json","/home/sam/W/TEMANDO/temonodo/tests/suite/node_modules/ts-jest/tslint.json","/home/sam/W/TEMANDO/temonodo/tests/suite/node_modules/ts-node/package.json","/home/sam/W/TEMANDO/temonodo/tests/suite/node_modules/tslint/package.json","/home/sam/W/TEMANDO/temonodo/tests/suite/node_modules/tslint-config-temando/package-deps.json","/home/sam/W/TEMANDO/temonodo/tests/suite/node_modules/tslint-config-temando/package.json","/home/sam/W/TEMANDO/temonodo/tests/suite/node_modules/tslint-config-temando/tsconfig.json","/home/sam/W/TEMANDO/temonodo/tests/suite/node_modules/tslint-config-temando/tslint.json","/home/sam/W/TEMANDO/temonodo/tests/suite/node_modules/typescript/package.json","/home/sam/W/TEMANDO/temonodo/tests/suite/node_modules/uuid/.eslintrc.json","/home/sam/W/TEMANDO/temonodo/tests/suite/node_modules/uuid/package.json","/home/sam/W/TEMANDO/temonodo/tests/suite/node_modules/yargs/package.json"]
[11:6:20.504]     Package 'aws-sdk' provides its own types.
[11:6:20.512]     Package 'moment' provides its own types.
[11:6:20.514]     Package 'ts-jest' provides its own types.
[11:6:20.515]     Package 'ts-node' provides its own types.
[11:6:20.515]     Package 'tslint' provides its own types.
[11:6:20.518]     Package 'typescript' provides its own types.
[11:6:20.520]     Found package names: ["bluebird","colors","execa","fermenter","fs-extra","inquirer","jest","jest-environment-node","jest-spec-reporter","js-yaml","lodash","puppeteer","signal-exit","tslint-config-temando","uuid","yargs"]
[11:6:20.520] Inferred typings from unresolved imports: ["make-error"]
[11:6:20.520] Result: {"cachedTypingPaths":["/home/sam/W/TEMANDO/temonodo/tests/suite/node_modules/aws-sdk/index.d.ts","/home/sam/.cache/typescript/3.2/node_modules/@types/bluebird/index.d.ts","/home/sam/.cache/typescript/3.2/node_modules/@types/execa/index.d.ts","/home/sam/.cache/typescript/3.2/node_modules/@types/fs-extra/index.d.ts","/home/sam/.cache/typescript/3.2/node_modules/@types/inquirer/index.d.ts","/home/sam/.cache/typescript/3.2/node_modules/@types/jest/index.d.ts","/home/sam/.cache/typescript/3.2/node_modules/@types/js-yaml/index.d.ts","/home/sam/.cache/typescript/3.2/node_modules/@types/lodash/index.d.ts","/home/sam/W/TEMANDO/temonodo/tests/suite/node_modules/moment/moment.d.ts","/home/sam/.cache/typescript/3.2/node_modules/@types/puppeteer/index.d.ts","/home/sam/W/TEMANDO/temonodo/tests/suite/node_modules/ts-jest/dist/index.d.ts","/home/sam/W/TEMANDO/temonodo/tests/suite/node_modules/ts-node/dist/index.d.ts","/home/sam/W/TEMANDO/temonodo/tests/suite/node_modules/tslint/lib/index.d.ts","/home/sam/W/TEMANDO/temonodo/tests/suite/node_modules/typescript/lib/typescript.d.ts","/home/sam/.cache/typescript/3.2/node_modules/@types/uuid/index.d.ts","/home/sam/.cache/typescript/3.2/node_modules/@types/yargs/index.d.ts"],"newTypingNames":["@temando/errors","@temando/marco","@temando/schemas","@temando/sdk","@types/bluebird","@types/execa","@types/fs-extra","@types/inquirer","@types/jest","@types/js-yaml","@types/lodash","@types/node","@types/puppeteer","@types/uuid","@types/yargs","colors","fermenter","jest-environment-node","signal-exit","tslint-config-temando","jest-spec-reporter","make-error"],"filesToWatch":["/home/sam/W/TEMANDO/temonodo/tests/suite/package.json","/home/sam/W/TEMANDO/temonodo/tests/suite/bower_components","/home/sam/W/TEMANDO/temonodo/tests/suite/node_modules"]}
[11:6:20.520] Finished typings discovery: {"cachedTypingPaths":["/home/sam/W/TEMANDO/temonodo/tests/suite/node_modules/aws-sdk/index.d.ts","/home/sam/.cache/typescript/3.2/node_modules/@types/bluebird/index.d.ts","/home/sam/.cache/typescript/3.2/node_modules/@types/execa/index.d.ts","/home/sam/.cache/typescript/3.2/node_modules/@types/fs-extra/index.d.ts","/home/sam/.cache/typescript/3.2/node_modules/@types/inquirer/index.d.ts","/home/sam/.cache/typescript/3.2/node_modules/@types/jest/index.d.ts","/home/sam/.cache/typescript/3.2/node_modules/@types/js-yaml/index.d.ts","/home/sam/.cache/typescript/3.2/node_modules/@types/lodash/index.d.ts","/home/sam/W/TEMANDO/temonodo/tests/suite/node_modules/moment/moment.d.ts","/home/sam/.cache/typescript/3.2/node_modules/@types/puppeteer/index.d.ts","/home/sam/W/TEMANDO/temonodo/tests/suite/node_modules/ts-jest/dist/index.d.ts","/home/sam/W/TEMANDO/temonodo/tests/suite/node_modules/ts-node/dist/index.d.ts","/home/sam/W/TEMANDO/temonodo/tests/suite/node_modules/tslint/lib/index.d.ts","/home/sam/W/TEMANDO/temonodo/tests/suite/node_modules/typescript/lib/typescript.d.ts","/home/sam/.cache/typescript/3.2/node_modules/@types/uuid/index.d.ts","/home/sam/.cache/typescript/3.2/node_modules/@types/yargs/index.d.ts"],"newTypingNames":["@temando/errors","@temando/marco","@temando/schemas","@temando/sdk","@types/bluebird","@types/execa","@types/fs-extra","@types/inquirer","@types/jest","@types/js-yaml","@types/lodash","@types/node","@types/puppeteer","@types/uuid","@types/yargs","colors","fermenter","jest-environment-node","signal-exit","tslint-config-temando","jest-spec-reporter","make-error"],"filesToWatch":["/home/sam/W/TEMANDO/temonodo/tests/suite/package.json","/home/sam/W/TEMANDO/temonodo/tests/suite/bower_components","/home/sam/W/TEMANDO/temonodo/tests/suite/node_modules"]}
[11:6:20.520] Installing typings ["@temando/errors","@temando/marco","@temando/schemas","@temando/sdk","@types/bluebird","@types/execa","@types/fs-extra","@types/inquirer","@types/jest","@types/js-yaml","@types/lodash","@types/node","@types/puppeteer","@types/uuid","@types/yargs","colors","fermenter","jest-environment-node","signal-exit","tslint-config-temando","jest-spec-reporter","make-error"]
[11:6:20.520] '@temando/errors' is in missingTypingsSet - skipping...
[11:6:20.521] '@temando/marco' is in missingTypingsSet - skipping...
[11:6:20.521] '@temando/schemas' is in missingTypingsSet - skipping...
[11:6:20.521] '@temando/sdk' is in missingTypingsSet - skipping...
[11:6:20.521] '@types/bluebird' is in missingTypingsSet - skipping...
[11:6:20.521] '@types/execa' is in missingTypingsSet - skipping...
[11:6:20.521] '@types/fs-extra' is in missingTypingsSet - skipping...
[11:6:20.521] '@types/inquirer' is in missingTypingsSet - skipping...
[11:6:20.521] '@types/jest' is in missingTypingsSet - skipping...
[11:6:20.521] '@types/js-yaml' is in missingTypingsSet - skipping...
[11:6:20.521] '@types/lodash' is in missingTypingsSet - skipping...
[11:6:20.521] '@types/node' is in missingTypingsSet - skipping...
[11:6:20.521] '@types/puppeteer' is in missingTypingsSet - skipping...
[11:6:20.521] '@types/uuid' is in missingTypingsSet - skipping...
[11:6:20.521] '@types/yargs' is in missingTypingsSet - skipping...
[11:6:20.521] Entry for package 'colors' does not exist in local types registry - skipping...
[11:6:20.521] Entry for package 'fermenter' does not exist in local types registry - skipping...
[11:6:20.521] Entry for package 'jest-environment-node' does not exist in local types registry - skipping...
[11:6:20.521] Entry for package 'signal-exit' does not exist in local types registry - skipping...
[11:6:20.521] Entry for package 'tslint-config-temando' does not exist in local types registry - skipping...
[11:6:20.521] Entry for package 'jest-spec-reporter' does not exist in local types registry - skipping...
[11:6:20.521] Entry for package 'make-error' does not exist in local types registry - skipping...
[11:6:20.521] All typings are known to be missing or invalid - no need to install more typings
[11:6:20.521] Sending response:
    {"projectName":"/dev/null/inferredProject1*","typeAcquisition":{"enable":true,"include":[],"exclude":[]},"compilerOptions":{"module":1,"target":3,"jsx":1,"checkJs":true,"allowJs":true,"allowSyntheticDefaultImports":true,"allowNonTsExtensions":true,"noEmitForJsFiles":true},"typings":["/home/sam/W/TEMANDO/temonodo/tests/suite/node_modules/aws-sdk/index.d.ts","/home/sam/.cache/typescript/3.2/node_modules/@types/bluebird/index.d.ts","/home/sam/.cache/typescript/3.2/node_modules/@types/execa/index.d.ts","/home/sam/.cache/typescript/3.2/node_modules/@types/fs-extra/index.d.ts","/home/sam/.cache/typescript/3.2/node_modules/@types/inquirer/index.d.ts","/home/sam/.cache/typescript/3.2/node_modules/@types/jest/index.d.ts","/home/sam/.cache/typescript/3.2/node_modules/@types/js-yaml/index.d.ts","/home/sam/.cache/typescript/3.2/node_modules/@types/lodash/index.d.ts","/home/sam/W/TEMANDO/temonodo/tests/suite/node_modules/moment/moment.d.ts","/home/sam/.cache/typescript/3.2/node_modules/@types/puppeteer/index.d.ts","/home/sam/W/TEMANDO/temonodo/tests/suite/node_modules/ts-jest/dist/index.d.ts","/home/sam/W/TEMANDO/temonodo/tests/suite/node_modules/ts-node/dist/index.d.ts","/home/sam/W/TEMANDO/temonodo/tests/suite/node_modules/tslint/lib/index.d.ts","/home/sam/W/TEMANDO/temonodo/tests/suite/node_modules/typescript/lib/typescript.d.ts","/home/sam/.cache/typescript/3.2/node_modules/@types/uuid/index.d.ts","/home/sam/.cache/typescript/3.2/node_modules/@types/yargs/index.d.ts"],"unresolvedImports":["make-error"],"kind":"action::set"}
[11:6:20.521] Response has been sent.
[11:19:22.360] Parent process has exited, shutting down...

The [11:19:22.360] Parent process has exited, shutting down... is when I manually restarted the TS Server as it was failing to validate my code.

sheetalkamat commented 5 years ago

Do I need to do anything special apart from cloning repo, opening file and typing the statement mentioned? I followed those steps (with typescript nightly build) but that seem to work as intended. Do not see any process shutdown or crash. Let me know if I need to do something else. If possible please share full tsserver log so we can see where things might be going south. Thanks.

You can enable log level verbose in settigns and open and log and share tsserver and ti log or upload them using

  1. With "typescript.tsserver.log": "verbose" enabled
    1. Restart vscode or vscode insiders
    2. Reproduce the problem
    3. Run code --upload-logs on the command line (or code-insiders --upload-logs if using vscode insiders) and follow instructions
    4. Share the log file ID
nfour commented 5 years ago

@sheetalkamat

To replicate, by following those steps you should have not have gotten the auto-import suggestion and no auto-fix bubble. Is this the case for you?

The TS Server crashing is intermittent and harder to replicate.

I'll be sure to use that command when it happens again, as verbose is enabled.

sheetalkamat commented 5 years ago

To replicate, by following those steps you should have not have gotten the auto-import suggestion and no auto-fix bubble. Is this the case for you?

Yes that's exactly what I saw. (Used typescript@next)

nfour commented 5 years ago

@sheetalkamat

Uploaded the logs when I noticed that the TS Server was hanging while trying to initialize (going on 5mins now!). VScode is basically unusable with TS:

Upload successful! Log file ID: 134282124

sheetalkamat commented 5 years ago

@nfour Looking at the log it seems like there are lot of DirectoryWatchers being invoked. Many of them are through failed lookup locations of the sources in project. Is it possible to share the repro project? We can sign nda if needed. (send it to me in email) I would also like to discuss with you about the different directoryWatcher locations that I see and reason about them but I am not sure if your code is private so let me know if we can continue the discussion here on email thread. If email, please contact me at shkamat at microsoft dot com. Thanks.

nfour commented 5 years ago

@sheetalkamat

We're looking into whether we can share the source :).

I can tell you the project structure is pretty much like this (which you could likely discern from the log outputs I uploaded):

  /services/
    /myService/   // (depends on myLib)
  /libraries/
    /myLib/       // (depends on myLib2) 
    /myLib2/ 
  rush.json

As an alternative, do you think the web-build-tools monorepo is capable of reproducing these issues?

sheetalkamat commented 5 years ago

@nfour it would be hard to figure out what might be going wrong just from logs. In past we have used source code and figured out if there is something user can do or something we can do to enhance the experience. But that comes from looking at the source code, what kind of things module resolution is looking at etc. So just source structure is not enough (since from the log it seemed module resolution played role in the directory watchers being set). Please let me know once you are ready with the repro code. Thanks.

nfour commented 5 years ago

@sheetalkamat I think we'll be able to get you access to the source, will email!

nfour commented 5 years ago

@sheetalkamat sent you an email requesting info to provide the NDA.

sheetalkamat commented 5 years ago

@nfour Thanks for email. I am working on getting you the information.

nfour commented 5 years ago

@sheetalkamat we seem to be having issues getting this NDA underway for various reasons.

Ignoring that, has anyone made progress with this issue in other rush repos at Microsoft?

We are considering a workflow which attempts to use rush for its useful tools and to use something else for linking & installing dependencies.

sheetalkamat commented 5 years ago

@nfour No we haven't been able to make any progress on this since we are waiting on repro. Have you tried reducing the repro such that you can remove any NDA code and yet reproduce the issue.

nfour commented 5 years ago

@sheetalkamat working on that now - going to try converting our codebase to use yarn workspaces alongside rush, and to use rush with yarn in another scenario (some node engine incompatibilies when switching over).

That may prove that rush's commons dependency management strategy is where to look.

If you could send the NDA again to my email address that we conversed on I can pass it on to the right people.

nfour commented 5 years ago

I want to give an update:

In addition, yarn, npm or pnpm based rush workspaces has no effect.

I did manage to convert the project to use only yarn (no rush), and indeed VSCode & typescript began to behave like any other project. Of course rush is too useful, so we still use it in spite of the now mild inconvenience.

sheetalkamat commented 5 years ago

Assigning this bug till we have concrete repro steps to be able to look into this.

norman784 commented 5 years ago

I'm having the same issue, you can check my project and check it out, it's under enjin/src/log.ts the chalk dependency is present and the project works when running but still vscode shows as missing module, it was working fine before converting splitting the project into multiple projects with rush.js

sheetalkamat commented 5 years ago

@norman784 The repro you said is your configuration error. With the tsconfig in your project, the module resolution kind is classic and not node (because your target is esnext) Changing the resolution, fixes the errors. You should be able to see details on resolution step with --traceResolution

norman784 commented 5 years ago

thanks! feels a bit confusig all the different configurations about how to load modules.

totomakers commented 5 years ago

Any update ?

Quick update: Webstorm solve correctly import :)

RDeluxe commented 5 years ago

I'm sorry, but we have a concrete repo to replicate the issue with, have we not ?

The issue is reproductible on Microsoft own web tools :

https://github.com/Microsoft/web-build-tools

We are trying to switch to Rush + VsCode (both MS products) and we encountered this issue, which is pretty much a showstopper.

Anyway, here is a really small repo to reproduce the issue : https://github.com/RDeluxe/rush-repro-955

Simply go to libraries/dtos/src/dtos/user.ts

You will have a compiler error. Normally vscode should be able to auto import the missing decorators from class-validator

import { IsEmail, IsString, } from 'class-validator'

Or to autocomplete and autoimport while typing IsE.

RDeluxe commented 5 years ago

Hello, any news ? Could you reproduce on your end ? Thanks !

RDeluxe commented 5 years ago

I'm sorry to bump this again, is there anything I could do ?

I'm not 100% confident jumping in Typescript's codebase, but if somebody could point me in the right direction I may be able to help.

csuich2 commented 4 years ago

Anyone have any workarounds here? Ideally something that doesn't require circumventing the symlinks. I'm still unable to get autocomplete working with a project using Rush.

totomakers commented 4 years ago

Hi @sheetalkamat

Any news about this issue ?

A small repro is here: https://github.com/RDeluxe/rush-repro-955

Any project with rush + ts look like having the issue

sheetalkamat commented 4 years ago

The repro provided has nothing to do with rush.. Your tsconfig.json only includes two files and hence there is not auto import suggestion. Duplicate of #28773 where in completion dont have knowledge of symbols that are not part of program

Info 86   [12:31:0.605] Project 'c:/temp/rush-repro-955/libraries/dtos/tsconfig.json' (Configured) 
Info 87   [12:31:0.605]     Files (40)
    c:/Typescript/built/local/lib.es5.d.ts
    c:/Typescript/built/local/lib.es2015.d.ts
    c:/Typescript/built/local/lib.es2016.d.ts
    c:/Typescript/built/local/lib.es2017.d.ts
    c:/Typescript/built/local/lib.es2018.d.ts
    c:/Typescript/built/local/lib.es2019.d.ts
    c:/Typescript/built/local/lib.es2020.d.ts
    c:/Typescript/built/local/lib.esnext.d.ts
    c:/Typescript/built/local/lib.es2015.core.d.ts
    c:/Typescript/built/local/lib.es2015.collection.d.ts
    c:/Typescript/built/local/lib.es2015.generator.d.ts
    c:/Typescript/built/local/lib.es2015.iterable.d.ts
    c:/Typescript/built/local/lib.es2015.promise.d.ts
    c:/Typescript/built/local/lib.es2015.proxy.d.ts
    c:/Typescript/built/local/lib.es2015.reflect.d.ts
    c:/Typescript/built/local/lib.es2015.symbol.d.ts
    c:/Typescript/built/local/lib.es2015.symbol.wellknown.d.ts
    c:/Typescript/built/local/lib.es2016.array.include.d.ts
    c:/Typescript/built/local/lib.es2017.object.d.ts
    c:/Typescript/built/local/lib.es2017.sharedmemory.d.ts
    c:/Typescript/built/local/lib.es2017.string.d.ts
    c:/Typescript/built/local/lib.es2017.intl.d.ts
    c:/Typescript/built/local/lib.es2017.typedarrays.d.ts
    c:/Typescript/built/local/lib.es2018.asyncgenerator.d.ts
    c:/Typescript/built/local/lib.es2018.asynciterable.d.ts
    c:/Typescript/built/local/lib.es2018.intl.d.ts
    c:/Typescript/built/local/lib.es2018.promise.d.ts
    c:/Typescript/built/local/lib.es2018.regexp.d.ts
    c:/Typescript/built/local/lib.es2019.array.d.ts
    c:/Typescript/built/local/lib.es2019.object.d.ts
    c:/Typescript/built/local/lib.es2019.string.d.ts
    c:/Typescript/built/local/lib.es2019.symbol.d.ts
    c:/Typescript/built/local/lib.es2020.bigint.d.ts
    c:/Typescript/built/local/lib.es2020.promise.d.ts
    c:/Typescript/built/local/lib.es2020.string.d.ts
    c:/Typescript/built/local/lib.es2020.symbol.wellknown.d.ts
    c:/Typescript/built/local/lib.esnext.intl.d.ts
    c:/Typescript/built/local/lib.esnext.string.d.ts
    c:/temp/rush-repro-955/libraries/dtos/src/dtos/user.ts
    c:/temp/rush-repro-955/libraries/dtos/src/index.ts
totomakers commented 4 years ago

Hey ! sorry for bothering you @sheetalkamat :(

I made a better repro here: https://github.com/totomakers/rush-example

Maybe i can give you better information for helping you.

Normally, VScode provide me help for finding import, like the decorator @Controller

 app controller ts - sample-app - Visual Studio Code

But with rush nothing happen, i (hope) is because of the node_modules folder is not the same as a classic node install.

Issue was provide in Rush, VSCode and Typescript

Maybe i miss the point :'( sorry and thanks for help


tsserver.log

RDeluxe commented 4 years ago

Hello @sheetalkamat ! Thanks for your time.

To be thorough I updated my repo https://github.com/RDeluxe/rush-repro-955

The README should explain everything. There are 3 projects there:

sheetalkamat commented 4 years ago

@RDeluxe Thank you for repro. we will investigate this.

octogonz commented 4 years ago

Very excited for this to get some attention @sheetalkamat! This issue has been open for a lonnnng time.

sheetalkamat commented 4 years ago

Good news.. i have fix prototype available.. need to polish it and write some tests.. But i will get PR up soon.

huntye1 commented 3 years ago

still have this problem...

Good news.. i have fix prototype available.. need to polish it and write some tests.. But i will get PR up soon.

leohxj commented 2 years ago

I set public-hoist-pattern for some phantom modules, but vs code not correctly find the modules or its corresponding type declarations.

https://github.com/microsoft/rushstack/issues/3324#issue-1195818643

dermicus-miclip commented 2 years ago

For those still searching, make sure that you have vscode installed with the WSL plugin. You must be sure that the WSL backend is used!