Code Monkey home page Code Monkey logo

resharper-postfix's People

Contributors

citizenmatt avatar controlflow avatar derigel23 avatar serjic avatar

Stargazers

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

Watchers

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

resharper-postfix's Issues

.case template

switch (e) {
  SomeEnum.SomeCase.case
}

=>

switch (e) {
  case SomeEnum.SomeCase:
}

Resharper 9.1 support

Thanks for a great extension!

Now when R# 9.1 is out I was hoping for some support for it.

.ifnot template missed

It seems like .ifnot template missed.
It is also absent on the options page.
screen

I'm using VS2013 and Resharper 8.1.

IsNullOrEmpty completion in if generates bad code

I have a variable named exitFileRecord of a POCO type. I write this code:

if (exitFileRecord._agentName.isnullor

I'm prompted with a popup for code completion that properly changes it to:

if (string.IsNullOrEmpty(exitFileRecord._agentName)

But when I continue and add this:

if (string.IsNullOrEmpty(exitFileRecord._agentName) && exitFileRecord._cert.issnullor

when I type that last "r", I have the pop up prompt with the suggested code change (which is correct in the popup), it changes it and ends up with this:

if (string.IsNullOrEmpty(exitFileRecord._agentName) && string.IsNullOrEmpty(String.IsNullOrEmptyd._cert))

That's not my typo on the Emptyd._cert. If leaves out my variable entirely and puts string.IsNullOrEmpty twice like you see here, followed by "d._cert".

Help to use generic parameters in postfix fashion

I don't know how this would work, but I always end up using a generic parameter T without having declared it in the method or class, and resharper's greedy code completion always adds a totally useless class name:

public void Foo(IEnumerable<ThreadStaticAttribute>

Can postfix do something to help? Add a 'create T' item in the code completion for IEnumerable< above? Any better ideas?

Automatic brace completion

Please add automatic braces added to blocks (.using, .if, .null/.notnull, etc), respecting the braces rules.

Abadon 8.x support

  • Time has come. Prepare plugin for bundling into R# source code;
  • Rewrite to new 9.x code completion items infrastructure, introduce completion filter for postfix items;
  • Use accept behavior instead of event hack in static members completion;
  • Tweak presentation of static members code completion;
  • Implement R# 9.x 'Code style' application where appropriate;
  • Once again try making plugin language-agnostic;

.for should not use implicitly typed variables

Currently the plugin always uses var. For example, if I enter 10.for, I get the following:

for (var i = 0; i < 10; i++)

However, ReSharper generates int. Maybe it depends on ReSharper's settings (I've lowered severity of some inspections regarding usage of var), I'm not sure. Either way, I'd prefer explicitly typed variables (or choosing type).

.await could add async modifier to the method

When I have a Task returning method like this:

public Task Foo()
{
    SomethingAsync().await
}

The .await template produces noncompilable code. R# has a 'Make method 'Foo' async' quick fix for that, though.
Is that possible to invoke the quick fix automatically by default or at least have it as an option of choice?

.null template?

Task<string> empty = Task.FromResult(string.null);
// =>
Task<string> empty = Task.FromResult((string) null);

Does not work in ReSharper 8.0.1

Does not work in ReSharper 8.0.1 (EAP 8.0.1000.1886).

I'm getting this (related?):

Object reference not set to an instance of an object.

--- EXCEPTION #1/2 [NullReferenceException]
Message = “Object reference not set to an instance of an object.”
ExceptionPath = Root.InnerException
ClassName = System.NullReferenceException
HResult = COR_E_NULLREFERENCE=E_POINTER=80004003
Source = JetBrains.Platform.ReSharper.DocumentModel
StackTraceString = “
  at JetBrains.DocumentModel.RangeMarkerExtentions.CreateRangeMarkerImpl(DocumentRange documentRange, Boolean mapToDocument)
     at JetBrains.DocumentModel.RangeMarkerExtentions.CreateRangeMarker(DocumentRange documentRange)
     at JetBrains.ReSharper.ControlFlow.PostfixCompletion.LookupItems.PostfixLookupItem..ctor(String shortcut, PrefixExpressionContext context) in c:\BuildAgent\work\220ad833ac0a8d0d\PostfixCompletion\LookupItems\PostfixLookupItem.cs:line 45
     at JetBrains.ReSharper.ControlFlow.PostfixCompletion.LookupItems.StatementPostfixLookupItem`1..ctor(String shortcut, PrefixExpressionContext context) in c:\BuildAgent\work\220ad833ac0a8d0d\PostfixCompletion\LookupItems\StatementPostfixLookupItem.cs:line 23
     at JetBrains.ReSharper.ControlFlow.PostfixCompletion.LookupItems.KeywordStatementPostfixLookupItem`1..ctor(String shortcut, PrefixExpressionContext context) in c:\BuildAgent\work\220ad833ac0a8d0d\PostfixCompletion\LookupItems\KeywordStatementPostfixLookupItem.cs:line 21
     at JetBrains.ReSharper.ControlFlow.PostfixCompletion.TemplateProviders.ForEachLoopTemplateProvider.LookupItem..ctor(PrefixExpressionContext context) in c:\BuildAgent\work\220ad833ac0a8d0d\PostfixCompletion\TemplateProviders\ForEachLoopTemplateProvider.cs:line 62
     at JetBrains.ReSharper.ControlFlow.PostfixCompletion.TemplateProviders.ForEachLoopTemplateProvider.CreateItems(PostfixTemplateAcceptanceContext context, ICollection`1 consumer) in c:\BuildAgent\work\220ad833ac0a8d0d\PostfixCompletion\TemplateProviders\ForEachLoopTemplateProvider.cs:line 56
     at JetBrains.ReSharper.ControlFlow.PostfixCompletion.PostfixTemplatesManager.CollectAvailableTemplates(ITreeNode reference, ICSharpExpression expression, DocumentRange replaceRange, ReparsedCodeCompletionContext context, Boolean forceMode, String templateName) in c:\BuildAgent\work\220ad833ac0a8d0d\PostfixCompletion\PostfixTemplatesManager.cs:line 300
     at JetBrains.ReSharper.ControlFlow.PostfixCompletion.PostfixTemplatesManager.GetAvailableItems(ITreeNode node, Boolean forceMode, ReparsedCodeCompletionContext reparseContext, String templateName) in c:\BuildAgent\work\220ad833ac0a8d0d\PostfixCompletion\PostfixTemplatesManager.cs:line 75
     at JetBrains.ReSharper.ControlFlow.PostfixCompletion.CSharpPostfixItemProvider.AddLookupItems(CSharpCodeCompletionContext context, GroupedItemsCollector collector) in c:\BuildAgent\work\220ad833ac0a8d0d\PostfixCompletion\CSharpPostfixItemProvider.cs:line 59
     at JetBrains.ReSharper.Feature.Services.CodeCompletion.Infrastructure.ItemsProviderOfSpecificContext`1.JetBrains.ReSharper.Feature.Services.CodeCompletion.Infrastructure.ICodeCompletionItemsProvider.AddLookupItems(ISpecificCodeCompletionContext context, GroupedItemsCollector collector, Object data)
     at JetBrains.ReSharper.Feature.Services.CodeCompletion.IntellisenseManager.<>c__DisplayClass4e.<GetCompletionResult>b__33()
     at JetBrains.Util.Logging.Logger.CatchIgnoreExceptions[TValue](Func`1 F, JetHashSet`1 exceptionTypesToIgnore)
”

--- Outer ---

--- EXCEPTION #2/2 [LoggerException]
Message = “Object reference not set to an instance of an object.”
ExceptionPath = Root
ClassName = JetBrains.Util.LoggerException
InnerException = “Exception #1 at Root.InnerException”
HResult = COR_E_APPLICATION=80131600
StackTraceString = “
  at JetBrains.ReSharper.Feature.Services.CodeCompletion.IntellisenseManager.GetCompletionResult(CodeCompletionParameters parameters, ITextControl textControl, List`1 contexts)
     at JetBrains.ReSharper.Feature.Services.CodeCompletion.AutomaticCodeCompletionSession.AsyncCompletionExecutor.Work()
     at JetBrains.Application.InterruptableReadActivity.DoWork()
     at JetBrains.Application.InterruptableReadActivity.WorkerThreadProc(ManualResetEvent nativeManualEvent)
     at JetBrains.Application.InterruptableReadActivity.<>c__DisplayClass7.<DoStart>b__5()
     at JetBrains.Threading.ThreadManager.PooledThread.ThreadProc()
     at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
     at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
     at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
     at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
     at System.Threading.ThreadHelper.ThreadStart()
”

String.Format(...) support

Would be great to have this kind of completion.
I often find myself typing a string (i.e. an error message) and then wanting to add some format arguments to it.

Thanks!

Fix solution leak

ActionHandlers.myBoundActions ->
CompactMap<IActionDefWithId, IBoundAction>.myStorage.Values ->
ChunkList.myChunks ->
IBoundAction[][] at [0] ->
IBoundAction[] at [181] ->
BoundAction.myOtherHandlers ->
List._items ->
IAction[] at [0] ->
PostfixTemplatesTracker+ExpandPostfixTemplateHandler.myItemsOwnerFactory ->
LookupItemsOwnerFactory.Solution ->
SolutionElement

.array template

return x.array

=>

return new[] { x };

Only in double completion, I think.

.return is not always available when needed

var agent = new SimpleDelegateAgent((index, cancellationToken) =>
      {
        if (index == 0) throw new InvalidOperationException("YO");


        Task.FromResult(true).ret
      });

Delegate is of type Func<Task> :\

.arg for a single expression parameter

Suppose I have this assignment:

int myTmp, mySomeNumber;
...
myTmp = mySomeNumber;

I want to do mySomeNumber.arg, and have:

myTmp = Method(mySomeNumber);

Currently, it's putting the entire expression inside: Method(myTmp = mySomeNumber)

(hope that's clear :P)

Not Showing up in R# 9.2

Fresh VS install.

Postfix is not available in the R# Extension Manager.

I'm unable to install my favorite extension. :(

.forr

Enable only on simple int expressions - for example, only allow reference access chains without invocations.

Lambda expression completion - it.

persons.Select(it.__)

Should populate list of Person members and produce lambda expression when completed:

persons.Select(p => p.Name)

Merge all possible qualifier types when outer overload is not bound yet.

Pull hidden R# 9.0 "push/pull expression" context actions into postfix templates

Should behave like introduce variable suggestion, when some variable used multiple times in the same way:

var reference = expression.Reference;
DoSomething(reference.GetPsiModule());
if (reference.GetPsiModule()/*.push*/.IsValid) {
   // ...
}

Should produce:

var psiModule = expression.Reference.GetPsiModule();
DoSomething(psiModule);
if (psiModule.IsValid) {
   // ...
}

Caret placement after .arg

mail quote:

I wanted to ask you about a liiitle tweak though: could you please fix the “.arg” template
so when it gets unrolled the cursor is placed behind the right parenthesis, and not before. That way we don’t need to use -> key to continue writing the code.

Thanks!

Special suffixes support: 'xs.foreach.M()' idiom

When .foreach template is completed with . suffix, do not populate foreach statement iteration variable name hotspot, but produce it's usage inside foreach body and populate next code completion:

items.foreach.M();

=>

foreach (var item in items) {
  item.M();
}

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.