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

Completion entry details on re-export in fs-extra causes assertion failure ("some exportInfo should match...") #52661

Closed
DanielRosenwasser opened this issue Feb 7, 2023 · 1 comment · Fixed by #52686
Assignees
Labels
Bug A bug in TypeScript Crawler-Detected Detected by a crawler running random TSServer operations on public code. Domain: Auto-import Domain: Completion Lists The issue relates to showing completion lists in an editor Fix Available A PR has been opened for this issue

Comments

@DanielRosenwasser
Copy link
Member

DanielRosenwasser commented Feb 7, 2023

Repro is pretty consistent. Clone Adonis and request completions in a file with the words access. Navigate the completion list to request completion entry details on access or accessSync from fs-extra rather than fs or fs/promises.

Here's what you should get

Debug Failure. False expression: Some exportInfo should match the specified moduleSymbol
Error: Debug Failure. False expression: Some exportInfo should match the specified moduleSymbol
    at getImportFixForSymbol (USER_DIR/.vscode-insiders/extensions/ms-vscode.vscode-typescript-next-5.0.202302060/node_modules/typescript/lib/tsserver.js:140921:9)
    at Object.getImportCompletionAction (USER_DIR/.vscode-insiders/extensions/ms-vscode.vscode-typescript-next-5.0.202302060/node_modules/typescript/lib/tsserver.js:140898:34)
    at getCompletionEntryCodeActionsAndSourceDisplay (USER_DIR/.vscode-insiders/extensions/ms-vscode.vscode-typescript-next-5.0.202302060/node_modules/typescript/lib/tsserver.js:149073:62)
    at Object.getCompletionEntryDetails (USER_DIR/.vscode-insiders/extensions/ms-vscode.vscode-typescript-next-5.0.202302060/node_modules/typescript/lib/tsserver.js:148959:46)
    at Object.getCompletionEntryDetails2 [as getCompletionEntryDetails] (USER_DIR/.vscode-insiders/extensions/ms-vscode.vscode-typescript-next-5.0.202302060/node_modules/typescript/lib/tsserver.js:134801:35)
    at USER_DIR/.vscode-insiders/extensions/ms-vscode.vscode-typescript-next-5.0.202302060/node_modules/typescript/lib/tsserver.js:178463:43
    at mapDefined (USER_DIR/.vscode-insiders/extensions/ms-vscode.vscode-typescript-next-5.0.202302060/node_modules/typescript/lib/tsserver.js:2626:22)
    at IpcIOSession.getCompletionEntryDetails (USER_DIR/.vscode-insiders/extensions/ms-vscode.vscode-typescript-next-5.0.202302060/node_modules/typescript/lib/tsserver.js:178461:20)
    at completionEntryDetails (USER_DIR/.vscode-insiders/extensions/ms-vscode.vscode-typescript-next-5.0.202302060/node_modules/typescript/lib/tsserver.js:176807:43)
    at USER_DIR/.vscode-insiders/extensions/ms-vscode.vscode-typescript-next-5.0.202302060/node_modules/typescript/lib/tsserver.js:179151:69
    at IpcIOSession.executeWithRequestId (USER_DIR/.vscode-insiders/extensions/ms-vscode.vscode-typescript-next-5.0.202302060/node_modules/typescript/lib/tsserver.js:179143:14)
    at IpcIOSession.executeCommand (USER_DIR/.vscode-insiders/extensions/ms-vscode.vscode-typescript-next-5.0.202302060/node_modules/typescript/lib/tsserver.js:179151:29)
    at IpcIOSession.onMessage (USER_DIR/.vscode-insiders/extensions/ms-vscode.vscode-typescript-next-5.0.202302060/node_modules/typescript/lib/tsserver.js:179193:51)
    at process.<anonymous> (USER_DIR/.vscode-insiders/extensions/ms-vscode.vscode-typescript-next-5.0.202302060/node_modules/typescript/lib/tsserver.js:180761:14)
    at process.emit (node:events:526:28)
    at emit (node:internal/child_process:938:14)
    at process.processTicksAndRejections (node:internal/process/task_queues:84:21)

Error in adonisjs/core

⚠️ Note that typescript-4.9.5 also had errors ⚠️
Req #297 - completionEntryDetails
    at getImportFixForSymbol (/typescript-4.9.5/lib/tsserver.js:156523:22)
    at Object.getImportCompletionAction (/typescript-4.9.5/lib/tsserver.js:156506:45)
    at getCompletionEntryCodeActionsAndSourceDisplay (/typescript-4.9.5/lib/tsserver.js:136327:33)
    at Object.getCompletionEntryDetails (/typescript-4.9.5/lib/tsserver.js:136266:30)
    at Object.getCompletionEntryDetails (/typescript-4.9.5/lib/tsserver.js:169156:35)
    at /typescript-4.9.5/lib/tsserver.js:181347:57
    at Object.mapDefined (/typescript-4.9.5/lib/tsserver.js:621:30)
    at IOSession.Session.getCompletionEntryDetails (/typescript-4.9.5/lib/tsserver.js:181345:33)
    at Session.handlers.ts.Map.ts.getEntries._a.<computed> (/typescript-4.9.5/lib/tsserver.js:179982:61)
    at /typescript-4.9.5/lib/tsserver.js:182034:96
    at IOSession.Session.executeWithRequestId (/typescript-4.9.5/lib/tsserver.js:182025:28)
    at IOSession.Session.executeCommand (/typescript-4.9.5/lib/tsserver.js:182034:41)
    at IOSession.Session.onMessage (/typescript-4.9.5/lib/tsserver.js:182062:35)
    at Interface.<anonymous> (/typescript-4.9.5/lib/tsserver.js:186188:31)
