-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Open
Labels
BugA bug in TypeScriptA bug in TypeScriptCrashFor flagging bugs which are compiler or service crashes or unclean exits, rather than bad outputFor flagging bugs which are compiler or service crashes or unclean exits, rather than bad outputDomain: LS: Auto-importFix AvailableA PR has been opened for this issueA PR has been opened for this issue
Milestone
Description
found while working on #59582.
search terms: autoimports, module augmentation, alias, export list, mergeSymbol
💻 Code
fourslash test:
/// <reference path="fourslash.ts" />
// @module: nodenext
// @Filename: /node_modules/@sapphire/pieces/index.d.ts
//// interface Container {
//// stores: unknown;
//// }
////
//// declare class Piece {
//// container: Container;
//// }
////
//// export { Piece, type Container as Alias };
// @FileName: /augmentation.ts
//// declare module "@sapphire/pieces" {
//// interface Alias {
//// client: unknown;
//// }
//// }
// @Filename: /index.ts
//// import { Piece } from "@sapphire/pieces";
//// class FullPiece extends Piece {
//// /*1*/
//// }
const preferences = {
includeCompletionsWithClassMemberSnippets: true,
includeCompletionsWithInsertText: true,
};
verify.completions({
marker: "1",
includes: [
{
name: "container",
insertText: "container: Alias;",
filterText: "container",
hasAction: true,
source: "ClassMemberSnippet/",
},
],
preferences,
isNewIdentifierLocation: true,
});
verify.applyCodeActionFromCompletion("1", {
name: "container",
source: "ClassMemberSnippet/",
description: `Includes imports of types referenced by 'container'`,
newFileContent: `import { Alias, Piece } from "@sapphire/pieces";
class FullPiece extends Piece {
}`,
preferences,
});🙁 Actual behavior
tests/cases/fourslash/autoImportCompletionExportListAugmentation5.ts
fourslash test autoImportCompletionExportListAugmentation5.ts runs correctly:
Error: Debug Failure. False expression.
at Object.addImportFromExportedSymbol (src\services\codefixes\importFixes.ts:300:19)
at C:\TypeScript\src\services\codefixes\helpers.ts:947:38
at Array.forEach (<anonymous>)
at importSymbols (src\services\codefixes\helpers.ts:947:13)
at Object.addNewNodeForMemberSymbol (src\services\codefixes\helpers.ts:231:21)
at getEntryForMemberCompletion (src\services\completions.ts:2055:13)
at createCompletionEntry (src\services\completions.ts:1807:39)
at getCompletionEntriesFromSymbols (src\services\completions.ts:2678:23)
at completionInfoFromData (src\services\completions.ts:1334:25)
at Object.getCompletionsAtPosition (src\services\completions.ts:764:30)
at Object.getCompletionsAtPosition2 [as getCompletionsAtPosition] (src\services\services.ts:2231:28)
at Function.proxy.<computed> [as getCompletionsAtPosition] (src\harness\fourslashImpl.ts:480:61)
at _TestState.getCompletionListAtCaret (src\harness\fourslashImpl.ts:1794:37)
at _TestState.verifyCompletionsWorker (src\harness\fourslashImpl.ts:1014:40)
at _TestState.verifyCompletions (src\harness\fourslashImpl.ts:1008:25)
at Verify.completions (src\harness\fourslashInterfaceImpl.ts:269:31)
at eval (autoImportCompletionExportListAugmentation5.js:28:8)
at runCode (src\harness\fourslashImpl.ts:4698:9)
at runFourSlashTestContent (src\harness\fourslashImpl.ts:4669:5)
at runFourSlashTest (src\harness\fourslashImpl.ts:4652:5)
at Context.<anonymous> (src\testRunner\fourslashRunner.ts:59:39)
at processImmediate (node:internal/timers:478:21)
🙂 Expected behavior
no crash! :D
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptCrashFor flagging bugs which are compiler or service crashes or unclean exits, rather than bad outputFor flagging bugs which are compiler or service crashes or unclean exits, rather than bad outputDomain: LS: Auto-importFix AvailableA PR has been opened for this issueA PR has been opened for this issue