Skip to content

heroboy/generate-switch-case-for-enum-type-extension

Repository files navigation

README

A vscode extension to generate switch case for enum type.

https://marketplace.visualstudio.com/items?itemName=heroboy.generate-switch-case-for-enum-type

screenshot

How to use

Ensure the case block of switch statement is empty. Place the cursor on switch then the 'Show fix' icon will display.

Supported types

class A{}
class B{}

enum EnumType1
{
	A=123,B,C
}

const enum EnumType2
{
	A=1,B="",C=false
}

type Union1 = 1|2|true|"abc";
type Union2 = 1|2|EnumType1|boolean;
type Union3 = A|B;

Todo

  • Support more situation that can generate the case clauses.
  • Generate correct result for js files.

Some learning resources for writing typescript language service plugin

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published