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

Getter Setter Ultimate

Marc Flausino

codigo.best
|
4,156 installs
| (1) | 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

This is only available for these language files :

  • typescript
    • Note that since v4.9, typescript supports auto-accessors, @see documentation
  • php
  • java
  • kotlin
  • python
  • swift
  • c#
  • c++

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 in some languages (typescript, swift, etc.).

    private _name: string;

It will produce, for example, with a typescript file :

  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, for example, with a typescript file :

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

Author

Marc Flausino

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft