Skip to content

In tsx/jsx, some local define 'Component' are not in the completion listΒ #43496

@heroboy

Description

@heroboy

Bug Report

πŸ”Ž Search Terms

react, intellisense

πŸ•— Version & Regression Information

version: 4.2.3

I just test in recent vscode and the playground link.

⏯ Playground Link

Playground link with relevant code

πŸ’» Code

import React, { ReactElement } from 'react';
import {InputNumber as RawInputNumber} from 'antd';

function Test2()
{
    var a = [/*a*/];
    var b = <div>
        /*b*/
    </div>;
    var c = <>
        /*c*/
    </>
}

function InputNumber():ReactElement<any,any>|null
{
    return null;
}

class ClassComponent extends React.Component
{
    render()
    {
        return null;
    }
}

function FunctionComponent(props: any): ReactElement<any, any> | null
{
	return null;
};

Please try to input the <InputNumber/>, <ClassComponent/> and <FunctionComponent/> at comment a,b and c.

πŸ™ Actual behavior

In the comment a: all things are correct.

In the comment b and c:
When you start to input <, the completion list doesn't contains InputNumber, ClassComponent and FunctionComponent. But RawInputNumber(the import one) is in the list.

And in vscode, it will be worse: it tries to import {InputNumber} from 'antd', and make the local defined InputNumber conflit.

πŸ™‚ Expected behavior

Make the local define component in the completion when input <

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptDomain: LS: Completion ListsThe issue relates to showing completion lists in an editorFix AvailableA PR has been opened for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions