Jorenar / miniSnip

Lightweight snippet plugin for Vim
MIT License
53 stars 8 forks source link

Broken snippet indentation #8

Closed Gavinok closed 4 years ago

Gavinok commented 4 years ago

Hey since commit 2493202 (Simplify code a bit) indentation and commenting in snippets is broken.

/**
 * {{+Class description+}}
 *
 * @version {{+Version Number+}}
 * @author  {{+!g:name+}}
 */
{{+private+}} class {{+@classname+}} {
    // fields
    private {{+type+}} {{+@varname+}};

    // Class Constructors
    public {{+@classname+}}({{++}}) {
        {{+/* Set Args */+}};
    }

    /**
     * @return {{+@varname+}}  
     */
    public {{+@type+}} get{{+@varname+}}() {
        return {{+@varname+}};
    }

    /**
     * @param {{+@varname+}}  
     */
    public void set{{+@varname+}}({{++}}) {
        {{+`'this.'.@varname.' = '.@varname+}};
    }
}

now becomes

/**
 * * {{+Class description+}}
 * *
 * * @version {{+Version Number+}}
 * * @author  {{+!g:name+}}
 * */
{{+private+}} class {{+@classname+}} {
    // fields
    //  private {{+type+}} {{+@varname+}};
    //
    //  // Class Constructors
    //  public {{+@classname+}}({{++}}) {
    //      {{+/* Set Args */+}};
    //  }
    //
    //  /**
    //   * @return {{+@varname+}}  
    //   */
    //  public {{+@type+}} get{{+@varname+}}() {
    //      return {{+@varname+}};
    //  }
    //
    //  /**
    //   * @param {{+@varname+}}  
    //   */
    //  public void set{{+@varname+}}({{++}}) {
    //      {{+`'this.'.@varname.' = '.@varname+}};
    //  }
    //}
Jorenar commented 4 years ago

Looks like formatoptions started to interfere since previous commit. It should be OK now.

PS. Shouldn't {{+'this.'.@varname.' = '.@varname+}}; be this.{{+@varname+}} = {{+@varname+}};?

Gavinok commented 4 years ago

Looks like formatoptions started to interfere since previous commit. It should be OK now.

PS. Shouldn't {{+'this.'.@varname.' = '.@varname+}}; be this.{{+@varname+}} = {{+@varname+}};?

Ya it should be. I still need to finish porting all my snippets to the new format since my old fork used a different implementation.

Gavinok commented 4 years ago

Also thatnks for the quick fix

Jorenar commented 4 years ago

You are welcome