Code Monkey home page Code Monkey logo

resharper-postfix's Introduction

ReSharper Postfix Templates plugin

The basic idea is to prevent caret jumps backwards while typing C# code. Kind of surround templates on steroids baked with code completion.

Demo

Changelog is here

Download

  • Currently supported ReSharper versions are 8.0, 8.1 and 8.2;
  • This plugin is available for download in ReSharper 8 extensions gallery;
  • ReSharper 7.1 is no longer supported, last build is available for download here.

Features

Available templates:

  • .if – checks boolean expression to be true if (expr)
  • .else – checks boolean expression to be false if (!expr)
  • .null – checks nullable expression to be null if (expr == null)
  • .notnull – checks expression to be non-null if (expr != null)
  • .not – negates value of inner boolean expression !expr
  • .foreach – iterates over collection foreach (var x in expr)
  • .for – surrounds with loop for (var i = 0; i < expr.Length; i++)
  • .forr – reverse loop for (var i = expr.Length - 1; i >= 0; i--)
  • .var – initialize new variable with expression var x = expr;
  • .arg – helps surround argument with invocation Method(expr)
  • .to – assigns expression to some variable lvalue = expr;
  • .await – awaits expression with C# await keyword await expr
  • .cast – surrounds expression with cast ((SomeType) expr)
  • .field – intoduces field for expression _field = expr;
  • .prop – introduces property for expression Prop = expr;
  • .new – produces instantiation expression for type new T()
  • .paren – surrounds outer expression with parentheses (expr)
  • .parse – parses string as value of some type int.Parse(expr)
  • .return – returns value from method/property return expr;
  • .typeof – wraps type usage with typeof-expression typeof(TExpr)
  • .switch – produces switch over integral/string type switch (expr)
  • .yield – yields value from iterator method yield return expr;
  • .throw – throws value of Exception type throw expr;
  • .using – surrounds disposable expression using (var x = expr)
  • .while – uses expression as loop condition while (expr)
  • .lock – surrounds expression with statement lock (expr)
  • .sel – selects expression in editor

Also Postfix Templates including two features sharing the same idea:

  • Static members of first argument type capatible available just like instance members: Static members completion
  • Enum members are available over values of enumeration types and produce equality/flag checks: Static members completion

// TODO: .Length <==> .Count feature // TODO: expression chooser

Other notes:

  • By now it supports only C# language (including C# in Razor markup)
  • Templates can be expanded by Tab key just like ReSharper live templates
  • You can use ReSharper 8 double completion feature to list and invoke all the templates are not normally available in current context
  • Options page allows to enable/disable specific templates and control braces insertion: options

Feedback

Feel free to post any issues or feature requests in YouTrack (use "PostfixCompletion" subsystem).

Or contact directly: alexander.shvedov[at]jetbrains.com

resharper-postfix's People

Contributors

citizenmatt avatar controlflow avatar derigel23 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.