无法在WebStorm中重命名(重构)名称

时间:2018-08-07 17:16:44

标签: webstorm

无法将变量从_someName重构到someName(删除_)。 即使我将所有变量从_someName重命名为anotherName,它也会像_anotherName一样出现。无法摆脱"_"。是否需要一些设置? 我使用TypeScript语言,WebStorm的最新版本,MacOSX。使用没有_的变量,一切都很好。

export class Vector2 {
    protected _top: number;
    protected _left: number;

    public constructor(top: number, left: number) {
        this._top = top;
        this._left = left;
    }

    public equals(otherVector: Vector2): boolean {
        if (this.getTop() === otherVector.getTop() && this.getLeft() === otherVector.getLeft())
            return true;
        else
            return false;
    }

    public getTop(): number {
        return this._top;
    }

    public setTop(value: number) {
        this._top = value;
    }

    public getLeft(): number {
        return this._left;
    }

    public setLeft(value: number) {
        this._left = value;
    }
}

1 个答案:

答案 0 :(得分:2)

请尝试从设置|的字段前缀中删除_。编辑器代码样式|打字稿|代码生成-这应该有所帮助

相关问题