Git Product home page Git Product logo

vukomanovic.resharper's Introduction

Vukomanovic.Resharper.Macros

I wanted to make templates with private variable a bit easier to make so included a macro to do that, then made two extra ones for other common stuff that I need.

ReSharper Gallery Link: https://resharper-plugins.jetbrains.com/packages/Vukomanovic.Resharper.Macros

Macros

  • Value of another variable with prefix _ added and first character made lower case;
  • Value of another variable transformed with a prefix added a suffix added; and
  • Value of another variable with a prefix removed a suffix removed and remaining text transformed.
  • Value of another variable with multiple functions applied.

All the transforms are defined as:

  • l for the first character being made lowercase;
  • u for the first character being made uppercase;
  • L for all the characters being made lowercase (in the original variable, not the prefix or suffix);
  • U for all the characters being made uppercase (in the original variable, not the prefix or suffix); and
  • Anything else for no transform.

Value of another variable with multiple functions applied

This macro allows chaining different functions together for more flexibilty

The second parameter needs to be separated by ;'s and the functions should be followed by :'s

The functions are:

  • ap - Add prefix
  • as - Add suffix
  • rp - Remove prefix
  • rs - Remove suffix
  • t - Perform case transform (see above for transforms)
  • d - Replace an empty string with the defined default
  • tx or x where x is any of the transforms by themselves with or without a :

Example: if you had _lockSuf as your variable input you could run with the function parameter as rp:_;rs:Suf;u;d:Lock;ap:got;as:YAY which would give you the output gotLockYAY

Note that any function which you define which wouldn't do anything is skipped so that it is quicker. Example: if you again had _lockSuf as your variable input and had ap:;as:;rp;rs:;t;d: as the function parameter. Then the macro compiles this down to just returning the original value.

Example of usage

I have include a file instanceExample.DotSettings which creates a thread safe Instance property in a class and also a Lock object for that Instance. The good thing about having the entire variable encapsulated in the resharper variable is that if you change it, it can have a nice flow on effect through the rest of the tempalte as well.

vukomanovic.resharper's People

Contributors

matthewvukomanovic avatar

Watchers

 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.