Thanks to visit codestin.com
Credit goes to github.com

Skip to content

How can I force curly braces for typescript enums in props autocompletion? #938

Open
@aomini

Description

@aomini

I know this is a weird question but I've an element component which I use a lot for my UI. And every time I accept autocomplete suggestion, it gives me =''. Example

enum Fonts{
  Regular: 'Okra-regular',
  Medium: 'Okra-Medium'
}

type Props = {
  size: number;
  fontFamily: Fonts // enum type
}         

export const Typography = ({size, fontFamily}: Props) => {...}

When I import the Typography component and autocomplete it's props, the editor auto resolves size={} // since it's a number but fontFamily resolves to fontFamily=''. So, I have to hit extra keystrokes to make it to fontFamily={}.

Therefore, is there any way that I can make the language server understand that I want to dynamically resolve fontFamily value and need a {} instead of a string completion.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions