Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>Getter Setter UltimateNew to Visual Studio Code? Get it now.

Getter Setter Ultimate

Marc Flausino

|
145 installs
| (0) | Free
Extension to generate getters/setters (typescript, java, php, ...)
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Create Getters/Setters for Typescript class

This is only available for these language files :

  • typescript
  • php
  • java
  • python

How it works ?

Open class file with class members, then select member lines to process them or put the cursor on a single member line to only do this one. Then, you can hit F1 and start to type getter/setter, you will then be able to choose between :

  • Generate getter/setter
  • Generate getter/setter in java way

The code generated will go to the end of file.

Usage

Multi-line selection

how to use

Single line

single line

Generate getter/setter

With this choice, you can create getter/setter. Juste ensure your members are prefixed with "_" otherwise they will be a name conflict.

    private _name: string;

It will produce :

  public get name(): string {
    return this._name;
  }
  public set name(value: string) {
    this._name = value;
  }

Generate getter/setter in java way

With this choice, you can create getter/setter in the java way. No need to prefix with "_".

    private name: string;

It will produce :

    public getName(): string {
      return this.name;
    }
    public setName(value: string) {
      this.name = value;
    }

Author

Marc Flausino

  • Contact us
  • Jobs
  • Privacy
  • Terms of use
  • Trademarks
© 2023 Microsoft