Req #297 - completionEntryDetails
    at getImportFixForSymbol (/typescript-5.0.0-dev.20230207/lib/tsserver.js:141001:9)
    at Object.getImportCompletionAction (/typescript-5.0.0-dev.20230207/lib/tsserver.js:140978:34)
    at getCompletionEntryCodeActionsAndSourceDisplay (/typescript-5.0.0-dev.20230207/lib/tsserver.js:149095:62)
    at Object.getCompletionEntryDetails (/typescript-5.0.0-dev.20230207/lib/tsserver.js:148981:46)
    at Object.getCompletionEntryDetails2 [as getCompletionEntryDetails] (/typescript-5.0.0-dev.20230207/lib/tsserver.js:134895:35)
    at /typescript-5.0.0-dev.20230207/lib/tsserver.js:178454:43
    at mapDefined (/typescript-5.0.0-dev.20230207/lib/tsserver.js:2627:22)
    at IOSession.getCompletionEntryDetails (/typescript-5.0.0-dev.20230207/lib/tsserver.js:178452:20)
    at completionEntryDetails (/typescript-5.0.0-dev.20230207/lib/tsserver.js:176798:43)
    at /typescript-5.0.0-dev.20230207/lib/tsserver.js:179142:69
    at IOSession.executeWithRequestId (/typescript-5.0.0-dev.20230207/lib/tsserver.js:179134:14)
    at IOSession.executeCommand (/typescript-5.0.0-dev.20230207/lib/tsserver.js:179142:29)
    at IOSession.onMessage (/typescript-5.0.0-dev.20230207/lib/tsserver.js:179184:51)
    at Interface.<anonymous> (/typescript-5.0.0-dev.20230207/lib/tsserver.js:180728:14)

That is a filtered view of the text. To see the raw error text, go to RepoResults4/adonisjs.core.rawError.txt in the artifact folder

Last few requests

{"seq":294,"type":"request","command":"completionEntryDetails","arguments":{"file":"@PROJECT_ROOT@/providers/AppProvider.ts","line":87,"offset":24,"entryNames":[{"name":"access","source":"fs-extra","data":{"exportName":"access","moduleSpecifier":"fs-extra","fileName":"/mnt/ts_downloads/core/node_modules/@types/fs-extra/index.d.ts"}}]}}
{"seq":295,"type":"request","command":"completionEntryDetails","arguments":{"file":"@PROJECT_ROOT@/providers/AppProvider.ts","line":87,"offset":24,"entryNames":[{"name":"access","source":"fs/promises","data":{"exportName":"access","moduleSpecifier":"fs/promises","ambientModuleName":"fs/promises"}}]}}
{"seq":296,"type":"request","command":"completionEntryDetails","arguments":{"file":"@PROJECT_ROOT@/providers/AppProvider.ts","line":87,"offset":24,"entryNames":[{"name":"accessSync","source":"fs","data":{"exportName":"accessSync","moduleSpecifier":"fs","ambientModuleName":"fs"}}]}}
{"seq":297,"type":"request","command":"completionEntryDetails","arguments":{"file":"@PROJECT_ROOT@/providers/AppProvider.ts","line":87,"offset":24,"entryNames":[{"name":"accessSync","source":"fs-extra","data":{"exportName":"accessSync","moduleSpecifier":"fs-extra","fileName":"/mnt/ts_downloads/core/node_modules/@types/fs-extra/index.d.ts"}}]}}

Repro Steps

  1. git clone https://github.com/adonisjs/core --recurse-submodules
  2. In dir core, run git reset --hard 70a661296d5b85a526a7abb2d22b678265574d61
  3. In dir core, run npm install --prefer-offline --no-audit --no-progress --legacy-peer-deps --ignore-scripts -q
  4. Back in the initial folder, download RepoResults4/adonisjs.core.replay.txt from the artifact folder
  5. npm install --no-save @typescript/server-replay
  6. npx tsreplay ./core ./adonisjs.core.replay.txt path/to/tsserver.js
  7. npx tsreplay --help to learn about helpful switches for debugging, logging, etc

Originally posted by @typescript-bot in #52660 (comment)

@DanielRosenwasser DanielRosenwasser added Bug A bug in TypeScript Domain: Completion Lists The issue relates to showing completion lists in an editor Domain: Auto-import labels Feb 7, 2023
@DanielRosenwasser DanielRosenwasser added this to the TypeScript 5.0.1 milestone Feb 7, 2023
@DanielRosenwasser DanielRosenwasser added the Crawler-Detected Detected by a crawler running random TSServer operations on public code. label Feb 7, 2023
@andrewbranch
Copy link
Member

I have a fix for this, just need to boil it down into a test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Crawler-Detected Detected by a crawler running random TSServer operations on public code. Domain: Auto-import Domain: Completion Lists The issue relates to showing completion lists in an editor Fix Available A PR has been opened for this issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants