Skip to content

Auto-imports for JSX tag trigger assertion violation when React is type-imported. #3645

@DanielRosenwasser

Description

@DanielRosenwasser
// @module: preserve
// @verbatimModuleSyntax: true
// @jsx: react

// @Filename: ./react.ts
const React: any = {};
export default React;

// @Filename: ./bar.tsx
import type React from "./react";

<Foo/**/ />;

Verify import fixes at that position.

[error] panic handling request textDocument/codeAction: Expected exactly one symbol name for type-only import promotion
goroutine 1648 [running]:
runtime/debug.Stack()
	runtime/debug/stack.go:26
github.com/microsoft/typescript-go/internal/lsp.(*Server).recover()
	github.com/microsoft/typescript-go/internal/lsp/server.go:940
panic()
	runtime/panic.go:860
github.com/microsoft/typescript-go/internal/ls.getFixInfos()
	github.com/microsoft/typescript-go/internal/ls/codeactions_importfixes.go:192
github.com/microsoft/typescript-go/internal/ls.getImportCodeActions()
	github.com/microsoft/typescript-go/internal/ls/codeactions_importfixes.go:64
github.com/microsoft/typescript-go/internal/ls.(*LanguageService).ProvideCodeActions()
	github.com/microsoft/typescript-go/internal/ls/codeactions.go:129
github.com/microsoft/typescript-go/internal/lsp.(*Server).handleCodeAction()
	github.com/microsoft/typescript-go/internal/lsp/server.go:1559
github.com/microsoft/typescript-go/internal/lsp.init.func1.registerLanguageServiceWithAutoImportsRequestHandler[...].34.1.1()
	github.com/microsoft/typescript-go/internal/lsp/server.go:836
github.com/microsoft/typescript-go/internal/project.(*Session).WithLanguageServiceAndSnapshot.func1()
	github.com/microsoft/typescript-go/internal/project/session.go:1014
github.com/microsoft/typescript-go/internal/lsp.(*Server).handleRequestOrNotification.func1()
	github.com/microsoft/typescript-go/internal/lsp/server.go:664
github.com/microsoft/typescript-go/internal/lsp.(*Server).dispatchLoop.func3()
	github.com/microsoft/typescript-go/internal/lsp/server.go:532
created by github.com/microsoft/typescript-go/internal/lsp.(*Server).dispatchLoop in goroutine 34
	github.com/microsoft/typescript-go/internal/lsp/server.go:531

Metadata

Metadata

Labels

CrashDomain: EditorRelated to the LSP server, editor experience

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions