Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ulex/zensharp
ZenSharp for ReSharper is mnemonics on steroids!
https://github.com/ulex/zensharp
c-sharp nemerle resharper resharper-plugin
Last synced: 1 day ago
JSON representation
ZenSharp for ReSharper is mnemonics on steroids!
- Host: GitHub
- URL: https://github.com/ulex/zensharp
- Owner: ulex
- License: mit
- Created: 2014-03-26T20:48:14.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2024-09-23T15:16:41.000Z (3 months ago)
- Last Synced: 2024-12-13T18:08:29.983Z (9 days ago)
- Topics: c-sharp, nemerle, resharper, resharper-plugin
- Language: C#
- Homepage:
- Size: 454 KB
- Stars: 182
- Watchers: 18
- Forks: 18
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
ReSharper ZenSharp plugin
==============A shortcuts language for defining [ReSharper](https://www.jetbrains.com/resharper/) live template items. You can
specify your own live template scheme using flexible language.![example1](https://raw.githubusercontent.com/ulex/ZenSharp/master/doc/screen1.gif)
![example2](https://raw.githubusercontent.com/ulex/ZenSharp/master/doc/screen2.gif)
How do I get it?
---
You can install directly into ReSharper via the Extension Manager in the
ReSharper menu.Predefined templates
---
ZenSharp shipped with a lot of standard templates.`$END$` means cursor position after expand template by pressing Tab.
**Examples** in scope, where method definition is allowed:
| shortcut | expand to | how to memo |
|----------|--------------------------------------------------------|-----------------------------------------------------------------------------|
| pps | `public string $name$ { get; private set; } $END$` | **p**ublic **p**roperty **s**tring |
| ppsAge | `public string Age {get; private set;} $END$` | **p**ublic **p**roperty **s**tring Name |
| pps+ | `public string $name$ { get; set; } $END$` | **p**ublic **p**roperty **s**tring more access! |
| ppsA+p | `public string A {get; protected set;} $END$` | **p**ublic **p**roperty **s**tring more access!**p**rotected |
| \_rs | `private readonly string $name$; $END$ ` | [**_** is private] **r**eadonly **s**tring |
| pvm | `public virtual void $name$($END$) { } ` | **p**ublic **v**irtual **m**ethod |
| pM\~s | `public static IEnumerable $name$($END$) { } ` | public [static **M**ethod] _returning_ [**\~** is IEnumerable] of **s**tring |
| pamb | `public abstract bool $name$($END$) { } ` | **p**ublic **a**bstract **m**ethod **b**ool |
| pmiaTest | `public int[] Test() { $END$ }` | **p**ublic **m**ethod _returning_ **i**nt **a**rray Name |**Examples** where type declaration is allowed:
| shortcut | expand to | how to memo |
|----------|------------------------------------------|---------------------------------|
| pi | `public interface $name$ { $END$ }` | **p**ublic **i**nterface |
| psc | `public sealed class $name$ { $END$ }` | **p**ublic **s**ealed **c**lass |
| pc:t | `public class $name$ : $type$ { $END$ }` | **p**ublic **c**lass **:t**ype |
| ie | `internal enum $name$ { $END$ }` | **i**nternal **e**num |**Hint**: you can always write variable name after shortcut. For example, you can type `ppsPropertyName` and
by pressing tab it magically expand to `public string PropertyName {get; set; }`.#### Access
| shortcut | expand to |
|----------|-----------|
| p | public |
| _ | private |
| i | internal |
| P | protected |#### Types
| shortcut | expand to | note |
|----------|-----------|-------------------------------------------------|
| t | $type$ | ask user for custom type after expand |
| sa | string[] | any prim type end with `a` — array of this type |
| b? | bool? | any prim type end with `?` — Nullable type |##### Primitive types
| shortcut | expand to |
|----------|-----------|
| s | string |
| by | byte |
| b | bool |
| dt | DateTime |
| d | double |
| i | int |
| ui | uint |
| g | Guid |
| dc | decimal |
| b? | bool? |##### Generic types
| shortcut | expand to |
|----------|-----------------|
| l | IList |
| ~ | IEnumerable |
| sl | SortedList |
| di | Dictionary |##### NUnit attributes #####
Some useful examples to help wring NUnit tests:
[repo](https://github.com/ulex/ZenSharp/blob/master/ZenSharp.Integration/Templates.ltg) today)| shortcut | expand to |
|------------------------|-------------------------------------------------------------|
| **su**pmSetup | `[SetUp] public void Setup() { $END$ }` |
| **tfsu**pmFixtureSetup | `[TestFixtureSetUp] public void FixtureSetup() { $END$ }` |
| **tftd**FixtureDown | `[TestFixtureTearDown] public void FixtureDown() { $END$ }` |
| **td**pmTearDown | `[TearDown] public void Test() { $END$ }` |
| **tc**pmTest | `[TestCase] public void Test() { $END$ }` |
| **t**pmTest | `[Test] public void Test() { $END$ }` |Rules
---
Simplest rule for expand text `cw` into `System.Console.WriteLine($END$)`(this
rule is ordinary ReSharper live template) will looks like `start ::=
"cw"="System.Console.WriteLine($END$)"`More complex rule, a sort of predefined live template for define class in scope,
where class declaration is allowed. In ordinary live templates, if you want to
specify class access before executing live template, you must define
independent live templates one for `"public class"`=`pc`, another for `"internal class"=ic`
But class can be also be sealed. Or static. And same access modifier can be
applied to interface and enum.In ZenSharp config you can simple define rules like formal grammar.
For class declaration this definition will looks like:space ::= " "
cursor ::= "$END$"
identifier ::=access ::= (internal=i | public=p | private=_ | protected=P) space
class ::= access ["sealed "=s] ("class"=c | "static class"=C) space body
body ::= identifier "{" cursor "}"scope "InCSharpTypeAndNamespace"
{
start = class | interface
}More complex example available in predefined templates file.
How to compile
---
ZenSharp written in C# and Nemerle programming language. You can install it from Nemerle website http://nemerle.org/Downloads .
ZenSharp depend on nuget packages ReSharper.SDK and nunit.framwork. Use nuget package restore for them.After this, ZenSharp can be built either msbuild or Visual Studio.
External links
---
https://blog.jetbrains.com/dotnet/2015/12/22/end-of-year-round-up-of-resharper-10-extensions/
https://garyng.github.io/gtil-gitbook/ReSharper/resharper-plugin-zensharp.html