Simply click on the Light Bulb to add the missing import line
Optimize all your import lines: add missing imports and remove unused
Easily create a contructor based on privates.
Quickly generate getters and setters for your class.
Keep an eye on the eye-icon for quick info about the exports found.
ignoredImportList
, ignoredDictionaryList
, ignoredLibraryPaths
and ignoredNodeLibraries
to the settings to customizescanOnSave
)spacedImportLine
@angular
related import optimizationsAdd Import
/
are now completely OS independentGet VSCode and grab the extension from the VSCode Extension Market
genGetSet.scoped
(default: enabled) Only show private variables from current class based on cursor position.genGetSet.filter
(default: enabled) Only show private variables which do not have a getter/setter method.genGetSet.importTypings
(default: enabled) Create import lines based on definition files from /typings/.genGetSet.importNode
(default: enabled) Create import lines based on definition files from /node_modules/.genGetSet.classic
(default: disabled) use 'getValue' and 'setValue' instead of 'get value' and 'set value'.genGetSet.pathStringDelimiter
(default: ') sets which quote use to generate import path.genGetSet.spacedImportLine
(default: false) Adds spaces between the beginning and ending of the brackets in an import line.genGetSet.scanOnSave
(default: false) Scan the workspace for imports when a document is saved.genGetSet.ignoredImportList
(check settings) Imports like 'Promise' have many libraries but seldom need an import line.genGetSet.ignoredDictionaryList
(check settings) Dictionaries like 'vscode' and 'tsconfig' which do not need an import line.genGetSet.ignoredLibraryPaths
(check settings) Paths like 'dist' and 'src' which can be omitted in the import line.genGetSet.ignoredNodeLibraries
(check settings) A list of node module libraries like 'chrome' and 'node' which can be ignored as an import line.ctrl+shift+P
/ cmd+shift+P
.or
alt+shift+G
for a quick selection pop-upor
The generated method will be placed at the cursors position.
Best practice is naming your variables with a _
for private use.
The extension will remove the _
when generating the methods.
This: private _name: string;
Will render in:
public get name(): string {
return this._name;
}
public set name(value: string) {
this._name = value;
}
If there is no _
the method will start with a $
.
This: private name: string;
Will render in:
public get $name(): string {
return this.name;
}
public set $name(value: string) {
this.name = value;
}
Always type
your variables. Even when your variable is being initialized, else the extension cannot read the typing.
Always do this: private _name: boolean = false;
This is a TypeScript only extension.
Special thanks to the github users: AngelMunoz, edotassi, Aranir, buehler, EduwHS, Anexon, Tchoupinax, dball-adashi
Enjoy!