Code Monkey home page Code Monkey logo

asyncsuffix's People

Contributors

0x0309 avatar asizikov avatar drewnoakes avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

asyncsuffix's Issues

Get rid of hardcoded Test method types

Use this snippet instead:

private static bool IsTestMethod(IDeclaredElement declaredElement)
{
var utm = declaredElement.GetSolution().GetComponent();
return (declaredElement is IMethod || declaredElement is IProperty) && utm.IsElementOfKind(declaredElement, UnitTestElementKind.Test);
}

Ignore Test methods

As an option make this feature configurable

[Test]
public async Task FooWhenBoo()
{
   ///
}

some more improvements after review.

  1. returnType.GetTypeElement().IsDescendantOf()
var valueProperty = storage.BindToContextLive(lifetime, ContextRange.ApplicationWide)
.GetValueProperty();
    private static bool IsTestType(IDeclaredElement declaredElement)
    {
      var utm = declaredElement.GetSolution().GetComponent<IUnitTestElementStuff>();
      return declaredElement is ITypeElement && utm.IsElementOfKind(declaredElement, UnitTestElementKind.TestContainer);
    }

    private static bool IsTestMethod(IDeclaredElement declaredElement)
    {
      var utm = declaredElement.GetSolution().GetComponent<IUnitTestElementStuff>();
      return (declaredElement is IMethod || declaredElement is IProperty) && utm.IsElementOfKind(declaredElement, UnitTestElementKind.Test);
    }

Setting to turn off Async suggestion for private methods

For clients of particular type only public method names matters. There is no need to suggest Async suffix for private methods. For example I have public methods which checks for arguments or states and throws exceptions immediately (these methods don't have 'async' keyword for 'fail-fast' reasons). And these methods delegate actual work to some private methods like "DoSomeActionInternal" or something like that. These method are hidden from outer client so it's pretty annoying to have suffix suggestions.
It would be nice to have some settings to turn off these suggestions for private methods.

Remove commas in tags in nuspec

For .nuspec tags space is a valid tag delimiter. However, you arranged commas:

<tags>async method, naming, task</tags>

As result, they are parsed incorrectly:
image

Smart suggestion

For now I just compare the end of the method name with 'Async' string. That method works ok when the suffix is just missing. However in case of typo it will produce ugly method name:

MethodAsyn() -> MethodAsynAsync().

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.