├── .gitignore ├── Content ├── Changelog.md ├── Todo.txt ├── icon.png ├── options.png ├── postfix.gif ├── postfix2.gif ├── postfix_enums.gif ├── postfix_generics.gif ├── postfix_lengthcount.gif └── postfix_static_methods.gif ├── LICENSE ├── PostfixTemplates.nuspec ├── PostfixTemplates.sln ├── PostfixTemplates.sln.DotSettings ├── PostfixTemplates ├── CodeCompletion │ ├── CSharp │ │ ├── CSharpPostfixTemplatesItemProvider.cs │ │ └── Extras │ │ │ ├── CSharpEnumCaseItemProvider.cs │ │ │ ├── CSharpLengthCountItemProvider.cs │ │ │ ├── CSharpStaticMethodsItemProvider.cs │ │ │ └── CSharpTypeParameterFromUsageItemProvider.cs │ ├── CodeCompletionPostfixExecutionContext.cs │ ├── PostfixTemplatesFilter.cs │ └── PostfixTemplatesItemProviderBase.cs ├── Infrastructure │ ├── Behaviors │ │ ├── CSharp │ │ │ ├── CSharpExpressionPostfixTemplateBehavior.cs │ │ │ └── CSharpStatementPostfixTemplateBehavior.cs │ │ └── PostfixTemplateBehavior.cs │ ├── Contexts │ │ ├── CSharp │ │ │ ├── CSharpBrokenStatementPostfixTemplateContext.cs │ │ │ ├── CSharpPostfixExpressionContext.cs │ │ │ ├── CSharpPostfixTemplateContext.cs │ │ │ ├── CSharpPostfixTemplateContextFactory.cs │ │ │ ├── CSharpPostfixTemplatesManager.cs │ │ │ ├── CSharpReferenceExpressionPostfixTemplateContext.cs │ │ │ └── CSharpReferenceNamePostfixTemplateContext.cs │ │ ├── IPostfixTemplateContextFactory.cs │ │ ├── PostfixExpressionContext.cs │ │ ├── PostfixExpressionContextImage.cs │ │ ├── PostfixTemplateContext.cs │ │ └── PostfixTemplateExecutionContext.cs │ ├── ExpressionChooser.cs │ ├── IPostfixTemplateMetadata.cs │ ├── IPostfixTemplatesManager.cs │ ├── PostfixTemplateAttribute.cs │ ├── PostfixTemplateInfo.cs │ ├── PostfixTemplateTarget.cs │ ├── PostfixTemplatesManager.cs │ └── PostfixTemplatesTabTracker.cs ├── LookupItems │ ├── PostfixTemplateMatcher.cs │ └── PostfixTemplatePresentation.cs ├── PostfixTemplates.R91.csproj ├── PostfixTemplates.R91.csproj.DotSettings ├── PostfixTemplates.R92.csproj ├── PostfixTemplates.R92.csproj.DotSettings ├── Properties │ └── AssemblyInfo.cs ├── Settings │ ├── CodeCompletionSettingsAccessor.cs │ ├── PostfixOptionsPage.xaml │ ├── PostfixOptionsPage.xaml.cs │ ├── PostfixOptionsViewModel.cs │ ├── PostfixTemplateViewModel.cs │ └── PostfixTemplatesSettings.cs ├── Templates │ ├── CSharp │ │ ├── ArgumentExpressionTemplate.cs │ │ ├── AssignmentExpressionTemplate.cs │ │ ├── AwaitExpressionTemplate.cs │ │ ├── BooleanExpressionTemplateBase.cs │ │ ├── CastExpressionTemplate.cs │ │ ├── CheckForNullTemplateBase.cs │ │ ├── CheckIsNullTemplate.cs │ │ ├── CheckNotNullTemplate.cs │ │ ├── ElseStatementTemplate.cs │ │ ├── ForEachLoopTemplate.cs │ │ ├── ForLoopTemplate.cs │ │ ├── ForLoopTemplateBase.cs │ │ ├── ForReverseLoopTemplate.cs │ │ ├── IfStatementTemplate.cs │ │ ├── IntroduceFieldTemplate.cs │ │ ├── IntroduceMemberTemplateBase.cs │ │ ├── IntroducePropertyTemplate.cs │ │ ├── IntroduceVariableTemplate.cs │ │ ├── LockStatementTemplate.cs │ │ ├── NotExpressionTemplate.cs │ │ ├── ObjectCreationTemplate.cs │ │ ├── ParenthesizedExpressionTemplate.cs │ │ ├── ParseStringTemplate.cs │ │ ├── ParseStringTemplateBase.cs │ │ ├── ReturnStatementTemplate.cs │ │ ├── SelectExpressionTemplate.cs │ │ ├── SwitchStatementTemplate.cs │ │ ├── ThrowStatementTemplate.cs │ │ ├── TryParseStringTemplate.cs │ │ ├── TypeOfExpressionTemplate.cs │ │ ├── UsingStatementTemplate.cs │ │ ├── WhileLoopTemplate.cs │ │ └── YieldReturnStatementTemplate.cs │ └── IPostfixTemplate.cs ├── Tests │ ├── Completion │ │ ├── PostfixExtraMembersTest.cs │ │ ├── PostfixRazorTest.cs │ │ └── PostfixTemplatesTest.cs │ ├── CompletionList │ │ ├── PostfixExtraMembersListTest.cs │ │ └── PostfixTemplatesListTest.cs │ ├── Components │ │ └── TestExpressionChooser.cs │ ├── Data │ │ ├── Completion │ │ │ ├── Extra │ │ │ │ ├── List │ │ │ │ │ ├── TestEnum01.cs │ │ │ │ │ ├── TestEnum01.cs.gold │ │ │ │ │ ├── TestEnum02.cs │ │ │ │ │ ├── TestEnum02.cs.gold │ │ │ │ │ ├── TestEnum03.cs │ │ │ │ │ ├── TestEnum03.cs.gold │ │ │ │ │ ├── TestStatic01.cs │ │ │ │ │ ├── TestStatic01.cs.gold │ │ │ │ │ ├── TestStatic02.cs │ │ │ │ │ ├── TestStatic02.cs.gold │ │ │ │ │ ├── TestStatic03.cs │ │ │ │ │ └── TestStatic03.cs.gold │ │ │ │ ├── TestCount01.cs │ │ │ │ ├── TestCount01.cs.gold │ │ │ │ ├── TestCount02.cs │ │ │ │ ├── TestCount02.cs.gold │ │ │ │ ├── TestCount03.cs │ │ │ │ ├── TestCount03.cs.gold │ │ │ │ ├── TestCount04.cs │ │ │ │ ├── TestCount04.cs.gold │ │ │ │ ├── TestEnum01.cs │ │ │ │ ├── TestEnum01.cs.gold │ │ │ │ ├── TestEnum02.cs │ │ │ │ ├── TestEnum02.cs.gold │ │ │ │ ├── TestEnum03.cs │ │ │ │ ├── TestEnum03.cs.gold │ │ │ │ ├── TestEnum04.cs │ │ │ │ ├── TestEnum04.cs.gold │ │ │ │ ├── TestEnum05.cs │ │ │ │ ├── TestEnum05.cs.gold │ │ │ │ ├── TestEnum06.cs │ │ │ │ ├── TestEnum06.cs.gold │ │ │ │ ├── TestEnum07.cs │ │ │ │ ├── TestEnum07.cs.gold │ │ │ │ ├── TestEnum08.cs │ │ │ │ ├── TestEnum08.cs.gold │ │ │ │ ├── TestLength01.cs │ │ │ │ ├── TestLength01.cs.gold │ │ │ │ ├── TestLength02.cs │ │ │ │ ├── TestLength02.cs.gold │ │ │ │ ├── TestStatic01.cs │ │ │ │ ├── TestStatic01.cs.gold │ │ │ │ ├── TestStatic02.cs │ │ │ │ ├── TestStatic02.cs.gold │ │ │ │ ├── TestStatic03.cs │ │ │ │ ├── TestStatic03.cs.gold │ │ │ │ ├── TestStatic04.cs │ │ │ │ ├── TestStatic04.cs.gold │ │ │ │ ├── TestStatic05.cs │ │ │ │ ├── TestStatic05.cs.gold │ │ │ │ ├── TestStatic06.cs │ │ │ │ ├── TestStatic06.cs.gold │ │ │ │ ├── TestStatic07.cs │ │ │ │ ├── TestStatic07.cs.gold │ │ │ │ ├── TestStatic08.cs │ │ │ │ ├── TestStatic08.cs.gold │ │ │ │ ├── TestStatic09.cs │ │ │ │ ├── TestStatic09.cs.gold │ │ │ │ ├── TestStatic10.cs │ │ │ │ ├── TestStatic10.cs.gold │ │ │ │ ├── TestStatic11.cs │ │ │ │ ├── TestStatic11.cs.gold │ │ │ │ ├── TestStatic12.cs │ │ │ │ ├── TestStatic12.cs.gold │ │ │ │ ├── TestStatic13.cs │ │ │ │ ├── TestStatic13.cs.gold │ │ │ │ ├── TestStatic14.cs │ │ │ │ ├── TestStatic14.cs.gold │ │ │ │ ├── TestStatic15.cs │ │ │ │ ├── TestStatic15.cs.gold │ │ │ │ ├── TestStatic16.cs │ │ │ │ ├── TestStatic16.cs.gold │ │ │ │ ├── TestStatic17.cs │ │ │ │ ├── TestStatic17.cs.gold │ │ │ │ ├── TestStatic18.cs │ │ │ │ ├── TestStatic18.cs.gold │ │ │ │ ├── TestStatic19.cs │ │ │ │ ├── TestStatic19.cs.gold │ │ │ │ ├── TestStatic20.cs │ │ │ │ ├── TestStatic20.cs.gold │ │ │ │ ├── TestStatic21.cs │ │ │ │ ├── TestStatic21.cs.gold │ │ │ │ ├── TestStatic22.cs │ │ │ │ ├── TestStatic22.cs.gold │ │ │ │ ├── TestStatic23.cs │ │ │ │ └── TestStatic23.cs.gold │ │ │ ├── List │ │ │ │ ├── TestAssignment01.cs │ │ │ │ ├── TestAssignment01.cs.gold │ │ │ │ ├── TestAssignment02.cs │ │ │ │ ├── TestAssignment02.cs.gold │ │ │ │ ├── TestAwait01.cs │ │ │ │ ├── TestAwait01.cs.gold │ │ │ │ ├── TestAwait02.cs │ │ │ │ ├── TestAwait02.cs.gold │ │ │ │ ├── TestBase01.cs │ │ │ │ ├── TestBase01.cs.gold │ │ │ │ ├── TestBoolean01.cs │ │ │ │ ├── TestBoolean01.cs.gold │ │ │ │ ├── TestBoolean02.cs │ │ │ │ ├── TestBoolean02.cs.gold │ │ │ │ ├── TestBoolean03.cs │ │ │ │ ├── TestBoolean03.cs.gold │ │ │ │ ├── TestIf01.cs │ │ │ │ ├── TestIf01.cs.gold │ │ │ │ ├── TestIf02.cs │ │ │ │ ├── TestIf02.cs.gold │ │ │ │ ├── TestIf03.cs │ │ │ │ ├── TestIf03.cs.gold │ │ │ │ ├── TestNamespace01.cs │ │ │ │ ├── TestNamespace01.cs.gold │ │ │ │ ├── TestNew01.cs │ │ │ │ ├── TestNew01.cs.gold │ │ │ │ ├── TestNew02.cs │ │ │ │ ├── TestNew02.cs.gold │ │ │ │ ├── TestSwitch01.cs │ │ │ │ ├── TestSwitch01.cs.gold │ │ │ │ ├── TestThis01.cs │ │ │ │ ├── TestThis01.cs.gold │ │ │ │ ├── TestType01.cs │ │ │ │ ├── TestType01.cs.gold │ │ │ │ ├── TestType02.cs │ │ │ │ ├── TestType02.cs.gold │ │ │ │ ├── TestType03.cs │ │ │ │ ├── TestType03.cs.gold │ │ │ │ ├── TestType04.cs │ │ │ │ ├── TestType04.cs.gold │ │ │ │ ├── TestType05.cs │ │ │ │ ├── TestType05.cs.gold │ │ │ │ ├── TestUnresolved01.cs │ │ │ │ ├── TestUnresolved01.cs.gold │ │ │ │ ├── TestUnresolved02.cs │ │ │ │ ├── TestUnresolved02.cs.gold │ │ │ │ ├── TestUnresolved03.cs │ │ │ │ ├── TestUnresolved03.cs.gold │ │ │ │ ├── TestUnresolved04.cs │ │ │ │ ├── TestUnresolved04.cs.gold │ │ │ │ ├── TestUnresolved05.cs │ │ │ │ ├── TestUnresolved05.cs.gold │ │ │ │ ├── TestVar01.cs │ │ │ │ ├── TestVar01.cs.gold │ │ │ │ ├── TestVar02.cs │ │ │ │ ├── TestVar02.cs.gold │ │ │ │ ├── TestYield01.cs │ │ │ │ └── TestYield01.cs.gold │ │ │ ├── Razor │ │ │ │ ├── Model.cs │ │ │ │ ├── TestEnum01.cshtml │ │ │ │ ├── TestRazor01.cshtml │ │ │ │ ├── TestRazor01.cshtml.gold │ │ │ │ ├── TestRazor02.cshtml │ │ │ │ ├── TestRazor02.cshtml.gold │ │ │ │ ├── TestRazor03.cshtml │ │ │ │ ├── TestRazor03.cshtml.gold │ │ │ │ ├── TestRazor04.cshtml │ │ │ │ ├── TestRazor04.cshtml.gold │ │ │ │ ├── TestRazor05.cshtml │ │ │ │ ├── TestRazor05.cshtml.gold │ │ │ │ ├── TestRazor06.cshtml │ │ │ │ ├── TestRazor06.cshtml.gold │ │ │ │ ├── TestRazor07.cshtml │ │ │ │ ├── TestRazor07.cshtml.gold │ │ │ │ ├── TestRazor08.cshtml │ │ │ │ ├── TestRazor08.cshtml.gold │ │ │ │ ├── TestRazor09.cshtml │ │ │ │ ├── TestRazor09.cshtml.gold │ │ │ │ ├── TestRazor10.cshtml │ │ │ │ └── TestRazor10.cshtml.gold │ │ │ ├── TestArg01.cs │ │ │ ├── TestArg01.cs.gold │ │ │ ├── TestArg02.cs │ │ │ ├── TestArg02.cs.gold │ │ │ ├── TestCast01.cs │ │ │ ├── TestCast01.cs.gold │ │ │ ├── TestCast02.cs │ │ │ ├── TestCast02.cs.gold │ │ │ ├── TestField01.cs │ │ │ ├── TestField01.cs.gold │ │ │ ├── TestField02.cs │ │ │ ├── TestField02.cs.gold │ │ │ ├── TestFor01.cs │ │ │ ├── TestFor01.cs.gold │ │ │ ├── TestFor02.cs │ │ │ ├── TestFor02.cs.gold │ │ │ ├── TestFor03.cs │ │ │ ├── TestFor03.cs.gold │ │ │ ├── TestFor04.cs │ │ │ ├── TestFor04.cs.gold │ │ │ ├── TestFor05.cs │ │ │ ├── TestFor05.cs.gold │ │ │ ├── TestFor40.cs │ │ │ ├── TestFor40.cs.gold │ │ │ ├── TestFor41.cs │ │ │ ├── TestFor41.cs.gold │ │ │ ├── TestForEach01.cs │ │ │ ├── TestForEach01.cs.gold │ │ │ ├── TestForEach02.cs │ │ │ ├── TestForEach02.cs.gold │ │ │ ├── TestForEach03.cs │ │ │ ├── TestForEach03.cs.gold │ │ │ ├── TestForEach04.cs │ │ │ ├── TestForEach04.cs.gold │ │ │ ├── TestForEach05.cs │ │ │ ├── TestForEach05.cs.gold │ │ │ ├── TestForEach40.cs │ │ │ ├── TestForEach40.cs.gold │ │ │ ├── TestIf01.cs │ │ │ ├── TestIf01.cs.gold │ │ │ ├── TestIf02.cs │ │ │ ├── TestIf02.cs.gold │ │ │ ├── TestIf03.cs │ │ │ ├── TestIf03.cs.gold │ │ │ ├── TestIf04.cs │ │ │ ├── TestIf04.cs.gold │ │ │ ├── TestIf05.cs │ │ │ ├── TestIf05.cs.gold │ │ │ ├── TestIf06.cs │ │ │ ├── TestIf06.cs.gold │ │ │ ├── TestIf07.cs │ │ │ ├── TestIf07.cs.gold │ │ │ ├── TestIf08.cs │ │ │ ├── TestIf08.cs.gold │ │ │ ├── TestIf09.cs │ │ │ ├── TestIf09.cs.gold │ │ │ ├── TestIf10.cs │ │ │ ├── TestIf10.cs.gold │ │ │ ├── TestIf11.cs │ │ │ ├── TestIf11.cs.gold │ │ │ ├── TestIf12.cs │ │ │ ├── TestIf12.cs.gold │ │ │ ├── TestIf13.cs │ │ │ ├── TestIf13.cs.gold │ │ │ ├── TestIf14.cs │ │ │ ├── TestIf14.cs.gold │ │ │ ├── TestIf15.cs │ │ │ ├── TestIf15.cs.gold │ │ │ ├── TestIf16.cs │ │ │ ├── TestIf16.cs.gold │ │ │ ├── TestIf17.cs │ │ │ ├── TestIf17.cs.gold │ │ │ ├── TestIf18.cs │ │ │ ├── TestIf18.cs.gold │ │ │ ├── TestIf19.cs │ │ │ ├── TestIf19.cs.gold │ │ │ ├── TestIf20.cs │ │ │ ├── TestIf20.cs.gold │ │ │ ├── TestIf21.cs │ │ │ ├── TestIf21.cs.gold │ │ │ ├── TestIf22.cs │ │ │ ├── TestIf22.cs.gold │ │ │ ├── TestLock01.cs │ │ │ ├── TestLock01.cs.gold │ │ │ ├── TestNew01.cs │ │ │ ├── TestNew01.cs.gold │ │ │ ├── TestNew02.cs │ │ │ ├── TestNew02.cs.gold │ │ │ ├── TestNew03.cs │ │ │ ├── TestNew03.cs.gold │ │ │ ├── TestNew04.cs │ │ │ ├── TestNew04.cs.gold │ │ │ ├── TestNew05.cs │ │ │ ├── TestNew05.cs.gold │ │ │ ├── TestNew06.cs │ │ │ ├── TestNew06.cs.gold │ │ │ ├── TestNew07.cs │ │ │ ├── TestNew07.cs.gold │ │ │ ├── TestNew08.cs │ │ │ ├── TestNew08.cs.gold │ │ │ ├── TestNot01.cs │ │ │ ├── TestNot01.cs.gold │ │ │ ├── TestNot02.cs │ │ │ ├── TestNot02.cs.gold │ │ │ ├── TestNot03.cs │ │ │ ├── TestNot03.cs.gold │ │ │ ├── TestNotNull01.cs │ │ │ ├── TestNotNull01.cs.gold │ │ │ ├── TestNotNull02.cs │ │ │ ├── TestNotNull02.cs.gold │ │ │ ├── TestPar01.cs │ │ │ ├── TestPar01.cs.gold │ │ │ ├── TestProp01.cs │ │ │ ├── TestProp01.cs.gold │ │ │ ├── TestReturn01.cs │ │ │ ├── TestReturn01.cs.gold │ │ │ ├── TestReturn02.cs │ │ │ ├── TestReturn02.cs.gold │ │ │ ├── TestReturn03.cs │ │ │ ├── TestReturn03.cs.gold │ │ │ ├── TestReturn04.cs │ │ │ ├── TestReturn04.cs.gold │ │ │ ├── TestReturn05.cs │ │ │ ├── TestReturn05.cs.gold │ │ │ ├── TestReturn06.cs │ │ │ ├── TestReturn06.cs.gold │ │ │ ├── TestThrow01.cs │ │ │ ├── TestThrow01.cs.gold │ │ │ ├── TestThrow02.cs │ │ │ ├── TestThrow02.cs.gold │ │ │ ├── TestThrow03.cs │ │ │ ├── TestThrow03.cs.gold │ │ │ ├── TestThrow04.cs │ │ │ ├── TestThrow04.cs.gold │ │ │ ├── TestThrow05.cs │ │ │ ├── TestThrow05.cs.gold │ │ │ ├── TestThrow06.cs │ │ │ ├── TestThrow06.cs.gold │ │ │ ├── TestThrow07.cs │ │ │ ├── TestThrow07.cs.gold │ │ │ ├── TestThrow08.cs │ │ │ ├── TestThrow08.cs.gold │ │ │ ├── TestTo01.cs │ │ │ ├── TestTo01.cs.gold │ │ │ ├── TestTypeof01.cs │ │ │ ├── TestTypeof01.cs.gold │ │ │ ├── TestUsing01.cs │ │ │ ├── TestUsing01.cs.gold │ │ │ ├── TestUsing02.cs │ │ │ ├── TestUsing02.cs.gold │ │ │ ├── TestUsing03.cs │ │ │ ├── TestUsing03.cs.gold │ │ │ ├── TestUsing04.cs │ │ │ ├── TestUsing04.cs.gold │ │ │ ├── TestUsing40.cs │ │ │ ├── TestUsing40.cs.gold │ │ │ ├── TestVar01.cs │ │ │ ├── TestVar01.cs.gold │ │ │ ├── TestVar02.cs │ │ │ ├── TestVar02.cs.gold │ │ │ ├── TestVar03.cs │ │ │ ├── TestVar03.cs.gold │ │ │ ├── TestVar04.cs │ │ │ ├── TestVar04.cs.gold │ │ │ ├── TestVar05.cs │ │ │ ├── TestVar05.cs.gold │ │ │ ├── TestVar06.cs │ │ │ ├── TestVar06.cs.gold │ │ │ ├── TestVar07.cs │ │ │ ├── TestVar07.cs.gold │ │ │ ├── TestVar08.cs │ │ │ ├── TestVar08.cs.gold │ │ │ ├── TestVar09.cs │ │ │ ├── TestVar09.cs.gold │ │ │ ├── TestVar10.cs │ │ │ ├── TestVar10.cs.gold │ │ │ ├── TestVar11.cs │ │ │ └── TestVar11.cs.gold │ │ └── nuget.config │ ├── PostfixTemplates.Tests.R91.csproj │ ├── PostfixTemplates.Tests.R92.csproj │ ├── PostfixTestBase.cs │ ├── PostfixTestsAssembly.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── ZoneMarker.cs │ ├── packages.PostfixTemplates.Tests.R91.config │ └── packages.PostfixTemplates.Tests.R92.config ├── Utils │ ├── CSharpPostfixUtis.cs │ ├── CommonUtils.cs │ ├── RazorUtil.cs │ └── TypeUtils.cs ├── ZoneMarker.cs ├── packages.PostfixTemplates.R91.config └── packages.PostfixTemplates.R92.config ├── Readme.md └── build.ps1 /Content/Changelog.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/controlflow/resharper-postfix/b239a0a68702901d9b6bd636ff9df0985749a6ed/Content/Changelog.md -------------------------------------------------------------------------------- /Content/Todo.txt: -------------------------------------------------------------------------------- 1 | TODO: fix tab expansion 2 | TODO: fix double completion 3 | 4 | TODO: review templates in attributes 5 | TODO: hide source templates from compiled code 6 | TODO: make sure no bind or formatting happens during context fix! 7 | 8 | TODO: Fix razor? 9 | TODO: Support code style var setting in 9.0 build; 10 | TODO: New .cw template for Console.WriteLine() invocation; 11 | TODO: New .push/.pull templates? 12 | TODO: C# 6.0 .nameof template 13 | TODO: 9.0 lookup items refactor 14 | TODO: ArgumentException.throw 15 | TODO: snap to device pixels in settings UI 16 | 17 | TODO: rename 'auto completion' into 'precise mode' -------------------------------------------------------------------------------- /Content/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/controlflow/resharper-postfix/b239a0a68702901d9b6bd636ff9df0985749a6ed/Content/icon.png -------------------------------------------------------------------------------- /Content/options.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/controlflow/resharper-postfix/b239a0a68702901d9b6bd636ff9df0985749a6ed/Content/options.png -------------------------------------------------------------------------------- /Content/postfix.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/controlflow/resharper-postfix/b239a0a68702901d9b6bd636ff9df0985749a6ed/Content/postfix.gif -------------------------------------------------------------------------------- /Content/postfix2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/controlflow/resharper-postfix/b239a0a68702901d9b6bd636ff9df0985749a6ed/Content/postfix2.gif -------------------------------------------------------------------------------- /Content/postfix_enums.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/controlflow/resharper-postfix/b239a0a68702901d9b6bd636ff9df0985749a6ed/Content/postfix_enums.gif -------------------------------------------------------------------------------- /Content/postfix_generics.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/controlflow/resharper-postfix/b239a0a68702901d9b6bd636ff9df0985749a6ed/Content/postfix_generics.gif -------------------------------------------------------------------------------- /Content/postfix_lengthcount.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/controlflow/resharper-postfix/b239a0a68702901d9b6bd636ff9df0985749a6ed/Content/postfix_lengthcount.gif -------------------------------------------------------------------------------- /Content/postfix_static_methods.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/controlflow/resharper-postfix/b239a0a68702901d9b6bd636ff9df0985749a6ed/Content/postfix_static_methods.gif -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Alexander Shvedov 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /PostfixTemplates.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | $PackageId$ 5 | 2.2.3 6 | 7 | Postfix Templates 8 | Alexander Shvedov 9 | controlflow 10 | https://github.com/controlflow/resharper-postfix 11 | https://raw.githubusercontent.com/controlflow/resharper-postfix/master/Content/icon.png 12 | false 13 | 14 | Templating/code completion plugin that helps reducing backward caret jumps while typing C# code. Kind of surround templates on steroids baked with code completion. 15 | 16 | 17 | • ReSharper 9.2 support; 18 | • New feature: create method type parameter from usage in a postfix way; 19 | • Drop support of ReSharper 8.0, 8.1, 8.2 and 9.0; 20 | • Refactoring: make use of R# 9.0 new code completion model with lazy behavior and presentation; 21 | • Refactoring: code infrastructure abstracted away from C# specific infrastructure (prepare for JS templates); 22 | • Support for ReSharper 9.0 code completion filters; 23 | 24 | 25 | 26 | 27 | postfix templates completion cats surround 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /PostfixTemplates.sln.DotSettings: -------------------------------------------------------------------------------- 1 |  2 | DO_NOT_SHOW 3 | DO_NOT_SHOW 4 | DO_NOT_SHOW 5 | DO_NOT_SHOW 6 | DO_NOT_SHOW 7 | DO_NOT_SHOW 8 | DO_NOT_SHOW 9 | DO_NOT_SHOW 10 | <Policy Inspect="True" Prefix="my" Suffix="" Style="AaBb" /> 11 | <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> 12 | True 13 | False 14 | ALWAYS -------------------------------------------------------------------------------- /PostfixTemplates/CodeCompletion/CSharp/CSharpPostfixTemplatesItemProvider.cs: -------------------------------------------------------------------------------- 1 | using JetBrains.Annotations; 2 | using JetBrains.ReSharper.Feature.Services.CSharp.CodeCompletion.Infrastructure; 3 | using JetBrains.ReSharper.PostfixTemplates.Contexts; 4 | using JetBrains.ReSharper.PostfixTemplates.Contexts.CSharp; 5 | using JetBrains.ReSharper.Psi; 6 | using JetBrains.ReSharper.Psi.CSharp; 7 | 8 | namespace JetBrains.ReSharper.PostfixTemplates.CodeCompletion.CSharp 9 | { 10 | [Language(typeof(CSharpLanguage))] 11 | public class CSharpPostfixTemplatesItemProvider : PostfixTemplatesItemProviderBase 12 | { 13 | [NotNull] private readonly CSharpPostfixTemplateContextFactory myPostfixContextFactory; 14 | 15 | public CSharpPostfixTemplatesItemProvider( 16 | [NotNull] CSharpPostfixTemplatesManager templatesManager, [NotNull] CSharpPostfixTemplateContextFactory postfixContextFactory) : base(templatesManager) 17 | { 18 | myPostfixContextFactory = postfixContextFactory; 19 | } 20 | 21 | protected override PostfixTemplateContext TryCreatePostfixContext(CSharpCodeCompletionContext codeCompletionContext) 22 | { 23 | var completionContext = codeCompletionContext.BasicContext; 24 | 25 | var unterminatedContext = codeCompletionContext.UnterminatedContext; 26 | if (unterminatedContext.TreeNode != null) 27 | { 28 | var executionContext = new CodeCompletionPostfixExecutionContext(completionContext, unterminatedContext, "__"); 29 | var postfixContext = myPostfixContextFactory.TryCreate(unterminatedContext.TreeNode, executionContext); 30 | if (postfixContext != null) return postfixContext; 31 | } 32 | 33 | // try unterminated context if terminated sucks 34 | var terminatedContext = codeCompletionContext.TerminatedContext; 35 | if (terminatedContext.TreeNode != null) 36 | { 37 | var executionContext = new CodeCompletionPostfixExecutionContext(completionContext, terminatedContext, "__;"); 38 | var postfixContext = myPostfixContextFactory.TryCreate(terminatedContext.TreeNode, executionContext); 39 | if (postfixContext != null) return postfixContext; 40 | } 41 | 42 | return null; 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /PostfixTemplates/CodeCompletion/CodeCompletionPostfixExecutionContext.cs: -------------------------------------------------------------------------------- 1 | using JetBrains.Annotations; 2 | using JetBrains.DocumentModel; 3 | using JetBrains.ReSharper.Feature.Services.CodeCompletion.Infrastructure; 4 | using JetBrains.ReSharper.PostfixTemplates.Contexts; 5 | using JetBrains.ReSharper.Psi.Tree; 6 | 7 | namespace JetBrains.ReSharper.PostfixTemplates.CodeCompletion 8 | { 9 | public class CodeCompletionPostfixExecutionContext : PostfixTemplateExecutionContext 10 | { 11 | [NotNull] private readonly ReparsedCodeCompletionContext myReparsedContext; 12 | 13 | public CodeCompletionPostfixExecutionContext( 14 | [NotNull] CodeCompletionContext context, [NotNull] ReparsedCodeCompletionContext reparsedContext, [NotNull] string reparseString) 15 | : base(solution: context.Solution, 16 | textControl: context.TextControl, 17 | settingsStore: context.ContextBoundSettingsStore, 18 | reparseString: reparseString, 19 | //isPreciseMode: context.Parameters.CodeCompletionTypes.Length == 1 20 | isPreciseMode: context.Parameters.IsAutomaticCompletion 21 | ) 22 | { 23 | myReparsedContext = reparsedContext; 24 | } 25 | 26 | public override DocumentRange GetDocumentRange(ITreeNode treeNode) 27 | { 28 | return myReparsedContext.ToDocumentRange(treeNode); 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /PostfixTemplates/Infrastructure/Behaviors/CSharp/CSharpExpressionPostfixTemplateBehavior.cs: -------------------------------------------------------------------------------- 1 | using JetBrains.Annotations; 2 | using JetBrains.ReSharper.PostfixTemplates.Contexts; 3 | using JetBrains.ReSharper.PostfixTemplates.Contexts.CSharp; 4 | using JetBrains.ReSharper.Psi; 5 | using JetBrains.ReSharper.Psi.CSharp; 6 | using JetBrains.ReSharper.Psi.CSharp.Tree; 7 | using JetBrains.ReSharper.Psi.CSharp.Util; 8 | using JetBrains.ReSharper.Psi.Tree; 9 | using JetBrains.TextControl; 10 | using JetBrains.Util; 11 | 12 | namespace JetBrains.ReSharper.PostfixTemplates.LookupItems 13 | { 14 | public abstract class CSharpExpressionPostfixTemplateBehavior : PostfixTemplateBehavior 15 | where TExpression : class, ICSharpExpression 16 | { 17 | protected CSharpExpressionPostfixTemplateBehavior([NotNull] PostfixTemplateInfo info) : base(info) { } 18 | 19 | protected override ITreeNode ExpandPostfix(PostfixExpressionContext context) 20 | { 21 | var csharpContext = (CSharpPostfixExpressionContext) context; 22 | var psiModule = csharpContext.PostfixContext.PsiModule; 23 | var psiServices = psiModule.GetPsiServices(); 24 | 25 | var expandedExpression = psiServices.DoTransaction(ExpandCommandName, () => 26 | { 27 | var factory = CSharpElementFactory.GetInstance(psiModule); 28 | var expression = csharpContext.Expression; 29 | 30 | // todo: get rid of this xtra behavior? 31 | var operand = expression.GetOperandThroughParenthesis().NotNull("operand != null"); 32 | 33 | var newExpression = CreateExpression(factory, operand); 34 | 35 | return expression.ReplaceBy(newExpression); 36 | 37 | // todo: DecorateReplacedExpression()? 38 | }); 39 | 40 | return expandedExpression; 41 | } 42 | 43 | [NotNull] // todo: pass postfix expression context 44 | protected abstract TExpression CreateExpression([NotNull] CSharpElementFactory factory, [NotNull] ICSharpExpression expression); 45 | 46 | protected sealed override void AfterComplete(ITextControl textControl, ITreeNode node) 47 | { 48 | AfterComplete(textControl, (TExpression) node); 49 | } 50 | 51 | protected virtual void AfterComplete(ITextControl textControl, TExpression expression) 52 | { 53 | var endOffset = expression.GetDocumentRange().TextRange.EndOffset; 54 | textControl.Caret.MoveTo(endOffset, CaretVisualPlacement.DontScrollIfVisible); 55 | } 56 | } 57 | } -------------------------------------------------------------------------------- /PostfixTemplates/Infrastructure/Contexts/CSharp/CSharpPostfixTemplatesManager.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using JetBrains.Annotations; 3 | using JetBrains.ReSharper.PostfixTemplates.Templates; 4 | using JetBrains.ReSharper.Psi; 5 | using JetBrains.ReSharper.Psi.CSharp; 6 | 7 | namespace JetBrains.ReSharper.PostfixTemplates.Contexts.CSharp 8 | { 9 | [Language(typeof(CSharpLanguage))] 10 | public class CSharpPostfixTemplatesManager : PostfixTemplatesManager 11 | { 12 | public CSharpPostfixTemplatesManager([NotNull] IEnumerable> templates) 13 | : base(templates) { } 14 | 15 | // extra filter for namespaces? 16 | } 17 | } -------------------------------------------------------------------------------- /PostfixTemplates/Infrastructure/Contexts/CSharp/CSharpReferenceNamePostfixTemplateContext.cs: -------------------------------------------------------------------------------- 1 | using JetBrains.Annotations; 2 | using JetBrains.ReSharper.Psi.CSharp.Tree; 3 | using JetBrains.ReSharper.Psi.ExtensionsAPI; 4 | 5 | namespace JetBrains.ReSharper.PostfixTemplates.Contexts.CSharp 6 | { 7 | public class CSharpReferenceNamePostfixTemplateContext : CSharpPostfixTemplateContext 8 | { 9 | public CSharpReferenceNamePostfixTemplateContext( 10 | [NotNull] IReferenceName reference, [NotNull] ICSharpExpression expression, [NotNull] PostfixTemplateExecutionContext executionContext) 11 | : base(reference, expression, executionContext) { } 12 | 13 | private static readonly string FixCommandName = typeof(CSharpReferenceNamePostfixTemplateContext) + ".FixExpression"; 14 | 15 | public override CSharpPostfixExpressionContext FixExpression(CSharpPostfixExpressionContext context) 16 | { 17 | var expression = context.Expression; 18 | if (expression.Contains(Reference)) // x is T.bar => x is T 19 | { 20 | var psiServices = expression.GetPsiServices(); 21 | psiServices.Transactions.Execute(FixCommandName, () => 22 | { 23 | var referenceName = (IReferenceName) Reference; 24 | var qualifier = referenceName.Qualifier; 25 | 26 | LowLevelModificationUtil.DeleteChild(qualifier); // remove first 27 | LowLevelModificationUtil.ReplaceChildRange(referenceName, referenceName, qualifier); 28 | }); 29 | } 30 | 31 | return context; 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /PostfixTemplates/Infrastructure/Contexts/IPostfixTemplateContextFactory.cs: -------------------------------------------------------------------------------- 1 | using JetBrains.Annotations; 2 | using JetBrains.ReSharper.Psi.Tree; 3 | 4 | namespace JetBrains.ReSharper.PostfixTemplates.Contexts 5 | { 6 | public interface IPostfixTemplateContextFactory 7 | { 8 | [NotNull] string[] GetReparseStrings(); 9 | 10 | [CanBeNull] PostfixTemplateContext TryCreate([NotNull] ITreeNode position, [NotNull] PostfixTemplateExecutionContext executionContext); 11 | } 12 | } -------------------------------------------------------------------------------- /PostfixTemplates/Infrastructure/Contexts/PostfixExpressionContext.cs: -------------------------------------------------------------------------------- 1 | using JetBrains.Annotations; 2 | using JetBrains.DocumentModel; 3 | using JetBrains.ReSharper.Psi.Tree; 4 | 5 | namespace JetBrains.ReSharper.PostfixTemplates.Contexts 6 | { 7 | public abstract class PostfixExpressionContext 8 | { 9 | protected PostfixExpressionContext([NotNull] PostfixTemplateContext postfixContext, [NotNull] ITreeNode expression) 10 | { 11 | PostfixContext = postfixContext; 12 | Expression = expression; 13 | } 14 | 15 | [NotNull] public PostfixTemplateContext PostfixContext { get; private set; } 16 | [NotNull] public ITreeNode Expression { get; private set; } 17 | 18 | public DocumentRange ExpressionRange 19 | { 20 | get { return PostfixContext.ToDocumentRange(Expression); } 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /PostfixTemplates/Infrastructure/Contexts/PostfixExpressionContextImage.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using JetBrains.Annotations; 3 | using JetBrains.DocumentModel; 4 | 5 | namespace JetBrains.ReSharper.PostfixTemplates.Contexts 6 | { 7 | public sealed class PostfixExpressionContextImage 8 | { 9 | [NotNull] private readonly Type myExpressionType; 10 | private readonly DocumentRange myExpressionRange; 11 | private readonly int myExpressionIndex; 12 | 13 | public PostfixExpressionContextImage([NotNull] PostfixExpressionContext context) 14 | { 15 | myExpressionType = context.Expression.GetType(); 16 | myExpressionRange = context.ExpressionRange; 17 | myExpressionIndex = context.PostfixContext.AllExpressions.IndexOf(context); 18 | } 19 | 20 | public int ExpressionIndex { get { return myExpressionIndex; } } 21 | 22 | public bool MatchesByRangeAndType([NotNull] PostfixExpressionContext context) 23 | { 24 | var startOffset = myExpressionRange.TextRange.StartOffset; 25 | return context.Expression.GetType() == myExpressionType 26 | && context.ExpressionRange.TextRange.StartOffset == startOffset; 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /PostfixTemplates/Infrastructure/Contexts/PostfixTemplateContext.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using JetBrains.Annotations; 3 | using JetBrains.DocumentModel; 4 | using JetBrains.ReSharper.Psi.Modules; 5 | using JetBrains.ReSharper.Psi.Tree; 6 | 7 | namespace JetBrains.ReSharper.PostfixTemplates.Contexts 8 | { 9 | public abstract class PostfixTemplateContext 10 | { 11 | [CanBeNull] private IList myAllExpressions; 12 | 13 | protected PostfixTemplateContext([NotNull] ITreeNode reference, [NotNull] PostfixTemplateExecutionContext executionContext) 14 | { 15 | Reference = reference; 16 | PsiModule = reference.GetPsiModule(); 17 | ExecutionContext = executionContext; 18 | } 19 | 20 | [NotNull] public ITreeNode Reference { get; private set; } 21 | [NotNull] public IPsiModule PsiModule { get; private set; } 22 | 23 | [NotNull] public PostfixTemplateExecutionContext ExecutionContext { get; private set; } 24 | 25 | // Expressions: 'a', 'a + b.Length', '(a + b.Length)', '(a + b.Length) > 0.var' 26 | [NotNull, ItemNotNull] 27 | public IList AllExpressions 28 | { 29 | get { return myAllExpressions ?? (myAllExpressions = new List(GetAllExpressionContexts())); } 30 | } 31 | 32 | [NotNull, ItemNotNull] 33 | protected abstract IEnumerable GetAllExpressionContexts(); 34 | 35 | public virtual bool IsSemanticallyMakeSence() 36 | { 37 | return true; 38 | } 39 | 40 | internal DocumentRange ToDocumentRange(ITreeNode node) 41 | { 42 | return ExecutionContext.GetDocumentRange(node); 43 | } 44 | 45 | public bool IsPreciseMode 46 | { 47 | get { return ExecutionContext.IsPreciseMode; } 48 | } 49 | 50 | [NotNull] 51 | public virtual PostfixExpressionContext FixExpression([NotNull] PostfixExpressionContext context) 52 | { 53 | return context; 54 | } 55 | } 56 | } -------------------------------------------------------------------------------- /PostfixTemplates/Infrastructure/Contexts/PostfixTemplateExecutionContext.cs: -------------------------------------------------------------------------------- 1 | using JetBrains.Annotations; 2 | using JetBrains.Application.Settings; 3 | using JetBrains.DocumentModel; 4 | using JetBrains.ProjectModel; 5 | using JetBrains.ReSharper.Feature.Services.LiveTemplates.LiveTemplates; 6 | using JetBrains.ReSharper.Feature.Services.Lookup; 7 | using JetBrains.ReSharper.Psi.Tree; 8 | using JetBrains.TextControl; 9 | 10 | namespace JetBrains.ReSharper.PostfixTemplates.Contexts 11 | { 12 | [PublicAPI] 13 | public class PostfixTemplateExecutionContext 14 | { 15 | public PostfixTemplateExecutionContext( 16 | [NotNull] ISolution solution, [NotNull] ITextControl textControl, [NotNull] IContextBoundSettingsStore settingsStore, 17 | [NotNull] string reparseString, bool isPreciseMode) 18 | { 19 | Solution = solution; 20 | TextControl = textControl; 21 | SettingsStore = settingsStore; 22 | ReparseString = reparseString; 23 | IsPreciseMode = isPreciseMode; 24 | } 25 | 26 | public bool IsPreciseMode { get; internal set; } 27 | 28 | [NotNull] public ISolution Solution { get; private set; } 29 | [NotNull] public ITextControl TextControl { get; private set; } 30 | 31 | [NotNull] public IContextBoundSettingsStore SettingsStore { get; private set; } 32 | 33 | [NotNull] public LiveTemplatesManager LiveTemplatesManager 34 | { 35 | get { return Solution.GetComponent(); } 36 | } 37 | 38 | [NotNull] public ILookupItemsOwner LookupItemsOwner 39 | { 40 | get 41 | { 42 | var factory = Solution.GetComponent(); 43 | return factory.CreateLookupItemsOwner(TextControl); 44 | } 45 | } 46 | 47 | [NotNull] public string ReparseString { get; private set; } 48 | 49 | public virtual DocumentRange GetDocumentRange(ITreeNode treeNode) 50 | { 51 | return treeNode.GetDocumentRange(); 52 | } 53 | } 54 | } -------------------------------------------------------------------------------- /PostfixTemplates/Infrastructure/IPostfixTemplateMetadata.cs: -------------------------------------------------------------------------------- 1 | using JetBrains.Annotations; 2 | 3 | namespace JetBrains.ReSharper.PostfixTemplates 4 | { 5 | public interface IPostfixTemplateMetadata 6 | { 7 | [NotNull] PostfixTemplateAttribute Metadata { get; } 8 | [NotNull] string SettingsKey { get; } 9 | } 10 | } -------------------------------------------------------------------------------- /PostfixTemplates/Infrastructure/IPostfixTemplatesManager.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using JetBrains.Annotations; 3 | using JetBrains.ReSharper.PostfixTemplates.Contexts; 4 | using JetBrains.TextControl; 5 | using JetBrains.Util; 6 | 7 | namespace JetBrains.ReSharper.PostfixTemplates 8 | { 9 | // todo: who else can use this? 10 | // todo: what is the relation between this and IPostfixTemplateContextFactory 11 | 12 | public interface IPostfixTemplatesManager 13 | { 14 | [NotNull, ItemNotNull] IEnumerable AvailableTemplates { get; } 15 | 16 | bool IsTemplateAvailableByName([NotNull] PostfixTemplateContext context, [NotNull] string templateName); 17 | void ExecuteTemplateByName([NotNull] PostfixTemplateContext context, [NotNull] string templateName, ITextControl textControl, TextRange nameRange); 18 | } 19 | } -------------------------------------------------------------------------------- /PostfixTemplates/Infrastructure/PostfixTemplateAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using JetBrains.Annotations; 3 | using JetBrains.Application; 4 | using JetBrains.ReSharper.PostfixTemplates.Templates; 5 | 6 | namespace JetBrains.ReSharper.PostfixTemplates 7 | { 8 | [AttributeUsage(AttributeTargets.Class), MeansImplicitUse] 9 | [BaseTypeRequired(typeof(IPostfixTemplate<>))] 10 | [UsedImplicitly(ImplicitUseTargetFlags.WithMembers)] 11 | public sealed class PostfixTemplateAttribute : ShellComponentAttribute 12 | { 13 | public PostfixTemplateAttribute([NotNull] string templateName, [NotNull] string description, [CanBeNull] string example = null) 14 | { 15 | TemplateName = templateName; 16 | Description = description; 17 | Example = example ?? string.Empty; 18 | } 19 | 20 | [NotNull] public string TemplateName { get; private set; } 21 | [NotNull] public string Description { get; private set; } 22 | [NotNull] public string Example { get; private set; } 23 | 24 | public bool DisabledByDefault { get; set; } 25 | } 26 | } -------------------------------------------------------------------------------- /PostfixTemplates/Infrastructure/PostfixTemplateTarget.cs: -------------------------------------------------------------------------------- 1 | namespace JetBrains.ReSharper.PostfixTemplates.CodeCompletion 2 | { 3 | 4 | } -------------------------------------------------------------------------------- /PostfixTemplates/LookupItems/PostfixTemplateMatcher.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | using JetBrains.Annotations; 4 | using JetBrains.ReSharper.Feature.Services.CodeCompletion.Infrastructure.AspectLookupItems.BaseInfrastructure; 5 | using JetBrains.ReSharper.Feature.Services.CodeCompletion.Infrastructure.LookupItems; 6 | using JetBrains.ReSharper.Feature.Services.CodeCompletion.Infrastructure.Match; 7 | using JetBrains.ReSharper.PostfixTemplates.LookupItems; 8 | using JetBrains.TextControl; 9 | 10 | namespace JetBrains.ReSharper.PostfixTemplates.CodeCompletion 11 | { 12 | public class PostfixTemplateMatcher : LookupItemAspect, ILookupItemMatcher 13 | { 14 | public PostfixTemplateMatcher([NotNull] PostfixTemplateInfo info) : base(info) { } 15 | 16 | public bool IgnoreSoftOnSpace 17 | { 18 | get { return false; } 19 | set { throw new InvalidOperationException(); } 20 | } 21 | 22 | public MatchingResult Match(PrefixMatcher prefixMatcher, ITextControl textControl) 23 | { 24 | var text = Info.Shortcut; 25 | if (text == null) return new MatchingResult(); 26 | 27 | if (text == "forEach") 28 | { 29 | var hackPrefix = HackPrefix(prefixMatcher.Prefix); 30 | if (hackPrefix != null) 31 | { 32 | var matcher = prefixMatcher.Factory.CreatePrefixMatcher(hackPrefix, prefixMatcher.IdentifierMatchingStyle); 33 | 34 | var result = matcher.Matcher(text); 35 | if (result == null) return null; 36 | 37 | return new MatchingResult( 38 | result.HighlightedRanges.Where(x => x < 3), 39 | //result.MostLikelyContinuation, 40 | null, 41 | result.AdjustedScore > 0 ? result.AdjustedScore * 2 : result.AdjustedScore / 2, 42 | result.OriginalScore); 43 | } 44 | } 45 | 46 | return prefixMatcher.Matcher(text); 47 | } 48 | 49 | [CanBeNull] private static string HackPrefix([NotNull] string prefix) 50 | { 51 | if (prefix.Length > 0 && prefix.Length <= 3 && 52 | prefix.Equals("for".Substring(0, prefix.Length), StringComparison.OrdinalIgnoreCase)) 53 | { 54 | return prefix + "Each"; 55 | } 56 | 57 | return null; 58 | } 59 | } 60 | } -------------------------------------------------------------------------------- /PostfixTemplates/LookupItems/PostfixTemplatePresentation.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using JetBrains.Annotations; 3 | using JetBrains.ReSharper.Feature.Services.CodeCompletion.Infrastructure.AspectLookupItems.BaseInfrastructure; 4 | using JetBrains.ReSharper.Feature.Services.Resources; 5 | using JetBrains.ReSharper.PostfixTemplates.LookupItems; 6 | using JetBrains.TextControl; 7 | using JetBrains.UI.Icons; 8 | using JetBrains.UI.RichText; 9 | using JetBrains.Util; 10 | 11 | namespace JetBrains.ReSharper.PostfixTemplates.CodeCompletion 12 | { 13 | // todo: maybe do text.ToLowerCase() here, to support 'notNull' and 'forEach' 14 | // todo: aspect? 15 | 16 | public class PostfixTemplatePresentation : ILookupItemPresentation 17 | { 18 | [NotNull] private readonly RichText myDisplayName; 19 | [CanBeNull] private RichText myDisplayTypeName; 20 | 21 | public PostfixTemplatePresentation([NotNull] RichText displayName) 22 | { 23 | myDisplayName = displayName; 24 | } 25 | 26 | public PostfixTemplatePresentation([NotNull] PostfixTemplateInfo info) 27 | { 28 | myDisplayName = info.Text.ToLowerInvariant(); 29 | } 30 | 31 | public TextRange GetVisualReplaceRange(ITextControl textControl, TextRange nameRange) 32 | { 33 | return TextRange.InvalidRange; 34 | } 35 | 36 | public IconId Image 37 | { 38 | get { return ServicesThemedIcons.LiveTemplate.Id; } 39 | } 40 | 41 | public RichText DisplayName { get { return myDisplayName; } } 42 | 43 | public RichText DisplayTypeName 44 | { 45 | get { return myDisplayTypeName ?? RichText.Empty; } 46 | set { myDisplayTypeName = value; } 47 | } 48 | 49 | public bool CanShrink { get { return false; } } 50 | 51 | public bool Shrink() 52 | { 53 | throw new InvalidOperationException(); 54 | } 55 | 56 | public void Unshrink() 57 | { 58 | throw new InvalidOperationException(); 59 | } 60 | } 61 | } -------------------------------------------------------------------------------- /PostfixTemplates/PostfixTemplates.R91.csproj.DotSettings: -------------------------------------------------------------------------------- 1 |  2 | True 3 | True 4 | True 5 | True 6 | True -------------------------------------------------------------------------------- /PostfixTemplates/PostfixTemplates.R92.csproj.DotSettings: -------------------------------------------------------------------------------- 1 |  2 | False 3 | True 4 | True 5 | True 6 | False 7 | True -------------------------------------------------------------------------------- /PostfixTemplates/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/controlflow/resharper-postfix/b239a0a68702901d9b6bd636ff9df0985749a6ed/PostfixTemplates/Properties/AssemblyInfo.cs -------------------------------------------------------------------------------- /PostfixTemplates/Settings/CodeCompletionSettingsAccessor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq.Expressions; 3 | using JetBrains.ReSharper.Feature.Services.CodeCompletion; 4 | using JetBrains.ReSharper.Feature.Services.CodeCompletion.Settings; 5 | 6 | namespace JetBrains.ReSharper.PostfixTemplates.Settings 7 | { 8 | // todo: [R#] check we can get rid of this in R# source code 9 | public static class CodeCompletionSettingsAccessor 10 | { 11 | public readonly static Expression> 12 | ParenthesesInsertType = x => x.ParenthesesInsertType; 13 | } 14 | } -------------------------------------------------------------------------------- /PostfixTemplates/Settings/PostfixOptionsPage.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | using System.Windows.Input; 3 | using JetBrains.Annotations; 4 | using JetBrains.DataFlow; 5 | using JetBrains.ReSharper.Feature.Services.Resources; 6 | using JetBrains.UI.CrossFramework; 7 | using JetBrains.UI.Options; 8 | using JetBrains.UI.Options.OptionPages; 9 | 10 | namespace JetBrains.ReSharper.PostfixTemplates.Settings 11 | { 12 | // todo: [R#] support settings page search somehow :\ 13 | 14 | [OptionsPage( 15 | id: PID, name: "Postfix Templates", 16 | typeofIcon: typeof(ServicesThemedIcons.SurroundTemplate), 17 | ParentId = EnvironmentPage.Pid)] 18 | public sealed partial class PostfixOptionsPage : IOptionsPage 19 | { 20 | // ReSharper disable once InconsistentNaming 21 | private const string PID = "PostfixTemplates"; 22 | 23 | public PostfixOptionsPage([NotNull] Lifetime lifetime, [NotNull] OptionsSettingsSmartContext settingsSmart) 24 | { 25 | InitializeComponent(); 26 | 27 | DataContext = new PostfixOptionsViewModel(lifetime, settingsSmart); 28 | Control = this; 29 | } 30 | 31 | public EitherControl Control { get; private set; } 32 | public string Id { get { return PID; } } 33 | public bool OnOk() { return true; } 34 | public bool ValidatePage() { return true; } 35 | 36 | private void DoubleClickCheck(object sender, RoutedEventArgs e) 37 | { 38 | var viewModel = ((FrameworkElement) sender).DataContext as PostfixTemplateViewModel; 39 | if (viewModel != null) 40 | { 41 | viewModel.IsChecked = !viewModel.IsChecked; 42 | } 43 | } 44 | 45 | private void SpaceBarCheck(object sender, KeyEventArgs e) 46 | { 47 | if (e.Key != Key.Space) return; 48 | 49 | var viewModel = ((FrameworkElement)sender).DataContext as PostfixTemplateViewModel; 50 | if (viewModel != null) 51 | { 52 | viewModel.IsChecked = !viewModel.IsChecked; 53 | } 54 | } 55 | } 56 | } -------------------------------------------------------------------------------- /PostfixTemplates/Settings/PostfixTemplateViewModel.cs: -------------------------------------------------------------------------------- 1 | using JetBrains.Annotations; 2 | using JetBrains.Application.Settings; 3 | using JetBrains.UI.Avalon.TreeListView; 4 | using JetBrains.UI.Options; 5 | 6 | namespace JetBrains.ReSharper.PostfixTemplates.Settings 7 | { 8 | public sealed class PostfixTemplateViewModel : ObservableObject 9 | { 10 | [NotNull] private readonly IPostfixTemplateMetadata myMetadata; 11 | [NotNull] private readonly PostfixTemplateAttribute myTemplateAttribute; 12 | [NotNull] private readonly OptionsSettingsSmartContext mySettingsStore; 13 | private bool myIsChecked; 14 | 15 | public PostfixTemplateViewModel([NotNull] IPostfixTemplateMetadata metadata, [NotNull] OptionsSettingsSmartContext settingsStore) 16 | { 17 | myMetadata = metadata; 18 | mySettingsStore = settingsStore; 19 | myTemplateAttribute = myMetadata.Metadata; 20 | 21 | var settings = mySettingsStore.GetKey(SettingsOptimization.OptimizeDefault); 22 | myIsChecked = settings.DisabledProviders.GetIndexedValue(metadata.SettingsKey, !metadata.Metadata.DisabledByDefault); 23 | } 24 | 25 | [NotNull] public string TemplateName { get { return "." + myTemplateAttribute.TemplateName.ToLowerInvariant(); } } 26 | [NotNull] public string Description { get { return myTemplateAttribute.Description; } } 27 | [NotNull] public string Example { get { return myTemplateAttribute.Example; } } 28 | 29 | public bool IsChecked 30 | { 31 | get { return myIsChecked; } 32 | set 33 | { 34 | if (value == myIsChecked) return; 35 | 36 | myIsChecked = value; 37 | OnPropertyChanged("IsChecked"); 38 | 39 | var settingsKey = myMetadata.SettingsKey; 40 | var disabledProviders = PostfixTemplatesSettingsAccessor.DisabledProviders; 41 | 42 | if (myIsChecked == myTemplateAttribute.DisabledByDefault) 43 | mySettingsStore.SetIndexedValue(disabledProviders, settingsKey, myIsChecked); 44 | else 45 | mySettingsStore.RemoveIndexedValue(disabledProviders, settingsKey); 46 | } 47 | } 48 | } 49 | } -------------------------------------------------------------------------------- /PostfixTemplates/Templates/CSharp/CheckIsNullTemplate.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using JetBrains.ReSharper.PostfixTemplates.Contexts.CSharp; 3 | using JetBrains.ReSharper.PostfixTemplates.LookupItems; 4 | 5 | namespace JetBrains.ReSharper.PostfixTemplates.Templates.CSharp 6 | { 7 | [PostfixTemplate( 8 | templateName: "null", 9 | description: "Checks expression to be null", 10 | example: "if (expr == null)")] 11 | public class CheckIsNullTemplate : CheckForNullTemplateBase 12 | { 13 | protected override CheckForNullPostfixTemplateInfo TryCreateInfo(CSharpPostfixTemplateContext context) 14 | { 15 | var outerExpression = context.OuterExpression; 16 | if (outerExpression != null && outerExpression.CanBeStatement) 17 | { 18 | if (IsNullable(outerExpression)) 19 | { 20 | if (context.IsPreciseMode && !MakeSenseToCheckInPreciseMode(outerExpression)) 21 | return null; // reduce noise 22 | 23 | return new CheckForNullPostfixTemplateInfo( 24 | "null", outerExpression, checkNotNull: false, target: PostfixTemplateTarget.Statement); 25 | } 26 | } 27 | else if (!context.IsPreciseMode) 28 | { 29 | var nullableExpressions = new List(); 30 | foreach (var expressionContext in context.Expressions) 31 | { 32 | if (IsNullable(expressionContext)) 33 | nullableExpressions.Add(expressionContext); 34 | } 35 | 36 | if (nullableExpressions.Count > 0) 37 | { 38 | nullableExpressions.Reverse(); 39 | 40 | return new CheckForNullPostfixTemplateInfo( 41 | "null", nullableExpressions, checkNotNull: false, target: PostfixTemplateTarget.Expression); 42 | } 43 | } 44 | 45 | return null; 46 | } 47 | } 48 | } -------------------------------------------------------------------------------- /PostfixTemplates/Templates/CSharp/CheckNotNullTemplate.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using JetBrains.ReSharper.PostfixTemplates.Contexts.CSharp; 3 | using JetBrains.ReSharper.PostfixTemplates.LookupItems; 4 | 5 | namespace JetBrains.ReSharper.PostfixTemplates.Templates.CSharp 6 | { 7 | [PostfixTemplate( 8 | templateName: "notnull", 9 | description: "Checks expression to be not-null", 10 | example: "if (expr != null)")] 11 | public class CheckNotNullTemplate : CheckForNullTemplateBase 12 | { 13 | protected override CheckForNullPostfixTemplateInfo TryCreateInfo(CSharpPostfixTemplateContext context) 14 | { 15 | var outerExpression = context.OuterExpression; 16 | if (outerExpression != null && outerExpression.CanBeStatement) 17 | { 18 | if (IsNullable(outerExpression)) 19 | { 20 | if (context.IsPreciseMode && !MakeSenseToCheckInPreciseMode(outerExpression)) 21 | return null; // reduce noise 22 | 23 | return new CheckForNullPostfixTemplateInfo( 24 | "notNull", outerExpression, checkNotNull: true, target: PostfixTemplateTarget.Statement); 25 | } 26 | } 27 | else if (!context.IsPreciseMode) 28 | { 29 | var nullableExpressions = new List(); 30 | foreach (var expressionContext in context.Expressions) 31 | { 32 | if (IsNullable(expressionContext)) 33 | nullableExpressions.Add(expressionContext); 34 | } 35 | 36 | if (nullableExpressions.Count > 0) 37 | { 38 | nullableExpressions.Reverse(); 39 | 40 | return new CheckForNullPostfixTemplateInfo( 41 | "notNull", nullableExpressions, checkNotNull: true, target: PostfixTemplateTarget.Expression); 42 | } 43 | } 44 | 45 | return null; 46 | } 47 | } 48 | } -------------------------------------------------------------------------------- /PostfixTemplates/Templates/CSharp/ElseStatementTemplate.cs: -------------------------------------------------------------------------------- 1 | using JetBrains.Annotations; 2 | using JetBrains.ReSharper.PostfixTemplates.CodeCompletion; 3 | using JetBrains.ReSharper.PostfixTemplates.Contexts.CSharp; 4 | using JetBrains.ReSharper.PostfixTemplates.LookupItems; 5 | using JetBrains.ReSharper.Psi.CSharp; 6 | using JetBrains.ReSharper.Psi.CSharp.Tree; 7 | using JetBrains.ReSharper.Psi.CSharp.Util; 8 | using JetBrains.Util; 9 | 10 | namespace JetBrains.ReSharper.PostfixTemplates.Templates.CSharp 11 | { 12 | [PostfixTemplate( 13 | templateName: "else", 14 | description: "Checks boolean expression to be 'false'", 15 | example: "if (!expr)")] 16 | public class ElseStatementTemplate : BooleanExpressionTemplateBase 17 | { 18 | protected override PostfixTemplateInfo TryCreateBooleanInfo(CSharpPostfixExpressionContext expression) 19 | { 20 | if (expression.CanBeStatement) 21 | { 22 | return new PostfixTemplateInfo("else", expression); 23 | } 24 | 25 | return null; 26 | } 27 | 28 | public override PostfixTemplateBehavior CreateBehavior(PostfixTemplateInfo info) 29 | { 30 | return new CSharpPostfixInvertedIfStatementBehavior(info); 31 | } 32 | 33 | private sealed class CSharpPostfixInvertedIfStatementBehavior : CSharpStatementPostfixTemplateBehavior 34 | { 35 | public CSharpPostfixInvertedIfStatementBehavior([NotNull] PostfixTemplateInfo info) : base(info) { } 36 | 37 | protected override IIfStatement CreateStatement(CSharpElementFactory factory, ICSharpExpression expression) 38 | { 39 | var template = "if($0)" + EmbeddedStatementBracesTemplate; 40 | var statement = (IIfStatement) factory.CreateStatement(template, expression); 41 | 42 | var negated = CSharpExpressionUtil.CreateLogicallyNegatedExpression(statement.Condition); 43 | statement.Condition.ReplaceBy(negated.NotNull()); 44 | 45 | return statement; 46 | } 47 | } 48 | } 49 | } -------------------------------------------------------------------------------- /PostfixTemplates/Templates/CSharp/ForLoopTemplate.cs: -------------------------------------------------------------------------------- 1 | using JetBrains.Annotations; 2 | using JetBrains.ReSharper.Feature.Services.LiveTemplates.LiveTemplates; 3 | using JetBrains.ReSharper.PostfixTemplates.CodeCompletion; 4 | using JetBrains.ReSharper.PostfixTemplates.Contexts.CSharp; 5 | using JetBrains.ReSharper.PostfixTemplates.LookupItems; 6 | using JetBrains.ReSharper.Psi.CSharp; 7 | using JetBrains.ReSharper.Psi.CSharp.Tree; 8 | using JetBrains.Util; 9 | 10 | namespace JetBrains.ReSharper.PostfixTemplates.Templates.CSharp 11 | { 12 | // todo: apply var code style in R# 9.0 13 | 14 | [PostfixTemplate( 15 | templateName: "for", 16 | description: "Iterates over collection with index", 17 | example: "for (var i = 0; i < xs.Length; i++)")] 18 | public class ForLoopTemplate : ForLoopTemplateBase 19 | { 20 | public override PostfixTemplateInfo TryCreateInfo(CSharpPostfixTemplateContext context) 21 | { 22 | string lengthName; 23 | if (!CanBeLoopedOver(context, out lengthName)) return null; 24 | 25 | var expressionContext = context.InnerExpression; 26 | if (expressionContext == null) return null; 27 | 28 | return new ForLoopPostfixTemplateInfo("for", expressionContext, lengthName); 29 | } 30 | 31 | protected override PostfixTemplateBehavior CreateBehavior(ForLoopPostfixTemplateInfo info) 32 | { 33 | return new CSharpForLoopStatementBehavior(info); 34 | } 35 | 36 | private sealed class CSharpForLoopStatementBehavior : CSharpForLoopStatementBehaviorBase 37 | { 38 | public CSharpForLoopStatementBehavior([NotNull] ForLoopPostfixTemplateInfo info) : base(info) { } 39 | 40 | protected override IForStatement CreateStatement(CSharpElementFactory factory, ICSharpExpression expression) 41 | { 42 | var template = "for(var x=0;x<$0;x++)" + EmbeddedStatementBracesTemplate; 43 | var forStatement = (IForStatement) factory.CreateStatement(template, expression); 44 | 45 | var condition = (IRelationalExpression) forStatement.Condition; 46 | if (LengthName == null) 47 | { 48 | condition.RightOperand.ReplaceBy(expression); 49 | } 50 | else 51 | { 52 | var lengthAccess = factory.CreateReferenceExpression("expr.$0", LengthName); 53 | lengthAccess = condition.RightOperand.ReplaceBy(lengthAccess); 54 | lengthAccess.QualifierExpression.NotNull().ReplaceBy(expression); 55 | } 56 | 57 | return forStatement; 58 | } 59 | } 60 | } 61 | } -------------------------------------------------------------------------------- /PostfixTemplates/Templates/CSharp/IfStatementTemplate.cs: -------------------------------------------------------------------------------- 1 | using JetBrains.Annotations; 2 | using JetBrains.ReSharper.PostfixTemplates.CodeCompletion; 3 | using JetBrains.ReSharper.PostfixTemplates.Contexts.CSharp; 4 | using JetBrains.ReSharper.PostfixTemplates.LookupItems; 5 | using JetBrains.ReSharper.Psi.CSharp; 6 | using JetBrains.ReSharper.Psi.CSharp.Tree; 7 | 8 | namespace JetBrains.ReSharper.PostfixTemplates.Templates.CSharp 9 | { 10 | [PostfixTemplate( 11 | templateName: "if", 12 | description: "Checks boolean expression to be 'true'", 13 | example: "if (expr)")] 14 | public sealed class IfStatementTemplate : BooleanExpressionTemplateBase 15 | { 16 | protected override PostfixTemplateInfo TryCreateBooleanInfo(CSharpPostfixExpressionContext expression) 17 | { 18 | if (expression.CanBeStatement) 19 | { 20 | return new PostfixTemplateInfo("if", expression); 21 | } 22 | 23 | return null; 24 | } 25 | 26 | public override PostfixTemplateBehavior CreateBehavior(PostfixTemplateInfo info) 27 | { 28 | return new CSharpPostfixIfStatementBehavior(info); 29 | } 30 | 31 | private sealed class CSharpPostfixIfStatementBehavior : CSharpStatementPostfixTemplateBehavior 32 | { 33 | public CSharpPostfixIfStatementBehavior([NotNull] PostfixTemplateInfo info) : base(info) { } 34 | 35 | protected override IIfStatement CreateStatement(CSharpElementFactory factory, ICSharpExpression expression) 36 | { 37 | // automatically fix 'as'-expression to became 'is'-expression 38 | var asExpression = expression as IAsExpression; 39 | if (asExpression != null && asExpression.TypeOperand != null && asExpression.Operand != null) 40 | { 41 | expression = factory.CreateExpression("$0 is $1", asExpression.Operand, asExpression.TypeOperand); 42 | } 43 | 44 | var template = "if($0)" + EmbeddedStatementBracesTemplate; 45 | return (IIfStatement) factory.CreateStatement(template, expression); 46 | } 47 | } 48 | } 49 | } -------------------------------------------------------------------------------- /PostfixTemplates/Templates/CSharp/IntroduceFieldTemplate.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | using JetBrains.Annotations; 4 | using JetBrains.ReSharper.PostfixTemplates.LookupItems; 5 | using JetBrains.ReSharper.Psi; 6 | using JetBrains.ReSharper.Psi.CSharp; 7 | using JetBrains.ReSharper.Psi.CSharp.Tree; 8 | 9 | namespace JetBrains.ReSharper.PostfixTemplates.Templates.CSharp 10 | { 11 | [PostfixTemplate( 12 | templateName: "field", 13 | description: "Introduces field for expression", 14 | example: "_field = expr;")] 15 | public class IntroduceFieldTemplate : IntroduceMemberTemplateBase 16 | { 17 | public override string TemplateName { get { return "field"; } } 18 | 19 | protected override PostfixTemplateBehavior CreateBehavior(IntroduceMemberPostfixTemplateInfo info) 20 | { 21 | return new CSharpPostfixIntroduceFieldBehaviorBase(info); 22 | } 23 | 24 | private sealed class CSharpPostfixIntroduceFieldBehaviorBase : CSharpPostfixIntroduceMemberBehaviorBase 25 | { 26 | public CSharpPostfixIntroduceFieldBehaviorBase([NotNull] IntroduceMemberPostfixTemplateInfo info) : base(info) { } 27 | 28 | protected override IClassMemberDeclaration CreateMemberDeclaration(CSharpElementFactory factory) 29 | { 30 | var declaration = factory.CreateFieldDeclaration(ExpressionType, "__"); 31 | declaration.SetStatic(IsStatic); 32 | 33 | return declaration; 34 | } 35 | 36 | protected override ICSharpTypeMemberDeclaration GetAnchorMember(IList members) 37 | { 38 | return members.LastOrDefault(member => member.DeclaredElement is IField && member.IsStatic == IsStatic); 39 | } 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /PostfixTemplates/Templates/CSharp/LockStatementTemplate.cs: -------------------------------------------------------------------------------- 1 | using JetBrains.Annotations; 2 | using JetBrains.ReSharper.PostfixTemplates.CodeCompletion; 3 | using JetBrains.ReSharper.PostfixTemplates.Contexts.CSharp; 4 | using JetBrains.ReSharper.PostfixTemplates.LookupItems; 5 | using JetBrains.ReSharper.Psi; 6 | using JetBrains.ReSharper.Psi.CSharp; 7 | using JetBrains.ReSharper.Psi.CSharp.Tree; 8 | 9 | namespace JetBrains.ReSharper.PostfixTemplates.Templates.CSharp 10 | { 11 | [PostfixTemplate( 12 | templateName: "lock", 13 | description: "Surrounds expression with lock block", 14 | example: "lock (expr)")] 15 | public class LockStatementTemplate : IPostfixTemplate 16 | { 17 | public PostfixTemplateInfo TryCreateInfo(CSharpPostfixTemplateContext context) 18 | { 19 | var expressionContext = context.OuterExpression; 20 | if (expressionContext == null || !expressionContext.CanBeStatement) return null; 21 | 22 | var expressionType = expressionContext.Type; 23 | 24 | if (context.IsPreciseMode) 25 | { 26 | if (expressionType.IsUnknown || !expressionType.IsObject()) return null; 27 | } 28 | else 29 | { 30 | if (expressionType.Classify == TypeClassification.VALUE_TYPE) return null; 31 | } 32 | 33 | return new PostfixTemplateInfo("lock", expressionContext); 34 | } 35 | 36 | public PostfixTemplateBehavior CreateBehavior(PostfixTemplateInfo info) 37 | { 38 | return new CSharpPostfixLockStatementBehavior(info); 39 | } 40 | 41 | private sealed class CSharpPostfixLockStatementBehavior : CSharpStatementPostfixTemplateBehavior 42 | { 43 | public CSharpPostfixLockStatementBehavior([NotNull] PostfixTemplateInfo info) : base(info) { } 44 | 45 | protected override ILockStatement CreateStatement(CSharpElementFactory factory, ICSharpExpression expression) 46 | { 47 | var template = "lock($0)" + EmbeddedStatementBracesTemplate; 48 | return (ILockStatement) factory.CreateStatement(template, expression); 49 | } 50 | } 51 | } 52 | } -------------------------------------------------------------------------------- /PostfixTemplates/Templates/CSharp/ParseStringTemplate.cs: -------------------------------------------------------------------------------- 1 | namespace JetBrains.ReSharper.PostfixTemplates.Templates.CSharp 2 | { 3 | [PostfixTemplate( 4 | templateName: "parse", 5 | description: "Parses string as value of some type", 6 | example: "int.Parse(expr)")] 7 | public class ParseStringTemplate : ParseStringTemplateBase 8 | { 9 | public override string TemplateName { get { return "parse"; } } 10 | public override bool IsTryParse { get { return false; } } 11 | } 12 | } -------------------------------------------------------------------------------- /PostfixTemplates/Templates/CSharp/SelectExpressionTemplate.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | using JetBrains.Annotations; 3 | using JetBrains.ReSharper.PostfixTemplates.CodeCompletion; 4 | using JetBrains.ReSharper.PostfixTemplates.Contexts.CSharp; 5 | using JetBrains.ReSharper.PostfixTemplates.LookupItems; 6 | using JetBrains.ReSharper.Psi.CSharp; 7 | using JetBrains.ReSharper.Psi.CSharp.Tree; 8 | using JetBrains.ReSharper.Psi.Tree; 9 | using JetBrains.TextControl; 10 | 11 | namespace JetBrains.ReSharper.PostfixTemplates.Templates.CSharp 12 | { 13 | [PostfixTemplate( 14 | templateName: "sel", 15 | description: "Selects expression in editor", 16 | example: "|selected + expression|")] 17 | public class SelectExpressionTemplate : IPostfixTemplate 18 | { 19 | public PostfixTemplateInfo TryCreateInfo(CSharpPostfixTemplateContext context) 20 | { 21 | if (context.IsPreciseMode) return null; 22 | 23 | var expressions = context.Expressions.Reverse().ToArray(); 24 | if (expressions.Length == 0) return null; 25 | 26 | return new PostfixTemplateInfo("sel", expressions); 27 | } 28 | 29 | public PostfixTemplateBehavior CreateBehavior(PostfixTemplateInfo info) 30 | { 31 | return new CSharpPostfixSelectExpressionBehavior(info); 32 | } 33 | 34 | private sealed class CSharpPostfixSelectExpressionBehavior : CSharpExpressionPostfixTemplateBehavior 35 | { 36 | public CSharpPostfixSelectExpressionBehavior([NotNull] PostfixTemplateInfo info) : base(info) { } 37 | 38 | protected override ICSharpExpression CreateExpression(CSharpElementFactory factory, ICSharpExpression expression) 39 | { 40 | return expression; 41 | } 42 | 43 | protected override void AfterComplete(ITextControl textControl, ICSharpExpression expression) 44 | { 45 | var expressionRange = expression.GetDocumentRange().TextRange; 46 | textControl.Selection.SetRange(expressionRange); 47 | } 48 | } 49 | } 50 | } -------------------------------------------------------------------------------- /PostfixTemplates/Templates/CSharp/TryParseStringTemplate.cs: -------------------------------------------------------------------------------- 1 | namespace JetBrains.ReSharper.PostfixTemplates.Templates.CSharp 2 | { 3 | [PostfixTemplate( 4 | templateName: "tryparse", 5 | description: "Parses string as value of some type", 6 | example: "int.TryParse(expr, out value)")] 7 | public class TryParseStringTemplate : ParseStringTemplateBase 8 | { 9 | public override string TemplateName { get { return "tryParse"; } } 10 | public override bool IsTryParse { get { return true; } } 11 | } 12 | } -------------------------------------------------------------------------------- /PostfixTemplates/Templates/CSharp/TypeOfExpressionTemplate.cs: -------------------------------------------------------------------------------- 1 | using JetBrains.Annotations; 2 | using JetBrains.ReSharper.PostfixTemplates.CodeCompletion; 3 | using JetBrains.ReSharper.PostfixTemplates.Contexts.CSharp; 4 | using JetBrains.ReSharper.PostfixTemplates.LookupItems; 5 | using JetBrains.ReSharper.Psi; 6 | using JetBrains.ReSharper.Psi.CSharp; 7 | using JetBrains.ReSharper.Psi.CSharp.Tree; 8 | 9 | namespace JetBrains.ReSharper.PostfixTemplates.Templates.CSharp 10 | { 11 | [PostfixTemplate( 12 | templateName: "typeof", 13 | description: "Wraps type usage with typeof() expression", 14 | example: "typeof(TExpr)")] 15 | public class TypeOfExpressionTemplate : IPostfixTemplate 16 | { 17 | public PostfixTemplateInfo TryCreateInfo(CSharpPostfixTemplateContext context) 18 | { 19 | var typeExpression = context.TypeExpression; 20 | if (typeExpression == null) return null; 21 | 22 | var typeElement = typeExpression.ReferencedElement as ITypeElement; 23 | if (typeElement == null) return null; 24 | 25 | return new PostfixTemplateInfo("typeof", typeExpression); 26 | } 27 | 28 | public PostfixTemplateBehavior CreateBehavior(PostfixTemplateInfo info) 29 | { 30 | return new CSharpPostfixTypeOfExpressionBehavior(info); 31 | } 32 | 33 | private sealed class CSharpPostfixTypeOfExpressionBehavior : CSharpExpressionPostfixTemplateBehavior 34 | { 35 | public CSharpPostfixTypeOfExpressionBehavior([NotNull] PostfixTemplateInfo info) : base(info) { } 36 | 37 | protected override ITypeofExpression CreateExpression(CSharpElementFactory factory, ICSharpExpression expression) 38 | { 39 | var template = "typeof(" + expression.GetText() + ")"; 40 | return (ITypeofExpression) factory.CreateExpressionAsIs(template); 41 | } 42 | } 43 | } 44 | } -------------------------------------------------------------------------------- /PostfixTemplates/Templates/CSharp/WhileLoopTemplate.cs: -------------------------------------------------------------------------------- 1 | using JetBrains.Annotations; 2 | using JetBrains.ReSharper.PostfixTemplates.CodeCompletion; 3 | using JetBrains.ReSharper.PostfixTemplates.Contexts.CSharp; 4 | using JetBrains.ReSharper.PostfixTemplates.LookupItems; 5 | using JetBrains.ReSharper.Psi.CSharp; 6 | using JetBrains.ReSharper.Psi.CSharp.Tree; 7 | 8 | namespace JetBrains.ReSharper.PostfixTemplates.Templates.CSharp 9 | { 10 | [PostfixTemplate( 11 | templateName: "while", 12 | description: "Iterating while boolean statement is 'true'", 13 | example: "while (expr)")] 14 | public sealed class WhileLoopTemplate : BooleanExpressionTemplateBase 15 | { 16 | protected override PostfixTemplateInfo TryCreateBooleanInfo(CSharpPostfixExpressionContext expression) 17 | { 18 | if (expression.CanBeStatement) 19 | { 20 | return new PostfixTemplateInfo("while", expression); 21 | } 22 | 23 | return null; 24 | } 25 | 26 | public override PostfixTemplateBehavior CreateBehavior(PostfixTemplateInfo info) 27 | { 28 | return new CSharpPostfixWhileStatementBehavior(info); 29 | } 30 | 31 | private sealed class CSharpPostfixWhileStatementBehavior : CSharpStatementPostfixTemplateBehavior 32 | { 33 | public CSharpPostfixWhileStatementBehavior([NotNull] PostfixTemplateInfo info) : base(info) { } 34 | 35 | protected override IWhileStatement CreateStatement(CSharpElementFactory factory, ICSharpExpression expression) 36 | { 37 | var template = "while($0)" + EmbeddedStatementBracesTemplate; 38 | return (IWhileStatement) factory.CreateStatement(template, expression); 39 | } 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /PostfixTemplates/Templates/IPostfixTemplate.cs: -------------------------------------------------------------------------------- 1 | using JetBrains.Annotations; 2 | using JetBrains.ReSharper.PostfixTemplates.Contexts; 3 | using JetBrains.ReSharper.PostfixTemplates.LookupItems; 4 | 5 | namespace JetBrains.ReSharper.PostfixTemplates.Templates 6 | { 7 | public interface IPostfixTemplate 8 | where TPostfixTemplateContext : PostfixTemplateContext 9 | { 10 | [CanBeNull] PostfixTemplateInfo TryCreateInfo([NotNull] TPostfixTemplateContext context); 11 | [NotNull] PostfixTemplateBehavior CreateBehavior([NotNull] PostfixTemplateInfo info); 12 | } 13 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Completion/PostfixRazorTest.cs: -------------------------------------------------------------------------------- 1 | using JetBrains.ProjectModel; 2 | using JetBrains.ReSharper.TestFramework; 3 | using NUnit.Framework; 4 | 5 | namespace JetBrains.ReSharper.PostfixTemplates.Completion 6 | { 7 | [TestNetFramework4] 8 | [TestFileExtension(RazorCSharpProjectFileType.RazorCSharpExtension)] 9 | public class PostfixRazorTest : PostfixCodeCompletionTestBase 10 | { 11 | protected override string RelativeTestDataPath { get { return @"Razor"; } } 12 | 13 | [Test] public void TestRazor01() { DoNamedTest("Model.cs"); } 14 | [Test] public void TestRazor02() { DoNamedTest("Model.cs"); } 15 | [Test] public void TestRazor03() { DoNamedTest("Model.cs"); } 16 | [Test] public void TestRazor04() { DoNamedTest("Model.cs"); } 17 | [Test] public void TestRazor05() { DoNamedTest("Model.cs"); } 18 | [Test] public void TestRazor06() { DoNamedTest("Model.cs"); } 19 | [Test] public void TestRazor07() { DoNamedTest("Model.cs"); } 20 | [Test] public void TestRazor08() { DoNamedTest("Model.cs"); } 21 | [Test] public void TestRazor09() { DoNamedTest("Model.cs"); } 22 | [Test] public void TestRazor10() { DoNamedTest("Model.cs"); } 23 | } 24 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/CompletionList/PostfixExtraMembersListTest.cs: -------------------------------------------------------------------------------- 1 | using JetBrains.ReSharper.TestFramework; 2 | using NUnit.Framework; 3 | 4 | namespace JetBrains.ReSharper.PostfixTemplates.CompletionList 5 | { 6 | [TestNetFramework4] 7 | public class PostfixExtraMembersListTest : PostfixCodeCompletionListTestBase 8 | { 9 | protected override string RelativeTestDataPath { get { return @"Extra\List"; } } 10 | 11 | [Test] public void TestStatic01() { DoNamedTest(); } 12 | [Test] public void TestStatic02() { DoNamedTest(); } 13 | [Test] public void TestStatic03() { DoNamedTest(); } 14 | 15 | [Test] public void TestEnum01() { DoNamedTest(); } 16 | [Test] public void TestEnum02() { DoNamedTest(); } 17 | [Test] public void TestEnum03() { DoNamedTest(); } 18 | } 19 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/CompletionList/PostfixTemplatesListTest.cs: -------------------------------------------------------------------------------- 1 | using JetBrains.ReSharper.TestFramework; 2 | using NUnit.Framework; 3 | 4 | namespace JetBrains.ReSharper.PostfixTemplates.CompletionList 5 | { 6 | [TestNetFramework4] 7 | public class PostfixTemplatesListTest : PostfixCodeCompletionListTestBase 8 | { 9 | protected override string RelativeTestDataPath { get { return @"List"; } } 10 | 11 | [Test] public void TestIf01() { DoNamedTest(); } 12 | [Test] public void TestIf02() { DoNamedTest(); } 13 | [Test] public void TestIf03() { DoNamedTest(); } 14 | 15 | [Test] public void TestNamespace01() { DoNamedTest(); } 16 | 17 | [Test] public void TestUnresolved01() { DoNamedTest(); } 18 | [Test] public void TestUnresolved02() { DoNamedTest(); } 19 | [Test] public void TestUnresolved03() { DoNamedTest(); } 20 | [Test] public void TestUnresolved04() { DoNamedTest(); } 21 | [Test] public void TestUnresolved05() { DoNamedTest(); } 22 | 23 | [Test] public void TestType01() { DoNamedTest(); } 24 | [Test] public void TestType02() { DoNamedTest(); } 25 | [Test] public void TestType03() { DoNamedTest(); } 26 | [Test] public void TestType04() { DoNamedTest(); } 27 | [Test] public void TestType05() { DoNamedTest(); } 28 | 29 | [Test] public void TestVar01() { DoNamedTest(); } 30 | [Test] public void TestVar02() { DoNamedTest(); } 31 | 32 | [Test] public void TestNew01() { DoNamedTest(); } 33 | [Test] public void TestNew02() { DoNamedTest(); } 34 | 35 | [Test] public void TestSwitch01() { DoNamedTest(); } 36 | 37 | [Test] public void TestThis01() { DoNamedTest(); } 38 | 39 | [Test] public void TestBase01() { DoNamedTest(); } 40 | 41 | [Test] public void TestBoolean01() { DoNamedTest(); } 42 | [Test] public void TestBoolean02() { DoNamedTest(); } 43 | [Test] public void TestBoolean03() { DoNamedTest(); } 44 | 45 | [Test] public void TestAssignment01() { DoNamedTest(); } 46 | [Test] public void TestAssignment02() { DoNamedTest(); } 47 | 48 | [Test] public void TestYield01() { DoNamedTest(); } 49 | 50 | [Test] public void TestAwait01() { DoNamedTest(); } 51 | [Test] public void TestAwait02() { DoNamedTest(); } 52 | } 53 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Components/TestExpressionChooser.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using JetBrains.ActionManagement; 4 | using JetBrains.Annotations; 5 | using JetBrains.Application; 6 | using JetBrains.DataFlow; 7 | using JetBrains.ReSharper.PostfixTemplates.Contexts; 8 | using JetBrains.TextControl; 9 | using JetBrains.TextControl.DocumentMarkup; 10 | using JetBrains.Threading; 11 | using JetBrains.UI.PopupMenu; 12 | #if RESHARPER92 13 | using JetBrains.Application.Threading; 14 | #endif 15 | 16 | namespace JetBrains.ReSharper.PostfixTemplates.Components 17 | { 18 | [ShellComponent] 19 | public sealed class TestExpressionChooser : ExpressionChooser 20 | { 21 | public TestExpressionChooser([NotNull] JetPopupMenus popupMenus, [NotNull] ShellLocks shellLocks, 22 | [NotNull] IActionManager actionManager, [NotNull] IThreading threading, 23 | [NotNull] IDocumentMarkupManager markupManager) 24 | : base(popupMenus, shellLocks, actionManager, threading, markupManager) { } 25 | 26 | public override void Execute(Lifetime lifetime, ITextControl textControl, 27 | IList expressions, string postfixText, 28 | string chooserTitle, Action continuation) 29 | { 30 | continuation(0); 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Extra/List/TestEnum01.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:Bar} 2 | 3 | using System; 4 | 5 | [Flags] public enum CoolFlags 6 | { 7 | None, Foo, Bar, Boo 8 | } 9 | 10 | class Foo 11 | { 12 | CoolFlags CoolFlags; 13 | 14 | void Bar() 15 | { 16 | CoolFlags.{caret} 17 | Bar(); 18 | } 19 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Extra/List/TestEnum01.cs.gold: -------------------------------------------------------------------------------- 1 | # 29 ITEMS # 2 | 3 | + Bar 4 | + Boo 5 | + CompareTo 6 | + Equals 7 | + Foo 8 | + GetHashCode 9 | + GetType 10 | + GetTypeCode 11 | + HasFlag 12 | + None 13 | + ToString 14 | + TryParse 15 | + arg 16 | + await 17 | + cast 18 | + else 19 | + foreach 20 | + if 21 | + not 22 | + par 23 | + return 24 | + sel 25 | + switch 26 | + throw 27 | + to 28 | + using 29 | + var 30 | + while 31 | + yield 32 | # AUTOMATIC # 33 | # 14 ITEMS # 34 | 35 | + Bar 36 | + Boo 37 | + CompareTo 38 | + Equals 39 | + Foo 40 | + GetHashCode 41 | + GetType 42 | + GetTypeCode 43 | + HasFlag 44 | + None 45 | + ToString 46 | + TryParse 47 | + switch 48 | + var 49 | -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Extra/List/TestEnum02.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:Bar} 2 | 3 | using System; 4 | 5 | [Flags] public enum CoolFlags 6 | { 7 | None, Foo, Bar, Boo 8 | } 9 | 10 | class Foo 11 | { 12 | CoolFlags? CoolFlags; 13 | 14 | void Bar() 15 | { 16 | CoolFlags.{caret} 17 | Bar(); 18 | } 19 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Extra/List/TestEnum02.cs.gold: -------------------------------------------------------------------------------- 1 | # 30 ITEMS # 2 | 3 | + Equals 4 | + GetHashCode 5 | + GetType 6 | + GetValueOrDefault 7 | + HasValue 8 | + ToString 9 | + Value 10 | + None 11 | + Foo 12 | + Bar 13 | + Boo 14 | + arg 15 | + await 16 | + cast 17 | + else 18 | + foreach 19 | + if 20 | + not 21 | + notnull 22 | + null 23 | + par 24 | + return 25 | + sel 26 | + switch 27 | + throw 28 | + to 29 | + using 30 | + var 31 | + while 32 | + yield 33 | # AUTOMATIC # 34 | # 15 ITEMS # 35 | 36 | + Equals 37 | + GetHashCode 38 | + GetType 39 | + GetValueOrDefault 40 | + HasValue 41 | + ToString 42 | + Value 43 | + None 44 | + Foo 45 | + Bar 46 | + Boo 47 | + notnull 48 | + null 49 | + switch 50 | + var 51 | -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Extra/List/TestEnum03.cs: -------------------------------------------------------------------------------- 1 | [System.Flags] 2 | public enum CoolFlags 3 | { 4 | None, 5 | Foo = 1 << 1, 6 | Bar = 1 << 2, 7 | Boo = Foo | Bar 8 | } 9 | 10 | class Foo 11 | { 12 | bool M(CoolFlags cf) => cf?.{caret} 13 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Extra/List/TestEnum03.cs.gold: -------------------------------------------------------------------------------- 1 | # 15 ITEMS # 2 | 3 | CompareTo 4 | + Equals 5 | GetHashCode 6 | GetType 7 | GetTypeCode 8 | + HasFlag 9 | ToString 10 | arg 11 | await 12 | cast 13 | foreach 14 | not 15 | par 16 | sel 17 | var 18 | # AUTOMATIC # 19 | # 7 ITEMS # 20 | 21 | CompareTo 22 | + Equals 23 | GetHashCode 24 | GetType 25 | GetTypeCode 26 | + HasFlag 27 | ToString 28 | -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Extra/List/TestStatic01.cs: -------------------------------------------------------------------------------- 1 | public class Foo 2 | { 3 | public void Bar(string personName) 4 | { 5 | personName.{caret} 6 | } 7 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Extra/List/TestStatic01.cs.gold: -------------------------------------------------------------------------------- 1 | # 71 ITEMS # 2 | 3 | + Clone 4 | + Compare 5 | + CompareOrdinal 6 | + CompareTo 7 | + Concat 8 | + Contains 9 | + Copy 10 | + CopyTo 11 | + Count 12 | + EndsWith 13 | + Equals 14 | + Equals 15 | + Format 16 | + GetEnumerator 17 | + GetHashCode 18 | + GetType 19 | + GetTypeCode 20 | + IndexOf 21 | + IndexOfAny 22 | + Insert 23 | + Intern 24 | + IsInterned 25 | + IsNormalized 26 | + IsNullOrEmpty 27 | + IsNullOrWhiteSpace 28 | + Join 29 | + LastIndexOf 30 | + LastIndexOfAny 31 | + Length 32 | + Normalize 33 | + PadLeft 34 | + PadRight 35 | + Remove 36 | + Replace 37 | + Split 38 | + StartsWith 39 | + Substring 40 | + ToCharArray 41 | + ToLower 42 | + ToLowerInvariant 43 | + ToString 44 | + ToUpper 45 | + ToUpperInvariant 46 | + Trim 47 | + TrimEnd 48 | + TrimStart 49 | + [] 50 | + arg 51 | + await 52 | + cast 53 | + else 54 | + field 55 | + foreach 56 | + if 57 | + lock 58 | + not 59 | + notnull 60 | + null 61 | + par 62 | + parse 63 | + prop 64 | + return 65 | + sel 66 | + switch 67 | + throw 68 | + to 69 | + tryparse 70 | + using 71 | + var 72 | + while 73 | + yield 74 | # AUTOMATIC # 75 | # 53 ITEMS # 76 | 77 | + Clone 78 | + Compare 79 | + CompareOrdinal 80 | + CompareTo 81 | + Concat 82 | + Contains 83 | + Copy 84 | + CopyTo 85 | + Count 86 | + EndsWith 87 | + Equals 88 | + Equals 89 | + Format 90 | + GetEnumerator 91 | + GetHashCode 92 | + GetType 93 | + GetTypeCode 94 | + IndexOf 95 | + IndexOfAny 96 | + Insert 97 | + Intern 98 | + IsInterned 99 | + IsNormalized 100 | + IsNullOrEmpty 101 | + IsNullOrWhiteSpace 102 | + Join 103 | + LastIndexOf 104 | + LastIndexOfAny 105 | + Length 106 | + Normalize 107 | + PadLeft 108 | + PadRight 109 | + Remove 110 | + Replace 111 | + Split 112 | + StartsWith 113 | + Substring 114 | + ToCharArray 115 | + ToLower 116 | + ToLowerInvariant 117 | + ToString 118 | + ToUpper 119 | + ToUpperInvariant 120 | + Trim 121 | + TrimEnd 122 | + TrimStart 123 | + [] 124 | + foreach 125 | + notnull 126 | + null 127 | + parse 128 | + switch 129 | + tryparse 130 | -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Extra/List/TestStatic02.cs: -------------------------------------------------------------------------------- 1 | class Base 2 | { 3 | public static void SingleFooArg(A foo) { } 4 | public static void BaseMethod(A foo) { } 5 | } 6 | 7 | class A : Base 8 | { 9 | public static void NoArgs() { } 10 | public static void SingleIntArg(int a) { } 11 | public new static void SingleFooArg(A foo) { } 12 | public static void FooArgOverloaded(A foo) { } 13 | public static void FooArgOverloaded(A foo, A bar) { } 14 | public static void FooArgOverloaded(A foo, A bar, int i) { } 15 | public static void TwoFooArg(A foo, A bar) { } 16 | } 17 | 18 | class Foo 19 | { 20 | void Bar(A foo) 21 | { 22 | foo.{caret} 23 | } 24 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Extra/List/TestStatic02.cs.gold: -------------------------------------------------------------------------------- 1 | # 30 ITEMS # 2 | 3 | + BaseMethod 4 | + Equals 5 | + FooArgOverloaded 6 | + GetHashCode 7 | + GetType 8 | + SingleFooArg 9 | + ToString 10 | + TwoFooArg 11 | + arg 12 | + await 13 | + cast 14 | + else 15 | + field 16 | + foreach 17 | + if 18 | + lock 19 | + not 20 | + notnull 21 | + null 22 | + par 23 | + prop 24 | + return 25 | + sel 26 | + switch 27 | + throw 28 | + to 29 | + using 30 | + var 31 | + while 32 | + yield 33 | # AUTOMATIC # 34 | # 10 ITEMS # 35 | 36 | + BaseMethod 37 | + Equals 38 | + FooArgOverloaded 39 | + GetHashCode 40 | + GetType 41 | + SingleFooArg 42 | + ToString 43 | + TwoFooArg 44 | + notnull 45 | + null 46 | -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Extra/List/TestStatic03.cs: -------------------------------------------------------------------------------- 1 | using System.Threading; 2 | 3 | class Foo 4 | { 5 | void Bar() 6 | { 7 | Thread.CurrentThread.{caret} 8 | } 9 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Extra/List/TestStatic03.cs.gold: -------------------------------------------------------------------------------- 1 | # 49 ITEMS # 2 | 3 | + Abort 4 | + ApartmentState 5 | + CurrentCulture 6 | + CurrentUICulture 7 | + DisableComObjectEagerCleanup 8 | + Equals 9 | + ExecutionContext 10 | + GetApartmentState 11 | + GetCompressedStack 12 | + GetHashCode 13 | + GetType 14 | + Interrupt 15 | + IsAlive 16 | + IsBackground 17 | + IsThreadPoolThread 18 | + Join 19 | + ManagedThreadId 20 | + Name 21 | + Priority 22 | + Resume 23 | + SetApartmentState 24 | + SetCompressedStack 25 | + Start 26 | + Suspend 27 | + ThreadState 28 | + ToString 29 | + TrySetApartmentState 30 | + arg 31 | + await 32 | + cast 33 | + else 34 | + field 35 | + foreach 36 | + if 37 | + lock 38 | + not 39 | + notnull 40 | + null 41 | + par 42 | + prop 43 | + return 44 | + sel 45 | + switch 46 | + throw 47 | + to 48 | + using 49 | + var 50 | + while 51 | + yield 52 | # AUTOMATIC # 53 | # 30 ITEMS # 54 | 55 | + Abort 56 | + ApartmentState 57 | + CurrentCulture 58 | + CurrentUICulture 59 | + DisableComObjectEagerCleanup 60 | + Equals 61 | + ExecutionContext 62 | + GetApartmentState 63 | + GetCompressedStack 64 | + GetHashCode 65 | + GetType 66 | + Interrupt 67 | + IsAlive 68 | + IsBackground 69 | + IsThreadPoolThread 70 | + Join 71 | + ManagedThreadId 72 | + Name 73 | + Priority 74 | + Resume 75 | + SetApartmentState 76 | + SetCompressedStack 77 | + Start 78 | + Suspend 79 | + ThreadState 80 | + ToString 81 | + TrySetApartmentState 82 | + notnull 83 | + null 84 | + var 85 | -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Extra/TestCount01.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:Count} 2 | 3 | using System; 4 | 5 | class A { 6 | public void M(int[] xs) { 7 | xs.Co{caret} 8 | } 9 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Extra/TestCount01.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:Count} 2 | 3 | using System; 4 | 5 | class A { 6 | public void M(int[] xs) { 7 | xs.Length{caret} 8 | } 9 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Extra/TestCount02.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:Count} 2 | 3 | using System; 4 | 5 | class A { 6 | public void M(Array xs) { 7 | xs.Co{caret} 8 | } 9 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Extra/TestCount02.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:Count} 2 | 3 | using System; 4 | 5 | class A { 6 | public void M(Array xs) { 7 | xs.Length{caret} 8 | } 9 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Extra/TestCount03.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:Count} 2 | 3 | using System; 4 | using System.Text; 5 | 6 | class A { 7 | public void M(StringBuilder xs) { 8 | xs.Co{caret} 9 | } 10 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Extra/TestCount03.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:Count} 2 | 3 | using System; 4 | using System.Text; 5 | 6 | class A { 7 | public void M(StringBuilder xs) { 8 | xs.Length{caret} 9 | } 10 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Extra/TestCount04.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:Count} 2 | 3 | class A { 4 | public void M(string s) { 5 | s.{caret} 6 | } 7 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Extra/TestCount04.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:Count} 2 | 3 | class A { 4 | public void M(string s) { 5 | s.Length{caret} 6 | } 7 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Extra/TestEnum01.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:Foo} 2 | 3 | using System; 4 | 5 | class A 6 | { 7 | [Flags] 8 | public enum CoolFlags : ulong 9 | { 10 | None = 0, 11 | 12 | Foo = 1 << 0, 13 | Bar = 1 << 1, 14 | Boo = 1 << 2, 15 | 16 | All = Foo | Bar | Boo 17 | } 18 | } 19 | 20 | class ReallyCoolObject 21 | { 22 | public A.CoolFlags SomeProperty { get; set; } 23 | } 24 | 25 | class Foo 26 | { 27 | void Bar(ReallyCoolObject obj) 28 | { 29 | obj.SomeProperty.{caret} 30 | } 31 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Extra/TestEnum01.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:Foo} 2 | 3 | using System; 4 | 5 | class A 6 | { 7 | [Flags] 8 | public enum CoolFlags : ulong 9 | { 10 | None = 0, 11 | 12 | Foo = 1 << 0, 13 | Bar = 1 << 1, 14 | Boo = 1 << 2, 15 | 16 | All = Foo | Bar | Boo 17 | } 18 | } 19 | 20 | class ReallyCoolObject 21 | { 22 | public A.CoolFlags SomeProperty { get; set; } 23 | } 24 | 25 | class Foo 26 | { 27 | void Bar(ReallyCoolObject obj) 28 | { 29 | (obj.SomeProperty & A.CoolFlags.Foo) != 0{caret} 30 | } 31 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Extra/TestEnum02.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:None} 2 | 3 | using System; 4 | 5 | class A 6 | { 7 | [Flags] 8 | public enum CoolFlags : ulong 9 | { 10 | None = 0, 11 | 12 | Foo = 1 << 0, 13 | Bar = 1 << 1, 14 | Boo = 1 << 2, 15 | 16 | All = Foo | Bar | Boo 17 | } 18 | } 19 | 20 | class ReallyCoolObject 21 | { 22 | public A.CoolFlags SomeProperty { get; set; } 23 | } 24 | 25 | class Foo 26 | { 27 | void Bar(ReallyCoolObject obj) 28 | { 29 | obj.SomeProperty.{caret} 30 | } 31 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Extra/TestEnum02.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:None} 2 | 3 | using System; 4 | 5 | class A 6 | { 7 | [Flags] 8 | public enum CoolFlags : ulong 9 | { 10 | None = 0, 11 | 12 | Foo = 1 << 0, 13 | Bar = 1 << 1, 14 | Boo = 1 << 2, 15 | 16 | All = Foo | Bar | Boo 17 | } 18 | } 19 | 20 | class ReallyCoolObject 21 | { 22 | public A.CoolFlags SomeProperty { get; set; } 23 | } 24 | 25 | class Foo 26 | { 27 | void Bar(ReallyCoolObject obj) 28 | { 29 | obj.SomeProperty == A.CoolFlags.None{caret} 30 | } 31 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Extra/TestEnum03.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:Bar} 2 | 3 | using System; 4 | 5 | class A 6 | { 7 | [Flags] 8 | public enum CoolFlags : ulong 9 | { 10 | None = 0, 11 | 12 | Foo = 1 << 0, 13 | Bar = 1 << 1, 14 | Boo = 1 << 2, 15 | 16 | All = Foo | Bar | Boo 17 | } 18 | } 19 | 20 | class ReallyCoolObject 21 | { 22 | public A.CoolFlags SomeProperty { get; set; } 23 | } 24 | 25 | class Foo 26 | { 27 | void Bar(ReallyCoolObject obj) 28 | { 29 | obj.SomeProperty.{caret} 30 | var t = Foo1.Bar2(); 31 | } 32 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Extra/TestEnum03.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:Bar} 2 | 3 | using System; 4 | 5 | class A 6 | { 7 | [Flags] 8 | public enum CoolFlags : ulong 9 | { 10 | None = 0, 11 | 12 | Foo = 1 << 0, 13 | Bar = 1 << 1, 14 | Boo = 1 << 2, 15 | 16 | All = Foo | Bar | Boo 17 | } 18 | } 19 | 20 | class ReallyCoolObject 21 | { 22 | public A.CoolFlags SomeProperty { get; set; } 23 | } 24 | 25 | class Foo 26 | { 27 | void Bar(ReallyCoolObject obj) 28 | { 29 | (obj.SomeProperty & A.CoolFlags.Bar) != 0{caret} 30 | var t = Foo1.Bar2(); 31 | } 32 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Extra/TestEnum04.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:Bar} 2 | 3 | using System; 4 | 5 | public enum CoolFlags 6 | { 7 | None, Foo, Bar, Boo 8 | } 9 | 10 | class Foo 11 | { 12 | CoolFlags? myFoo; 13 | 14 | void Bar() 15 | { 16 | myFoo.{caret} 17 | Bar(); 18 | } 19 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Extra/TestEnum04.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:Bar} 2 | 3 | using System; 4 | 5 | public enum CoolFlags 6 | { 7 | None, Foo, Bar, Boo 8 | } 9 | 10 | class Foo 11 | { 12 | CoolFlags? myFoo; 13 | 14 | void Bar() 15 | { 16 | myFoo == CoolFlags.Bar{caret} 17 | Bar(); 18 | } 19 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Extra/TestEnum05.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:None} 2 | 3 | [System.Flags] 4 | public enum CoolFlags 5 | { 6 | None, 7 | Foo = 1 << 1, 8 | Bar = 1 << 2, 9 | Boo = Foo | Bar 10 | } 11 | 12 | class Foo 13 | { 14 | bool M(CoolFlags cf) => cf.{caret} 15 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Extra/TestEnum05.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:None} 2 | 3 | [System.Flags] 4 | public enum CoolFlags 5 | { 6 | None, 7 | Foo = 1 << 1, 8 | Bar = 1 << 2, 9 | Boo = Foo | Bar 10 | } 11 | 12 | class Foo 13 | { 14 | bool M(CoolFlags cf) => cf == CoolFlags.None{caret} 15 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Extra/TestEnum06.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:Boo} 2 | 3 | [System.Flags] 4 | public enum CoolFlags 5 | { 6 | None, 7 | Foo = 1 << 1, 8 | Bar = 1 << 2, 9 | Boo = Foo | Bar 10 | } 11 | 12 | class Foo 13 | { 14 | bool M(CoolFlags cf) => cf.{caret} 15 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Extra/TestEnum06.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:Boo} 2 | 3 | [System.Flags] 4 | public enum CoolFlags 5 | { 6 | None, 7 | Foo = 1 << 1, 8 | Bar = 1 << 2, 9 | Boo = Foo | Bar 10 | } 11 | 12 | class Foo 13 | { 14 | bool M(CoolFlags cf) => (cf & CoolFlags.Boo) != CoolFlags.Boo{caret} 15 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Extra/TestEnum07.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:Foo} 2 | 3 | [System.Flags] 4 | public enum CoolFlags 5 | { 6 | None, 7 | Foo = 1 << 1, 8 | Bar = 1 << 2, 9 | Boo = Foo | Bar 10 | } 11 | 12 | class Foo 13 | { 14 | public CoolFlags MyFlags; 15 | public bool M(Foo foo) => foo?.MyFlags.{caret} 16 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Extra/TestEnum07.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:Foo} 2 | 3 | [System.Flags] 4 | public enum CoolFlags 5 | { 6 | None, 7 | Foo = 1 << 1, 8 | Bar = 1 << 2, 9 | Boo = Foo | Bar 10 | } 11 | 12 | class Foo 13 | { 14 | public CoolFlags MyFlags; 15 | public bool M(Foo foo) => (foo?.MyFlags & CoolFlags.Foo) != 0{caret} 16 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Extra/TestEnum08.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:Bar} 2 | 3 | class Generic 4 | { 5 | public enum CoolFlags 6 | { 7 | None, 8 | Foo, 9 | Bar 10 | } 11 | } 12 | 13 | class Foo 14 | { 15 | public Generic.CoolFlags MyFlags; 16 | public bool M(Foo foo) => foo?.MyFlags.{caret} 17 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Extra/TestEnum08.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:Bar} 2 | 3 | class Generic 4 | { 5 | public enum CoolFlags 6 | { 7 | None, 8 | Foo, 9 | Bar 10 | } 11 | } 12 | 13 | class Foo 14 | { 15 | public Generic.CoolFlags MyFlags; 16 | public bool M(Foo foo) => foo?.MyFlags == Generic.CoolFlags.Bar{caret} 17 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Extra/TestLength01.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:Length} 2 | 3 | using System; 4 | using System.Collections.Generic; 5 | 6 | class A { 7 | public void M(List xs) { 8 | xs.Len{caret} 9 | } 10 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Extra/TestLength01.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:Length} 2 | 3 | using System; 4 | using System.Collections.Generic; 5 | 6 | class A { 7 | public void M(List xs) { 8 | xs.Count{caret} 9 | } 10 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Extra/TestLength02.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:Length} 2 | 3 | using System; 4 | using System.Collections.Generic; 5 | 6 | class A { 7 | public void M(Dictionary xs) { 8 | xs.Length{caret} 9 | } 10 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Extra/TestLength02.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:Length} 2 | 3 | using System; 4 | using System.Collections.Generic; 5 | 6 | class A { 7 | public void M(Dictionary xs) { 8 | xs.Count{caret} 9 | } 10 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Extra/TestStatic01.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:IsNullOrEmpty} 2 | 3 | public class Foo 4 | { 5 | public void Bar(string personName) 6 | { 7 | personName.{caret} 8 | } 9 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Extra/TestStatic01.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:IsNullOrEmpty} 2 | 3 | using System; 4 | 5 | public class Foo 6 | { 7 | public void Bar(string personName) 8 | { 9 | string.IsNullOrEmpty(personName){caret} 10 | } 11 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Extra/TestStatic02.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:TwoFooArg} 2 | 3 | class Base 4 | { 5 | public static void SingleFooArg(A foo) { } 6 | public static void BaseMethod(A foo) { } 7 | } 8 | 9 | class A : Base 10 | { 11 | public static void NoArgs() { } 12 | public static void SingleIntArg(int a) { } 13 | public new static void SingleFooArg(A foo) { } 14 | public static void FooArgOverloaded(A foo) { } 15 | public static void FooArgOverloaded(A foo, A bar) { } 16 | public static void FooArgOverloaded(A foo, A bar, int i) { } 17 | public static void TwoFooArg(A foo, A bar) { } 18 | } 19 | 20 | class Foo 21 | { 22 | void Bar(A foo) 23 | { 24 | foo.{caret} 25 | } 26 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Extra/TestStatic02.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:TwoFooArg} 2 | 3 | class Base 4 | { 5 | public static void SingleFooArg(A foo) { } 6 | public static void BaseMethod(A foo) { } 7 | } 8 | 9 | class A : Base 10 | { 11 | public static void NoArgs() { } 12 | public static void SingleIntArg(int a) { } 13 | public new static void SingleFooArg(A foo) { } 14 | public static void FooArgOverloaded(A foo) { } 15 | public static void FooArgOverloaded(A foo, A bar) { } 16 | public static void FooArgOverloaded(A foo, A bar, int i) { } 17 | public static void TwoFooArg(A foo, A bar) { } 18 | } 19 | 20 | class Foo 21 | { 22 | void Bar(A foo) 23 | { 24 | A.TwoFooArg(foo, {caret}); 25 | } 26 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Extra/TestStatic03.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:BaseMethod} 2 | 3 | class Base 4 | { 5 | public static void SingleFooArg(A foo) { } 6 | public static void BaseMethod(A foo) { } 7 | } 8 | 9 | class A : Base 10 | { 11 | public static void NoArgs() { } 12 | public static void SingleIntArg(int a) { } 13 | public new static void SingleFooArg(A foo) { } 14 | public static void FooArgOverloaded(A foo) { } 15 | public static void FooArgOverloaded(A foo, A bar) { } 16 | public static void FooArgOverloaded(A foo, A bar, int i) { } 17 | public static void TwoFooArg(A foo, A bar) { } 18 | } 19 | 20 | class Foo 21 | { 22 | void Bar(A foo) 23 | { 24 | foo.{caret} 25 | } 26 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Extra/TestStatic03.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:BaseMethod} 2 | 3 | class Base 4 | { 5 | public static void SingleFooArg(A foo) { } 6 | public static void BaseMethod(A foo) { } 7 | } 8 | 9 | class A : Base 10 | { 11 | public static void NoArgs() { } 12 | public static void SingleIntArg(int a) { } 13 | public new static void SingleFooArg(A foo) { } 14 | public static void FooArgOverloaded(A foo) { } 15 | public static void FooArgOverloaded(A foo, A bar) { } 16 | public static void FooArgOverloaded(A foo, A bar, int i) { } 17 | public static void TwoFooArg(A foo, A bar) { } 18 | } 19 | 20 | class Foo 21 | { 22 | void Bar(A foo) 23 | { 24 | Base.BaseMethod(foo){caret}; 25 | } 26 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Extra/TestStatic04.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:FooArgOverloaded} 2 | 3 | class Base 4 | { 5 | public static void SingleFooArg(A foo) { } 6 | public static void BaseMethod(A foo) { } 7 | } 8 | 9 | class A : Base 10 | { 11 | public static void NoArgs() { } 12 | public static void SingleIntArg(int a) { } 13 | public new static void SingleFooArg(A foo) { } 14 | public static void FooArgOverloaded(A foo) { } 15 | public static void FooArgOverloaded(A foo, A bar) { } 16 | public static void FooArgOverloaded(A foo, A bar, int i) { } 17 | public static void TwoFooArg(A foo, A bar) { } 18 | } 19 | 20 | class Foo 21 | { 22 | void Bar(A foo) 23 | { 24 | foo.{caret} 25 | } 26 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Extra/TestStatic04.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:FooArgOverloaded} 2 | 3 | class Base 4 | { 5 | public static void SingleFooArg(A foo) { } 6 | public static void BaseMethod(A foo) { } 7 | } 8 | 9 | class A : Base 10 | { 11 | public static void NoArgs() { } 12 | public static void SingleIntArg(int a) { } 13 | public new static void SingleFooArg(A foo) { } 14 | public static void FooArgOverloaded(A foo) { } 15 | public static void FooArgOverloaded(A foo, A bar) { } 16 | public static void FooArgOverloaded(A foo, A bar, int i) { } 17 | public static void TwoFooArg(A foo, A bar) { } 18 | } 19 | 20 | class Foo 21 | { 22 | void Bar(A foo) 23 | { 24 | A.FooArgOverloaded(foo{caret}); 25 | } 26 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Extra/TestStatic05.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:FooArgOverloaded} 2 | 3 | class Base 4 | { 5 | public static void SingleFooArg(A foo) { } 6 | public static void BaseMethod(A foo) { } 7 | } 8 | 9 | class A : Base 10 | { 11 | public static void NoArgs() { } 12 | public static void SingleIntArg(int a) { } 13 | public new static void SingleFooArg(A foo) { } 14 | public static void FooArgOverloaded(A foo) { } 15 | public static void FooArgOverloaded(A foo, A bar) { } 16 | public static void FooArgOverloaded(A foo, A bar, int i) { } 17 | public static void TwoFooArg(A foo, A bar) { } 18 | } 19 | 20 | class Foo 21 | { 22 | void Bar(A foo) 23 | { 24 | foo.{caret} 25 | Bar(foo); 26 | } 27 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Extra/TestStatic05.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:FooArgOverloaded} 2 | 3 | class Base 4 | { 5 | public static void SingleFooArg(A foo) { } 6 | public static void BaseMethod(A foo) { } 7 | } 8 | 9 | class A : Base 10 | { 11 | public static void NoArgs() { } 12 | public static void SingleIntArg(int a) { } 13 | public new static void SingleFooArg(A foo) { } 14 | public static void FooArgOverloaded(A foo) { } 15 | public static void FooArgOverloaded(A foo, A bar) { } 16 | public static void FooArgOverloaded(A foo, A bar, int i) { } 17 | public static void TwoFooArg(A foo, A bar) { } 18 | } 19 | 20 | class Foo 21 | { 22 | void Bar(A foo) 23 | { 24 | A.FooArgOverloaded(foo{caret}); 25 | Bar(foo); 26 | } 27 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Extra/TestStatic06.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:Synchronized} 2 | 3 | class Foo { 4 | public void M(System.Action f, System.IO.TextWriter writer, int[] xs) { 5 | f(() => { 6 | foreach (var x in xs) { 7 | var smth = x + 1; 8 | writer.syn{caret} 9 | } 10 | }); 11 | } 12 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Extra/TestStatic06.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:Synchronized} 2 | 3 | using System.IO; 4 | 5 | class Foo { 6 | public void M(System.Action f, System.IO.TextWriter writer, int[] xs) { 7 | f(() => { 8 | foreach (var x in xs) { 9 | var smth = x + 1; 10 | TextWriter.Synchronized(writer){caret} 11 | } 12 | }); 13 | } 14 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Extra/TestStatic07.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:IsNullOrEmpty} 2 | 3 | class Foo { 4 | public void M(System.Action f, string str, int[] xs) { 5 | f(() => { 6 | foreach (var x in xs) { 7 | var smth = x + 1; 8 | str.{caret} 9 | } 10 | }); 11 | } 12 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Extra/TestStatic07.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:IsNullOrEmpty} 2 | 3 | using System; 4 | 5 | class Foo { 6 | public void M(System.Action f, string str, int[] xs) { 7 | f(() => { 8 | foreach (var x in xs) { 9 | var smth = x + 1; 10 | string.IsNullOrEmpty(str){caret} 11 | } 12 | }); 13 | } 14 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Extra/TestStatic08.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:Bar} 2 | 3 | class Foo { 4 | static void Bar(ref T a) { } 5 | static void Main(string[] args) { 6 | var foo = new Foo(); 7 | foo.Bar{caret} 8 | } 9 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Extra/TestStatic08.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:Bar} 2 | 3 | class Foo { 4 | static void Bar(ref T a) { } 5 | static void Main(string[] args) { 6 | var foo = new Foo(); 7 | Bar(ref foo){caret}; 8 | } 9 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Extra/TestStatic09.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:Resize} 2 | 3 | class Foo { 4 | static void Main(string[] args) { 5 | args.Resiz{caret} 6 | } 7 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Extra/TestStatic09.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:Resize} 2 | 3 | using System; 4 | 5 | class Foo { 6 | static void Main(string[] args) { 7 | Array.Resize(ref args, {caret}); 8 | } 9 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Extra/TestStatic10.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:GetValues} 2 | 3 | class Foo { 4 | static void Main(string[] args) { 5 | SomeEnum.{caret} 6 | } 7 | } 8 | 9 | enum SomeEnum { 10 | CaseA, 11 | CaseB, 12 | OtherCase 13 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Extra/TestStatic10.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:GetValues} 2 | 3 | using System; 4 | 5 | class Foo { 6 | static void Main(string[] args) { 7 | Enum.GetValues(typeof(SomeEnum)){caret} 8 | } 9 | } 10 | 11 | enum SomeEnum { 12 | CaseA, 13 | CaseB, 14 | OtherCase 15 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Extra/TestStatic11.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:CompareOrdinal} 2 | 3 | class C { 4 | public int Compare(object l, object r) { 5 | return ((string)l).com{caret}((string)r); 6 | } 7 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Extra/TestStatic11.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:CompareOrdinal} 2 | 3 | using System; 4 | 5 | class C { 6 | public int Compare(object l, object r) { 7 | return string.CompareOrdinal(((string)l), (string)r{caret}); 8 | } 9 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Extra/TestStatic12.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:M} 2 | 3 | public class C { 4 | void Main() { 5 | this.m{caret}(12); 6 | } 7 | 8 | static void M(C c) { } 9 | static void M(C c, int x, int y) { } 10 | static void M(C c, string x) { } 11 | } 12 | -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Extra/TestStatic12.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:M} 2 | 3 | public class C { 4 | void Main() { 5 | M(this, 12{caret}); 6 | } 7 | 8 | static void M(C c) { } 9 | static void M(C c, int x, int y) { } 10 | static void M(C c, string x) { } 11 | } 12 | -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Extra/TestStatic13.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:M} 2 | 3 | public class C { 4 | void Main() { 5 | this.m{caret}(12); 6 | } 7 | 8 | static void M(C c) { } 9 | static void M(C c, int x) { } 10 | static void M(C c, string x) { } 11 | } 12 | -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Extra/TestStatic13.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:M} 2 | 3 | public class C { 4 | void Main() { 5 | M(this, 12){caret}; 6 | } 7 | 8 | static void M(C c) { } 9 | static void M(C c, int x) { } 10 | static void M(C c, string x) { } 11 | } 12 | -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Extra/TestStatic14.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:M} 2 | // ${PARENS:None} 3 | 4 | public class C { 5 | void Main() { 6 | this.m{caret}(12); 7 | } 8 | 9 | static void M(C c) { } 10 | static void M(C c, int x) { } 11 | static void M(C c, string x) { } 12 | } 13 | -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Extra/TestStatic14.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:M} 2 | // ${PARENS:None} 3 | 4 | public class C { 5 | void Main() { 6 | M(this, 12){caret}; 7 | } 8 | 9 | static void M(C c) { } 10 | static void M(C c, int x) { } 11 | static void M(C c, string x) { } 12 | } 13 | -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Extra/TestStatic15.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:M} 2 | // ${PARENS:Left} 3 | 4 | public class C { 5 | void Main() { 6 | this.m{caret}(12); 7 | } 8 | 9 | static void M(C c) { } 10 | static void M(C c, int x) { } 11 | static void M(C c, string x) { } 12 | } 13 | -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Extra/TestStatic15.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:M} 2 | // ${PARENS:Left} 3 | 4 | public class C { 5 | void Main() { 6 | M(this, 12){caret}; 7 | } 8 | 9 | static void M(C c) { } 10 | static void M(C c, int x) { } 11 | static void M(C c, string x) { } 12 | } 13 | -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Extra/TestStatic16.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:IsNullOrEmpty} 2 | // ${PARENS:None} 3 | 4 | public class Foo 5 | { 6 | public void Bar(string personName) 7 | { 8 | personName.{caret} 9 | } 10 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Extra/TestStatic16.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:IsNullOrEmpty} 2 | // ${PARENS:None} 3 | 4 | using System; 5 | 6 | public class Foo 7 | { 8 | public void Bar(string personName) 9 | { 10 | string.IsNullOrEmpty(personName){caret} 11 | } 12 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Extra/TestStatic17.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETION_TYPE:Insert} 2 | // ${COMPLETE_ITEM:IsNullOrEmpty} 3 | // ${PARENS:Left} 4 | 5 | public class Foo 6 | { 7 | public void Bar(string personName) 8 | { 9 | (personName).{caret} 10 | } 11 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Extra/TestStatic17.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETION_TYPE:Insert} 2 | // ${COMPLETE_ITEM:IsNullOrEmpty} 3 | // ${PARENS:Left} 4 | 5 | using System; 6 | 7 | public class Foo 8 | { 9 | public void Bar(string personName) 10 | { 11 | string.IsNullOrEmpty((personName){caret} 12 | } 13 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Extra/TestStatic18.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETION_TYPE:Insert} 2 | // ${COMPLETE_ITEM:ToArray} 3 | // ${PARENS:Left} 4 | 5 | class Foo 6 | { 7 | void M(Bar bar) 8 | { 9 | bar.toa{caret} 10 | } 11 | } 12 | 13 | class Bar 14 | { 15 | public static int[] ToArray(Bar bar) 16 | { 17 | return null; 18 | } 19 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Extra/TestStatic18.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETION_TYPE:Insert} 2 | // ${COMPLETE_ITEM:ToArray} 3 | // ${PARENS:Left} 4 | 5 | class Foo 6 | { 7 | void M(Bar bar) 8 | { 9 | Bar.ToArray(bar{caret} 10 | } 11 | } 12 | 13 | class Bar 14 | { 15 | public static int[] ToArray(Bar bar) 16 | { 17 | return null; 18 | } 19 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Extra/TestStatic19.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETION_TYPE:Insert} 2 | // ${COMPLETE_ITEM:ToArray} 3 | // ${PARENS:Left} 4 | 5 | class Foo 6 | { 7 | void M(Bar bar) 8 | { 9 | bar.toa{caret} 10 | } 11 | } 12 | 13 | class Bar 14 | { 15 | public static int[] ToArray(Bar bar, int x) 16 | { 17 | return null; 18 | } 19 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Extra/TestStatic19.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETION_TYPE:Insert} 2 | // ${COMPLETE_ITEM:ToArray} 3 | // ${PARENS:Left} 4 | 5 | class Foo 6 | { 7 | void M(Bar bar) 8 | { 9 | Bar.ToArray(bar, {caret} 10 | } 11 | } 12 | 13 | class Bar 14 | { 15 | public static int[] ToArray(Bar bar, int x) 16 | { 17 | return null; 18 | } 19 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Extra/TestStatic20.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETION_TYPE:Insert} 2 | // ${COMPLETE_ITEM:ToArray} 3 | // ${PARENS:Left} 4 | 5 | class Foo 6 | { 7 | void M(Bar bar) 8 | { 9 | bar.toa{caret} 10 | } 11 | } 12 | 13 | class Bar 14 | { 15 | public static int[] ToArray(Bar bar, int x) { return null; } 16 | public static int[] ToArray(Bar bar) { return null; } 17 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Extra/TestStatic20.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETION_TYPE:Insert} 2 | // ${COMPLETE_ITEM:ToArray} 3 | // ${PARENS:Left} 4 | 5 | class Foo 6 | { 7 | void M(Bar bar) 8 | { 9 | Bar.ToArray(bar{caret} 10 | } 11 | } 12 | 13 | class Bar 14 | { 15 | public static int[] ToArray(Bar bar, int x) { return null; } 16 | public static int[] ToArray(Bar bar) { return null; } 17 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Extra/TestStatic21.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETION_TYPE:Insert} 2 | // ${COMPLETE_ITEM:ToArray} 3 | // ${PARENS:Left} 4 | 5 | class Foo 6 | { 7 | void M(Bar bar) 8 | { 9 | bar.toa{caret} 10 | } 11 | } 12 | 13 | class Bar 14 | { 15 | public static int[] ToArray(Bar bar, int x) { return null; } 16 | public static int[] ToArray(Bar bar, string x) { return null; } 17 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Extra/TestStatic21.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETION_TYPE:Insert} 2 | // ${COMPLETE_ITEM:ToArray} 3 | // ${PARENS:Left} 4 | 5 | class Foo 6 | { 7 | void M(Bar bar) 8 | { 9 | Bar.ToArray(bar, {caret} 10 | } 11 | } 12 | 13 | class Bar 14 | { 15 | public static int[] ToArray(Bar bar, int x) { return null; } 16 | public static int[] ToArray(Bar bar, string x) { return null; } 17 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Extra/TestStatic22.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:M2} 2 | 3 | class Foo : GenericBase 4 | { 5 | void Bar(Foo foo) 6 | { 7 | foo.m2{caret} 8 | } 9 | } 10 | 11 | class GenericBase 12 | { 13 | public static void M2(GenericBase foo, T x) { } 14 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Extra/TestStatic22.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:M2} 2 | 3 | class Foo : GenericBase 4 | { 5 | void Bar(Foo foo) 6 | { 7 | M2(foo, {caret}); 8 | } 9 | } 10 | 11 | class GenericBase 12 | { 13 | public static void M2(GenericBase foo, T x) { } 14 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Extra/TestStatic23.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:M2} 2 | 3 | class Foo : GenericBase 4 | { 5 | void Bar(Foo foo) 6 | { 7 | foo.m2{caret} 8 | } 9 | } 10 | 11 | class GenericBase 12 | { 13 | public static void M2(GenericBase foo) { } 14 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Extra/TestStatic23.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:M2} 2 | 3 | class Foo : GenericBase 4 | { 5 | void Bar(Foo foo) 6 | { 7 | M2(foo){caret}; 8 | } 9 | } 10 | 11 | class GenericBase 12 | { 13 | public static void M2(GenericBase foo) { } 14 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/List/TestAssignment01.cs: -------------------------------------------------------------------------------- 1 | class Person 2 | { 3 | private string myName; 4 | 5 | public Person(string name) 6 | { 7 | myName = name.{caret}; 8 | } 9 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/List/TestAssignment01.cs.gold: -------------------------------------------------------------------------------- 1 | # 69 ITEMS # 2 | 3 | Clone 4 | Compare 5 | CompareOrdinal 6 | CompareTo 7 | Concat 8 | Contains 9 | Copy 10 | CopyTo 11 | Count 12 | EndsWith 13 | Equals 14 | Equals 15 | Format 16 | GetEnumerator 17 | GetHashCode 18 | GetType 19 | GetTypeCode 20 | IndexOf 21 | IndexOfAny 22 | + Insert 23 | Intern 24 | IsInterned 25 | IsNormalized 26 | IsNullOrEmpty 27 | IsNullOrWhiteSpace 28 | Join 29 | LastIndexOf 30 | LastIndexOfAny 31 | Length 32 | + Normalize 33 | + PadLeft 34 | + PadRight 35 | + Remove 36 | + Replace 37 | Split 38 | StartsWith 39 | + Substring 40 | ToCharArray 41 | + ToLower 42 | + ToLowerInvariant 43 | + ToString 44 | + ToUpper 45 | + ToUpperInvariant 46 | + Trim 47 | + TrimEnd 48 | + TrimStart 49 | [] 50 | arg 51 | await 52 | cast 53 | else 54 | foreach 55 | if 56 | lock 57 | not 58 | notnull 59 | null 60 | par 61 | parse 62 | return 63 | sel 64 | switch 65 | throw 66 | to 67 | tryparse 68 | using 69 | var 70 | while 71 | yield 72 | # AUTOMATIC # 73 | # 51 ITEMS # 74 | 75 | Clone 76 | Compare 77 | CompareOrdinal 78 | CompareTo 79 | Concat 80 | Contains 81 | Copy 82 | CopyTo 83 | Count 84 | EndsWith 85 | Equals 86 | Equals 87 | Format 88 | GetEnumerator 89 | GetHashCode 90 | GetType 91 | GetTypeCode 92 | IndexOf 93 | IndexOfAny 94 | + Insert 95 | Intern 96 | IsInterned 97 | IsNormalized 98 | IsNullOrEmpty 99 | IsNullOrWhiteSpace 100 | Join 101 | LastIndexOf 102 | LastIndexOfAny 103 | Length 104 | + Normalize 105 | + PadLeft 106 | + PadRight 107 | + Remove 108 | + Replace 109 | Split 110 | StartsWith 111 | + Substring 112 | ToCharArray 113 | + ToLower 114 | + ToLowerInvariant 115 | + ToString 116 | + ToUpper 117 | + ToUpperInvariant 118 | + Trim 119 | + TrimEnd 120 | + TrimStart 121 | [] 122 | foreach 123 | parse 124 | switch 125 | tryparse 126 | -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/List/TestAssignment02.cs: -------------------------------------------------------------------------------- 1 | class Person 2 | { 3 | private string myName; 4 | 5 | public Person(string name) 6 | { 7 | (myName = name).{caret}; 8 | } 9 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/List/TestAssignment02.cs.gold: -------------------------------------------------------------------------------- 1 | # 71 ITEMS # 2 | 3 | + Clone 4 | + Compare 5 | + CompareOrdinal 6 | + CompareTo 7 | + Concat 8 | + Contains 9 | + Copy 10 | + CopyTo 11 | + Count 12 | + EndsWith 13 | + Equals 14 | + Equals 15 | + Format 16 | + GetEnumerator 17 | + GetHashCode 18 | + GetType 19 | + GetTypeCode 20 | + IndexOf 21 | + IndexOfAny 22 | + Insert 23 | + Intern 24 | + IsInterned 25 | + IsNormalized 26 | + IsNullOrEmpty 27 | + IsNullOrWhiteSpace 28 | + Join 29 | + LastIndexOf 30 | + LastIndexOfAny 31 | + Length 32 | + Normalize 33 | + PadLeft 34 | + PadRight 35 | + Remove 36 | + Replace 37 | + Split 38 | + StartsWith 39 | + Substring 40 | + ToCharArray 41 | + ToLower 42 | + ToLowerInvariant 43 | + ToString 44 | + ToUpper 45 | + ToUpperInvariant 46 | + Trim 47 | + TrimEnd 48 | + TrimStart 49 | + [] 50 | + arg 51 | + await 52 | + cast 53 | + else 54 | + field 55 | + foreach 56 | + if 57 | + lock 58 | + not 59 | + notnull 60 | + null 61 | + par 62 | + parse 63 | + prop 64 | + return 65 | + sel 66 | + switch 67 | + throw 68 | + to 69 | + tryparse 70 | + using 71 | + var 72 | + while 73 | + yield 74 | # AUTOMATIC # 75 | # 54 ITEMS # 76 | 77 | + Clone 78 | + Compare 79 | + CompareOrdinal 80 | + CompareTo 81 | + Concat 82 | + Contains 83 | + Copy 84 | + CopyTo 85 | + Count 86 | + EndsWith 87 | + Equals 88 | + Equals 89 | + Format 90 | + GetEnumerator 91 | + GetHashCode 92 | + GetType 93 | + GetTypeCode 94 | + IndexOf 95 | + IndexOfAny 96 | + Insert 97 | + Intern 98 | + IsInterned 99 | + IsNormalized 100 | + IsNullOrEmpty 101 | + IsNullOrWhiteSpace 102 | + Join 103 | + LastIndexOf 104 | + LastIndexOfAny 105 | + Length 106 | + Normalize 107 | + PadLeft 108 | + PadRight 109 | + Remove 110 | + Replace 111 | + Split 112 | + StartsWith 113 | + Substring 114 | + ToCharArray 115 | + ToLower 116 | + ToLowerInvariant 117 | + ToString 118 | + ToUpper 119 | + ToUpperInvariant 120 | + Trim 121 | + TrimEnd 122 | + TrimStart 123 | + [] 124 | + field 125 | + foreach 126 | + parse 127 | + prop 128 | + switch 129 | + tryparse 130 | + var 131 | -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/List/TestAwait01.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | 3 | class Playground 4 | { 5 | async void Foo(Task task) 6 | { 7 | task.ConfigureAwait(false).a{caret} 8 | } 9 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/List/TestAwait01.cs.gold: -------------------------------------------------------------------------------- 1 | # 2 ITEMS # 2 | 3 | + arg 4 | + await 5 | # AUTOMATIC # 6 | # 1 ITEM # 7 | 8 | + await 9 | -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/List/TestAwait02.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | 3 | class Playground 4 | { 5 | async void Foo(Task task) 6 | { 7 | task.ConfigureAwait(false).a{caret} 8 | } 9 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/List/TestAwait02.cs.gold: -------------------------------------------------------------------------------- 1 | # 2 ITEMS # 2 | 3 | + arg 4 | + await 5 | # AUTOMATIC # 6 | # 1 ITEM # 7 | 8 | + await 9 | -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/List/TestBase01.cs: -------------------------------------------------------------------------------- 1 | public class Foo 2 | { 3 | public void Bar() 4 | { 5 | base.{caret} 6 | } 7 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/List/TestBase01.cs.gold: -------------------------------------------------------------------------------- 1 | # 25 ITEMS # 2 | 3 | + Equals 4 | + GetHashCode 5 | + GetType 6 | + MemberwiseClone 7 | + ToString 8 | + arg 9 | + await 10 | + cast 11 | + else 12 | + field 13 | + foreach 14 | + if 15 | + lock 16 | + not 17 | + par 18 | + prop 19 | + return 20 | + sel 21 | + switch 22 | + throw 23 | + to 24 | + using 25 | + var 26 | + while 27 | + yield 28 | # AUTOMATIC # 29 | # 7 ITEMS # 30 | 31 | + Equals 32 | + GetHashCode 33 | + GetType 34 | + MemberwiseClone 35 | + ToString 36 | + lock 37 | + var 38 | -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/List/TestBoolean01.cs: -------------------------------------------------------------------------------- 1 | class Program 2 | { 3 | static Program Main(object a) 4 | { 5 | var program = a as Program; 6 | program.{caret} 7 | } 8 | 9 | public static implicit operator bool(Program p) 10 | { 11 | return true; 12 | } 13 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/List/TestBoolean01.cs.gold: -------------------------------------------------------------------------------- 1 | # 28 ITEMS # 2 | 3 | + Equals 4 | + GetHashCode 5 | + GetType 6 | + Main 7 | + MemberwiseClone 8 | + ToString 9 | + arg 10 | + await 11 | + cast 12 | + else 13 | + field 14 | + foreach 15 | + if 16 | + lock 17 | + not 18 | + notnull 19 | + null 20 | + par 21 | + prop 22 | + return 23 | + sel 24 | + switch 25 | + throw 26 | + to 27 | + using 28 | + var 29 | + while 30 | + yield 31 | # AUTOMATIC # 32 | # 13 ITEMS # 33 | 34 | + Equals 35 | + GetHashCode 36 | + GetType 37 | + Main 38 | + MemberwiseClone 39 | + ToString 40 | + else 41 | + if 42 | + not 43 | + notnull 44 | + null 45 | + return 46 | + while 47 | -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/List/TestBoolean02.cs: -------------------------------------------------------------------------------- 1 | class Program 2 | { 3 | static Program Main(object a) 4 | { 5 | a as Program.{caret} 6 | } 7 | 8 | public static implicit operator bool(Program p) 9 | { 10 | return true; 11 | } 12 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/List/TestBoolean02.cs.gold: -------------------------------------------------------------------------------- 1 | # 22 ITEMS # 2 | 3 | + arg 4 | + await 5 | + cast 6 | + else 7 | + field 8 | + foreach 9 | + if 10 | + lock 11 | + not 12 | + notnull 13 | + null 14 | + par 15 | + prop 16 | + return 17 | + sel 18 | + switch 19 | + throw 20 | + to 21 | + using 22 | + var 23 | + while 24 | + yield 25 | # AUTOMATIC # 26 | # 6 ITEMS # 27 | 28 | + else 29 | + if 30 | + not 31 | + return 32 | + var 33 | + while 34 | -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/List/TestBoolean03.cs: -------------------------------------------------------------------------------- 1 | class Program 2 | { 3 | static Program Main(object a) 4 | { 5 | a as Program.{caret} 6 | } 7 | 8 | public static implicit operator bool(Program p) 9 | { 10 | return true; 11 | } 12 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/List/TestBoolean03.cs.gold: -------------------------------------------------------------------------------- 1 | # 22 ITEMS # 2 | 3 | + arg 4 | + await 5 | + cast 6 | + else 7 | + field 8 | + foreach 9 | + if 10 | + lock 11 | + not 12 | + notnull 13 | + null 14 | + par 15 | + prop 16 | + return 17 | + sel 18 | + switch 19 | + throw 20 | + to 21 | + using 22 | + var 23 | + while 24 | + yield 25 | # AUTOMATIC # 26 | # 6 ITEMS # 27 | 28 | + else 29 | + if 30 | + not 31 | + return 32 | + var 33 | + while 34 | -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/List/TestIf01.cs: -------------------------------------------------------------------------------- 1 | public class Foo { 2 | public void Bar(object o) { 3 | o as Foo.{caret} 4 | } 5 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/List/TestIf01.cs.gold: -------------------------------------------------------------------------------- 1 | # 22 ITEMS # 2 | 3 | + arg 4 | + await 5 | + cast 6 | + else 7 | + field 8 | + foreach 9 | + if 10 | + lock 11 | + not 12 | + notnull 13 | + null 14 | + par 15 | + prop 16 | + return 17 | + sel 18 | + switch 19 | + throw 20 | + to 21 | + using 22 | + var 23 | + while 24 | + yield 25 | # AUTOMATIC # 26 | # 1 ITEM # 27 | 28 | + var 29 | -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/List/TestIf02.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | 3 | class Playground 4 | { 5 | async void Foo(Task task) 6 | { 7 | await task.ConfigureAwait(false).i{caret} 8 | } 9 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/List/TestIf02.cs.gold: -------------------------------------------------------------------------------- 1 | # 1 ITEM # 2 | 3 | + if 4 | # AUTOMATIC # 5 | # 0 ITEM # 6 | 7 | -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/List/TestIf03.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | 3 | class Playground 4 | { 5 | async void Foo(Task task) 6 | { 7 | await task.i{caret} 8 | } 9 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/List/TestIf03.cs.gold: -------------------------------------------------------------------------------- 1 | # 5 ITEMS # 2 | 3 | Id 4 | IsCanceled 5 | IsCompleted 6 | IsFaulted 7 | + if 8 | # AUTOMATIC # 9 | # 5 ITEMS # 10 | 11 | Id 12 | IsCanceled 13 | IsCompleted 14 | IsFaulted 15 | + if 16 | -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/List/TestNamespace01.cs: -------------------------------------------------------------------------------- 1 | namespace Ns 2 | { 3 | public class Foo 4 | { 5 | public void Bar() 6 | { 7 | Ns.{caret} 8 | } 9 | } 10 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/List/TestNamespace01.cs.gold: -------------------------------------------------------------------------------- 1 | # 1 ITEM # 2 | 3 | + Foo 4 | # AUTOMATIC # 5 | # 1 ITEM # 6 | 7 | + Foo 8 | -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/List/TestNew01.cs: -------------------------------------------------------------------------------- 1 | enum E { A } 2 | 3 | class Foo { 4 | void Bar() { 5 | E.{caret} 6 | (E.A).ToString(); 7 | } 8 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/List/TestNew01.cs.gold: -------------------------------------------------------------------------------- 1 | # 11 ITEMS # 2 | 3 | + A 4 | + Format 5 | + GetName 6 | + IsDefined 7 | + Parse 8 | + ToObject 9 | + TryParse 10 | + new 11 | + throw 12 | + typeof 13 | + var 14 | # AUTOMATIC # 15 | # 8 ITEMS # 16 | 17 | + A 18 | + Format 19 | + GetName 20 | + IsDefined 21 | + Parse 22 | + ToObject 23 | + TryParse 24 | + typeof 25 | -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/List/TestNew02.cs: -------------------------------------------------------------------------------- 1 | class Foo { 2 | void Bar() { 3 | int.{caret} 4 | } 5 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/List/TestNew02.cs.gold: -------------------------------------------------------------------------------- 1 | # 8 ITEMS # 2 | 3 | + MaxValue 4 | + MinValue 5 | + Parse 6 | + TryParse 7 | + new 8 | + throw 9 | + typeof 10 | + var 11 | # AUTOMATIC # 12 | # 5 ITEMS # 13 | 14 | + MaxValue 15 | + MinValue 16 | + Parse 17 | + TryParse 18 | + typeof 19 | -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/List/TestSwitch01.cs: -------------------------------------------------------------------------------- 1 | class C { 2 | void M() { 3 | null + 123.{caret} 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/List/TestSwitch01.cs.gold: -------------------------------------------------------------------------------- 1 | # 24 ITEMS # 2 | 3 | CompareTo 4 | Equals 5 | GetHashCode 6 | + GetType 7 | GetTypeCode 8 | + ToString 9 | arg 10 | await 11 | cast 12 | else 13 | foreach 14 | if 15 | lock 16 | not 17 | par 18 | return 19 | sel 20 | switch 21 | throw 22 | to 23 | using 24 | var 25 | while 26 | yield 27 | # AUTOMATIC # 28 | # 7 ITEMS # 29 | 30 | CompareTo 31 | Equals 32 | GetHashCode 33 | + GetType 34 | GetTypeCode 35 | + ToString 36 | var 37 | -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/List/TestThis01.cs: -------------------------------------------------------------------------------- 1 | public class Foo 2 | { 3 | public void Bar() 4 | { 5 | this.{caret} 6 | } 7 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/List/TestThis01.cs.gold: -------------------------------------------------------------------------------- 1 | # 26 ITEMS # 2 | 3 | + Bar 4 | + Equals 5 | + GetHashCode 6 | + GetType 7 | + MemberwiseClone 8 | + ToString 9 | + arg 10 | + await 11 | + cast 12 | + else 13 | + field 14 | + foreach 15 | + if 16 | + lock 17 | + not 18 | + par 19 | + prop 20 | + return 21 | + sel 22 | + switch 23 | + throw 24 | + to 25 | + using 26 | + var 27 | + while 28 | + yield 29 | # AUTOMATIC # 30 | # 7 ITEMS # 31 | 32 | + Bar 33 | + Equals 34 | + GetHashCode 35 | + GetType 36 | + MemberwiseClone 37 | + ToString 38 | + var 39 | -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/List/TestType01.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | class Foo 5 | { 6 | void Bar() 7 | { 8 | List xs = null; 9 | } 10 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/List/TestType01.cs.gold: -------------------------------------------------------------------------------- 1 | # 4 ITEMS # 2 | 3 | + MaxValue 4 | + MinValue 5 | + Parse 6 | + TryParse 7 | # AUTOMATIC # 8 | # 4 ITEMS # 9 | 10 | + MaxValue 11 | + MinValue 12 | + Parse 13 | + TryParse 14 | -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/List/TestType02.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | class Foo 5 | { 6 | void Bar() 7 | { 8 | List xs = null; 9 | } 10 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/List/TestType02.cs.gold: -------------------------------------------------------------------------------- 1 | # 4 ITEMS # 2 | 3 | + MaxValue 4 | + MinValue 5 | + Parse 6 | + TryParse 7 | # AUTOMATIC # 8 | # 4 ITEMS # 9 | 10 | + MaxValue 11 | + MinValue 12 | + Parse 13 | + TryParse 14 | -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/List/TestType03.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | class Foo 4 | { 5 | void Bar() 6 | { 7 | List 8 | } 9 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/List/TestType03.cs.gold: -------------------------------------------------------------------------------- 1 | # 4 ITEMS # 2 | 3 | + MaxValue 4 | + MinValue 5 | + Parse 6 | + TryParse 7 | # AUTOMATIC # 8 | # 4 ITEMS # 9 | 10 | + MaxValue 11 | + MinValue 12 | + Parse 13 | + TryParse 14 | -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/List/TestType04.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | class Foo 4 | { 5 | void Bar() 6 | { 7 | List 8 | } 9 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/List/TestType04.cs.gold: -------------------------------------------------------------------------------- 1 | # 4 ITEMS # 2 | 3 | + MaxValue 4 | + MinValue 5 | + Parse 6 | + TryParse 7 | # AUTOMATIC # 8 | # 4 ITEMS # 9 | 10 | + MaxValue 11 | + MinValue 12 | + Parse 13 | + TryParse 14 | -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/List/TestType05.cs: -------------------------------------------------------------------------------- 1 | class Foo 2 | { 3 | void Bar(string foo) 4 | { 5 | foo == Foo.{caret} 6 | } 7 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/List/TestType05.cs.gold: -------------------------------------------------------------------------------- 1 | # 3 ITEMS # 2 | 3 | + new 4 | + typeof 5 | + var 6 | # AUTOMATIC # 7 | # 2 ITEMS # 8 | 9 | + new 10 | + typeof 11 | -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/List/TestUnresolved01.cs: -------------------------------------------------------------------------------- 1 | public class Foo 2 | { 3 | public void Bar() 4 | { 5 | unresolved.{caret} 6 | } 7 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/List/TestUnresolved01.cs.gold: -------------------------------------------------------------------------------- 1 | # 21 ITEMS # 2 | 3 | + arg 4 | + await 5 | + cast 6 | + else 7 | + foreach 8 | + if 9 | + lock 10 | + new 11 | + not 12 | + notnull 13 | + null 14 | + par 15 | + return 16 | + sel 17 | + switch 18 | + throw 19 | + to 20 | + using 21 | + var 22 | + while 23 | + yield 24 | # AUTOMATIC # 25 | # 3 ITEMS # 26 | 27 | + notnull 28 | + null 29 | + var 30 | -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/List/TestUnresolved02.cs: -------------------------------------------------------------------------------- 1 | public class Foo 2 | { 3 | public void Bar() 4 | { 5 | unresolved.multi.level.{caret} 6 | } 7 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/List/TestUnresolved02.cs.gold: -------------------------------------------------------------------------------- 1 | # 21 ITEMS # 2 | 3 | + arg 4 | + await 5 | + cast 6 | + else 7 | + foreach 8 | + if 9 | + lock 10 | + new 11 | + not 12 | + notnull 13 | + null 14 | + par 15 | + return 16 | + sel 17 | + switch 18 | + throw 19 | + to 20 | + using 21 | + var 22 | + while 23 | + yield 24 | # AUTOMATIC # 25 | # 3 ITEMS # 26 | 27 | + notnull 28 | + null 29 | + var 30 | -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/List/TestUnresolved03.cs: -------------------------------------------------------------------------------- 1 | public class Foo 2 | { 3 | public void Bar() 4 | { 5 | Method(unresolved.{caret}); 6 | } 7 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/List/TestUnresolved03.cs.gold: -------------------------------------------------------------------------------- 1 | # 11 ITEMS # 2 | 3 | + arg 4 | + await 5 | + cast 6 | + foreach 7 | + new 8 | + not 9 | + notnull 10 | + null 11 | + par 12 | + sel 13 | + var 14 | # AUTOMATIC # 15 | # 1 ITEM # 16 | 17 | + var 18 | -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/List/TestUnresolved04.cs: -------------------------------------------------------------------------------- 1 | public class Foo 2 | { 3 | public void Bar() 4 | { 5 | doubleDot..{caret}; 6 | } 7 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/List/TestUnresolved04.cs.gold: -------------------------------------------------------------------------------- 1 | # 0 ITEM # 2 | 3 | # AUTOMATIC # 4 | # 0 ITEM # 5 | 6 | -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/List/TestUnresolved05.cs: -------------------------------------------------------------------------------- 1 | public class Foo 2 | { 3 | public void Bar(string s) 4 | { 5 | s.Substring(.{caret}); 6 | } 7 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/List/TestUnresolved05.cs.gold: -------------------------------------------------------------------------------- 1 | # 47 ITEMS # 2 | 3 | + Clone 4 | + Compare 5 | + CompareOrdinal 6 | + CompareTo 7 | + Concat 8 | + Contains 9 | + Copy 10 | + CopyTo 11 | + Count 12 | + EndsWith 13 | + Equals 14 | + Equals 15 | + Format 16 | + GetEnumerator 17 | + GetHashCode 18 | + GetType 19 | + GetTypeCode 20 | + IndexOf 21 | + IndexOfAny 22 | + Insert 23 | + Intern 24 | + IsInterned 25 | + IsNormalized 26 | + IsNullOrEmpty 27 | + IsNullOrWhiteSpace 28 | + Join 29 | + LastIndexOf 30 | + LastIndexOfAny 31 | + Length 32 | + Normalize 33 | + PadLeft 34 | + PadRight 35 | + Remove 36 | + Replace 37 | + Split 38 | + StartsWith 39 | + Substring 40 | + ToCharArray 41 | + ToLower 42 | + ToLowerInvariant 43 | + ToString 44 | + ToUpper 45 | + ToUpperInvariant 46 | + Trim 47 | + TrimEnd 48 | + TrimStart 49 | + [] 50 | # AUTOMATIC # 51 | # 47 ITEMS # 52 | 53 | + Clone 54 | + Compare 55 | + CompareOrdinal 56 | + CompareTo 57 | + Concat 58 | + Contains 59 | + Copy 60 | + CopyTo 61 | + Count 62 | + EndsWith 63 | + Equals 64 | + Equals 65 | + Format 66 | + GetEnumerator 67 | + GetHashCode 68 | + GetType 69 | + GetTypeCode 70 | + IndexOf 71 | + IndexOfAny 72 | + Insert 73 | + Intern 74 | + IsInterned 75 | + IsNormalized 76 | + IsNullOrEmpty 77 | + IsNullOrWhiteSpace 78 | + Join 79 | + LastIndexOf 80 | + LastIndexOfAny 81 | + Length 82 | + Normalize 83 | + PadLeft 84 | + PadRight 85 | + Remove 86 | + Replace 87 | + Split 88 | + StartsWith 89 | + Substring 90 | + ToCharArray 91 | + ToLower 92 | + ToLowerInvariant 93 | + ToString 94 | + ToUpper 95 | + ToUpperInvariant 96 | + Trim 97 | + TrimEnd 98 | + TrimStart 99 | + [] 100 | -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/List/TestVar01.cs: -------------------------------------------------------------------------------- 1 | namespace NameSpace { 2 | namespace Inner { 3 | } 4 | } 5 | 6 | public class Foo 7 | { 8 | public void Bar() 9 | { 10 | NameSpace.Inner.{caret}; 11 | } 12 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/List/TestVar01.cs.gold: -------------------------------------------------------------------------------- 1 | # 0 ITEM # 2 | 3 | # AUTOMATIC # 4 | # 0 ITEM # 5 | 6 | -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/List/TestVar02.cs: -------------------------------------------------------------------------------- 1 | using System.Text; 2 | 3 | public class Foo 4 | { 5 | public string Bar() 6 | { 7 | return new StringBuilder().{caret}.ToString(); 8 | } 9 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/List/TestVar02.cs.gold: -------------------------------------------------------------------------------- 1 | # 26 ITEMS # 2 | 3 | Append 4 | AppendFormat 5 | AppendLine 6 | Capacity 7 | Clear 8 | CopyTo 9 | Count 10 | EnsureCapacity 11 | Equals 12 | GetHashCode 13 | GetType 14 | Insert 15 | Length 16 | MaxCapacity 17 | Remove 18 | Replace 19 | + ToString 20 | [] 21 | arg 22 | await 23 | cast 24 | foreach 25 | not 26 | par 27 | sel 28 | var 29 | # AUTOMATIC # 30 | # 19 ITEMS # 31 | 32 | Append 33 | AppendFormat 34 | AppendLine 35 | Capacity 36 | Clear 37 | CopyTo 38 | Count 39 | EnsureCapacity 40 | Equals 41 | GetHashCode 42 | GetType 43 | Insert 44 | Length 45 | MaxCapacity 46 | Remove 47 | Replace 48 | + ToString 49 | [] 50 | var 51 | -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/List/TestYield01.cs: -------------------------------------------------------------------------------- 1 | public class Foo 2 | { 3 | public System.Collection.IEnumerator I() 4 | { 5 | 42.y{caret} 6 | } 7 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/List/TestYield01.cs.gold: -------------------------------------------------------------------------------- 1 | # 1 ITEM # 2 | 3 | + yield 4 | # AUTOMATIC # 5 | # 0 ITEM # 6 | 7 | -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Razor/Model.cs: -------------------------------------------------------------------------------- 1 | public class ModelClass 2 | { 3 | public bool IsValid { get; set; } 4 | public object Value { get; set; } 5 | public int[] Items { get; set; } 6 | public System.IDisposable Form { get; set; } 7 | public MyEnum EnumProperty { get; set; } 8 | } 9 | 10 | public enum MyEnum 11 | { 12 | SomeCase 13 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Razor/TestEnum01.cshtml: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:SomeCase} 2 | 3 | @model ModelClass 4 | 5 | 6 | 7 | 8 | 9 | Title 10 | 11 | 12 |
13 | @Model.EnumProperty.s{caret} 14 |
15 | 16 | -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Razor/TestRazor01.cshtml: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:if} 2 | 3 | @model ModelClass 4 | 5 | 6 | 7 | 8 | 9 | Title 10 | 11 | 12 |
13 | @Model.IsValid.{caret} 14 |
15 | 16 | -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Razor/TestRazor01.cshtml.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:if} 2 | 3 | @model ModelClass 4 | 5 | 6 | 7 | 8 | 9 | Title 10 | 11 | 12 |
13 | @if (Model.IsValid) 14 | { 15 | {caret} 16 | } 17 |
18 | 19 | -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Razor/TestRazor02.cshtml: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:if} 2 | 3 | @model ModelClass 4 | 5 | 6 | 7 | 8 | 9 | Title 10 | 11 | 12 |
13 | @Model.IsValid.i{caret} 14 |
15 | 16 | -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Razor/TestRazor02.cshtml.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:if} 2 | 3 | @model ModelClass 4 | 5 | 6 | 7 | 8 | 9 | Title 10 | 11 | 12 |
13 | @if (Model.IsValid) 14 | { 15 | {caret} 16 | } 17 |
18 | 19 | -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Razor/TestRazor03.cshtml: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:if} 2 | 3 | @model ModelClass 4 | 5 | 6 | 7 | 8 | 9 | Title 10 | 11 | 12 |
13 | @Model.IsValid.if{caret} 14 |
15 | 16 | -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Razor/TestRazor03.cshtml.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:if} 2 | 3 | @model ModelClass 4 | 5 | 6 | 7 | 8 | 9 | Title 10 | 11 | 12 |
13 | @if (Model.IsValid) 14 | { 15 | {caret} 16 | } 17 |
18 | 19 | -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Razor/TestRazor04.cshtml: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:notnull} 2 | 3 | @model ModelClass 4 | 5 | 6 | 7 | 8 | 9 | Title 10 | 11 | 12 |
13 | @Model.{caret} 14 |
15 | 16 | -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Razor/TestRazor04.cshtml.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:notnull} 2 | 3 | @model ModelClass 4 | 5 | 6 | 7 | 8 | 9 | Title 10 | 11 | 12 |
13 | @if (Model != null) 14 | { 15 | {caret} 16 | } 17 |
18 | 19 | -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Razor/TestRazor05.cshtml: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:null} 2 | 3 | @model ModelClass 4 | 5 | 6 | 7 | 8 | 9 | Title 10 | 11 | 12 |
13 | @Model.null{caret} 14 |
15 | 16 | -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Razor/TestRazor05.cshtml.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:null} 2 | 3 | @model ModelClass 4 | 5 | 6 | 7 | 8 | 9 | Title 10 | 11 | 12 |
13 | @if (Model == null) 14 | { 15 | {caret} 16 | } 17 |
18 | 19 | -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Razor/TestRazor06.cshtml: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:foreach} 2 | 3 | @model ModelClass 4 | 5 | 6 | 7 | 8 | 9 | Title 10 | 11 | 12 |
13 | @Model.Items.{caret} 14 |
15 | 16 | -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Razor/TestRazor06.cshtml.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:foreach} 2 | 3 | @model ModelClass 4 | 5 | 6 | 7 | 8 | 9 | Title 10 | 11 | 12 |
13 | @foreach (var item in Model.Items) 14 | { 15 | {caret} 16 | } 17 |
18 | 19 | -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Razor/TestRazor07.cshtml: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:cast} 2 | 3 | @model ModelClass 4 | 5 | 6 | 7 | 8 | 9 | Title 10 | 11 | 12 |
13 | @Model.Value.{caret} 14 |
15 | 16 | -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Razor/TestRazor07.cshtml.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:cast} 2 | 3 | @model ModelClass 4 | 5 | 6 | 7 | 8 | 9 | Title 10 | 11 | 12 |
13 | @((object) Model.Value){caret} 14 |
15 | 16 | -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Razor/TestRazor08.cshtml: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:var} 2 | 3 | @model ModelClass 4 | 5 | 6 | 7 | 8 | 9 | Title 10 | 11 | 12 |
13 | @Model.Value.{caret} 14 |
15 | 16 | -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Razor/TestRazor08.cshtml.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:var} 2 | 3 | @model ModelClass 4 | 5 | 6 | 7 | 8 | 9 | Title 10 | 11 | 12 |
13 | @{ 14 | var value = Model.Value;{caret} 15 | } 16 |
17 | 18 | -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Razor/TestRazor09.cshtml: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:var} 2 | 3 | @model ModelClass 4 | 5 | 6 | 7 | 8 | 9 | Title 10 | 11 | 12 |
13 | @Model.var{caret}.Value 14 |
15 | 16 | -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Razor/TestRazor09.cshtml.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:var} 2 | 3 | @model ModelClass 4 | 5 | 6 | 7 | 8 | 9 | Title 10 | 11 | 12 |
13 | 14 | @{ 15 | var model = Model; 16 | } 17 | @model{caret}.Value 18 |
19 | 20 | -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Razor/TestRazor10.cshtml: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:using} 2 | 3 | @model ModelClass 4 | 5 | 6 | 7 | 8 | 9 | Title 10 | 11 | 12 |
13 | @Model.Form.u{caret} 14 |
15 | 16 | -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/Razor/TestRazor10.cshtml.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:using} 2 | 3 | @model ModelClass 4 | 5 | 6 | 7 | 8 | 9 | Title 10 | 11 | 12 |
13 | @using (var form = Model.Form) 14 | { 15 | {caret} 16 | } 17 |
18 | 19 | -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestArg01.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:arg} 2 | 3 | class C { 4 | void M(object c) { 5 | c as C.{caret} 6 | } 7 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestArg01.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:arg} 2 | 3 | class C { 4 | void M(object c) { 5 | Method(c as C{caret}) 6 | } 7 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestArg02.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:arg} 2 | 3 | class C { 4 | void M() { 5 | int source, destination; 6 | destination = (source).arg{caret}; 7 | } 8 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestArg02.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:arg} 2 | 3 | class C { 4 | void M() { 5 | int source, destination; 6 | destination = Method(source{caret}); 7 | } 8 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestCast01.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:cast} 2 | 3 | class C { 4 | void M(object c) { 5 | c as C.{caret} 6 | } 7 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestCast01.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:cast} 2 | 3 | class C { 4 | void M(object c) { 5 | ((object) (c as C)){caret} 6 | } 7 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestCast02.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:cast} 2 | 3 | class C { 4 | void M(System.Func f) { 5 | M(x => x.{caret}); 6 | } 7 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestCast02.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:cast} 2 | 3 | class C { 4 | void M(System.Func f) { 5 | M(x => ((object) x){caret}); 6 | } 7 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestField01.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:field} 2 | 3 | class Person 4 | { 5 | private string myName; 6 | 7 | public Person(string name) 8 | { 9 | myName = name; 10 | name.fie{caret} 11 | } 12 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestField01.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:field} 2 | 3 | class Person 4 | { 5 | private string myName; 6 | private string myS; 7 | 8 | public Person(string name) 9 | { 10 | myName = name; 11 | myS = name;{caret} 12 | } 13 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestField02.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:field} 2 | 3 | class Person 4 | { 5 | private Person mySomePerson; 6 | 7 | public Person(Person somePerson) 8 | { 9 | mySomePerson = somePerson; 10 | somePerson.{caret} 11 | } 12 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestField02.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:field} 2 | 3 | class Person 4 | { 5 | private Person mySomePerson; 6 | private Person myPerson; 7 | 8 | public Person(Person somePerson) 9 | { 10 | mySomePerson = somePerson; 11 | myPerson = somePerson;{caret} 12 | } 13 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestFor01.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:for} 2 | 3 | public class Foo 4 | { 5 | public void Bar() 6 | { 7 | var xs = new System.Collections.Generic.List(); 8 | xs.{caret} 9 | 10 | System.Console.WriteLine(); 11 | } 12 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestFor01.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:for} 2 | 3 | public class Foo 4 | { 5 | public void Bar() 6 | { 7 | var xs = new System.Collections.Generic.List(); 8 | for (var i = 0; i < xs.Count; i++) 9 | { 10 | {caret} 11 | } 12 | 13 | System.Console.WriteLine(); 14 | } 15 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestFor02.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:for} 2 | 3 | class Foo 4 | { 5 | void Bar() 6 | { 7 | var xs = new Foo(); 8 | xs.for{caret} 9 | } 10 | 11 | public int Count { get; set; } 12 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestFor02.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:for} 2 | 3 | class Foo 4 | { 5 | void Bar() 6 | { 7 | var xs = new Foo(); 8 | for (var i = 0; i < xs.Count; i++) 9 | { 10 | {caret} 11 | } 12 | } 13 | 14 | public int Count { get; set; } 15 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestFor03.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:forr} 2 | 3 | class Foo 4 | { 5 | void Bar() 6 | { 7 | int times = 5; 8 | times.for{caret} 9 | } 10 | 11 | public int Count { get; set; } 12 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestFor03.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:forr} 2 | 3 | class Foo 4 | { 5 | void Bar() 6 | { 7 | int times = 5; 8 | for (var i = times; i > 0; i--) 9 | { 10 | {caret} 11 | } 12 | } 13 | 14 | public int Count { get; set; } 15 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestFor04.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:for} 2 | 3 | class Foo 4 | { 5 | void Bar() 6 | { 7 | int times = 5; 8 | times.for{caret} 9 | } 10 | 11 | public int Count { get; set; } 12 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestFor04.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:for} 2 | 3 | class Foo 4 | { 5 | void Bar() 6 | { 7 | int times = 5; 8 | for (var i = 0; i < times; i++) 9 | { 10 | {caret} 11 | } 12 | } 13 | 14 | public int Count { get; set; } 15 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestFor05.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:forr} 2 | 3 | public class Foo 4 | { 5 | public void Bar() 6 | { 7 | int[] xs = { 1, 2, 3 }; 8 | xs.{caret} 9 | 10 | System.Console.WriteLine(); 11 | } 12 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestFor05.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:forr} 2 | 3 | public class Foo 4 | { 5 | public void Bar() 6 | { 7 | int[] xs = { 1, 2, 3 }; 8 | for (var i = xs.Length - 1; i >= 0; i--) 9 | { 10 | {caret} 11 | } 12 | 13 | System.Console.WriteLine(); 14 | } 15 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestFor40.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:for} 2 | public class Foo { 3 | public void Bar(int x) { 4 | x.{caret} 5 | for (var i = 0; i < x; x++) 6 | } 7 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestFor40.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:for} 2 | public class Foo { 3 | public void Bar(int x) 4 | { 5 | for (var i = 0; i < x; i++) {caret} 6 | for (var i = 0; i < x; x++) 7 | } 8 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestFor41.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:forr} 2 | public class Foo { 3 | public void Bar(short x) { 4 | x.{caret} 5 | for (var i = x; i > x; i--) 6 | } 7 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestFor41.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:forr} 2 | public class Foo { 3 | public void Bar(short x) 4 | { 5 | for (var i = x; i > 0; i--) {caret} 6 | for (var i = x; i > x; i--) 7 | } 8 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestForEach01.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:foreach} 2 | 3 | public class Foo 4 | { 5 | public void Bar(int[] xs, int[] coolValues) 6 | { 7 | foreach (var someName in xs) 8 | { 9 | if (someName > 0) 10 | { 11 | coolValues.fe{caret} 12 | } 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestForEach01.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:foreach} 2 | 3 | public class Foo 4 | { 5 | public void Bar(int[] xs, int[] coolValues) 6 | { 7 | foreach (var someName in xs) 8 | { 9 | if (someName > 0) 10 | { 11 | foreach (var coolValue in coolValues) 12 | { 13 | {caret} 14 | } 15 | } 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestForEach02.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:foreach} 2 | 3 | public class Foo 4 | { 5 | public void Bar(int[] xs, IEnumerable coolValues) 6 | { 7 | foreach (var someName in xs) 8 | { 9 | if (someName > 0) 10 | { 11 | coolValues.fe{caret} 12 | } 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestForEach02.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:foreach} 2 | 3 | public class Foo 4 | { 5 | public void Bar(int[] xs, IEnumerable coolValues) 6 | { 7 | foreach (var someName in xs) 8 | { 9 | if (someName > 0) 10 | { 11 | foreach (var coolValue in coolValues) 12 | { 13 | {caret} 14 | } 15 | } 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestForEach03.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:foreach} 2 | 3 | public class FooBar 4 | { 5 | public void Bar(int[] xs, FooBar coolValues) 6 | { 7 | foreach (var someName in xs) 8 | { 9 | if (someName > 0) 10 | { 11 | coolValues.fe{caret} 12 | } 13 | } 14 | } 15 | 16 | public FooBar GetEnumerator() { return this; } 17 | public FooBar Current { get { return this; } } 18 | public bool MoveNext() { return false; } 19 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestForEach03.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:foreach} 2 | 3 | public class FooBar 4 | { 5 | public void Bar(int[] xs, FooBar coolValues) 6 | { 7 | foreach (var someName in xs) 8 | { 9 | if (someName > 0) 10 | { 11 | foreach (var coolValue in coolValues) 12 | { 13 | {caret} 14 | } 15 | } 16 | } 17 | } 18 | 19 | public FooBar GetEnumerator() { return this; } 20 | public FooBar Current { get { return this; } } 21 | public bool MoveNext() { return false; } 22 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestForEach04.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:foreach} 2 | using System; 3 | 4 | public class FooBar 5 | { 6 | public void Bar(int[] xs) 7 | { 8 | Console.WriteLine(xs.fo{caret}) 9 | } 10 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestForEach04.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:foreach} 2 | using System; 3 | 4 | public class FooBar 5 | { 6 | public void Bar(int[] xs) 7 | { 8 | foreach (var i in xs) 9 | { 10 | Console.WriteLine(i{caret}) 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestForEach05.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:foreach} 2 | using System.Collections.Generic; 3 | 4 | class Foo 5 | { 6 | private List myList1; 7 | private List myList2; 8 | 9 | void M() 10 | { 11 | myList1 = new List(); 12 | 13 | myList1.f{caret} 14 | 15 | myList2 = new List(); 16 | } 17 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestForEach05.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:foreach} 2 | using System.Collections.Generic; 3 | 4 | class Foo 5 | { 6 | private List myList1; 7 | private List myList2; 8 | 9 | void M() 10 | { 11 | myList1 = new List(); 12 | 13 | foreach (var i in myList1) 14 | { 15 | {caret} 16 | } 17 | 18 | myList2 = new List(); 19 | } 20 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestForEach40.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:foreach} 2 | using System.Collections.Generic; 3 | 4 | public class FooBar 5 | { 6 | public void Bar(Dictionary xs) 7 | { 8 | xs.{caret} 9 | foreach (var keyValuePair in xs) 10 | { 11 | 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestForEach40.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:foreach} 2 | using System.Collections.Generic; 3 | 4 | public class FooBar 5 | { 6 | public void Bar(Dictionary xs) 7 | { 8 | foreach (var keyValuePair in xs) {caret} 9 | foreach (var keyValuePair in xs) 10 | { 11 | 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestIf01.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:if} 2 | 3 | public class Foo 4 | { 5 | public void Bar(bool a) 6 | { 7 | a.{caret} 8 | } 9 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestIf01.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:if} 2 | 3 | public class Foo 4 | { 5 | public void Bar(bool a) 6 | { 7 | if (a) 8 | { 9 | {caret} 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestIf02.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:if} 2 | 3 | public class Foo 4 | { 5 | public void Bar(string s) 6 | { 7 | s != null.{caret} 8 | } 9 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestIf02.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:if} 2 | 3 | public class Foo 4 | { 5 | public void Bar(string s) 6 | { 7 | if (s != null) 8 | { 9 | {caret} 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestIf03.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:if} 2 | 3 | public class Foo 4 | { 5 | public void Bar(string s) 6 | { 7 | s != null.if{caret} 8 | } 9 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestIf03.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:if} 2 | 3 | public class Foo 4 | { 5 | public void Bar(string s) 6 | { 7 | if (s != null) 8 | { 9 | {caret} 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestIf04.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:else} 2 | 3 | public class Foo 4 | { 5 | public void Bar(string s) 6 | { 7 | s != null.els{caret} 8 | boo 9 | } 10 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestIf04.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:else} 2 | 3 | public class Foo 4 | { 5 | public void Bar(string s) 6 | { 7 | if (s == null) 8 | { 9 | {caret} 10 | } 11 | boo 12 | } 13 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestIf05.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:if} 2 | 3 | public class Foo 4 | { 5 | public void Bar(string s) 6 | { 7 | s != null.i{caret} 8 | boo 9 | } 10 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestIf05.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:if} 2 | 3 | public class Foo 4 | { 5 | public void Bar(string s) 6 | { 7 | if (s != null) 8 | { 9 | {caret} 10 | } 11 | boo 12 | } 13 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestIf06.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:if} 2 | 3 | public class Foo 4 | { 5 | public void Bar(object o) 6 | { 7 | o is string.i{caret} 8 | } 9 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestIf06.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:if} 2 | 3 | public class Foo 4 | { 5 | public void Bar(object o) 6 | { 7 | if (o is string) 8 | { 9 | {caret} 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestIf07.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:if} 2 | 3 | public class Foo 4 | { 5 | public void Bar(object o) 6 | { 7 | o is string[].i{caret} 8 | } 9 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestIf07.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:if} 2 | 3 | public class Foo 4 | { 5 | public void Bar(object o) 6 | { 7 | if (o is string[]) 8 | { 9 | {caret} 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestIf08.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:if} 2 | 3 | public class Foo 4 | { 5 | public void Bar(object o) 6 | { 7 | o is System.String.i{caret} 8 | } 9 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestIf08.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:if} 2 | 3 | public class Foo 4 | { 5 | public void Bar(object o) 6 | { 7 | if (o is System.String) 8 | { 9 | {caret} 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestIf09.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:if} 2 | 3 | public class Foo 4 | { 5 | public void Bar(object o) 6 | { 7 | o is System.String[].i{caret} 8 | } 9 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestIf09.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:if} 2 | 3 | public class Foo 4 | { 5 | public void Bar(object o) 6 | { 7 | if (o is System.String[]) 8 | { 9 | {caret} 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestIf10.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:if} 2 | 3 | public class Foo 4 | { 5 | public void Bar(object o) 6 | { 7 | o is System.Int32?.i{caret} 8 | } 9 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestIf10.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:if} 2 | 3 | public class Foo 4 | { 5 | public void Bar(object o) 6 | { 7 | if (o is System.Int32?) 8 | { 9 | {caret} 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestIf11.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:if} 2 | 3 | public class Foo 4 | { 5 | public void Bar(int i) 6 | { 7 | i < 0 && i > 10.i{caret} 8 | } 9 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestIf11.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:if} 2 | 3 | public class Foo 4 | { 5 | public void Bar(int i) 6 | { 7 | if (i < 0 && i > 10) 8 | { 9 | {caret} 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestIf12.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:else} 2 | 3 | public class Foo 4 | { 5 | public void Bar(int i) 6 | { 7 | i < 0 && i > 10.else{caret} 8 | } 9 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestIf12.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:else} 2 | 3 | public class Foo 4 | { 5 | public void Bar(int i) 6 | { 7 | if (i >= 0 || i <= 10) 8 | { 9 | {caret} 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestIf13.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:else} 2 | 3 | public class Foo 4 | { 5 | public void Bar(bool b) 6 | { 7 | !b.els{caret} 8 | } 9 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestIf13.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:else} 2 | 3 | public class Foo 4 | { 5 | public void Bar(bool b) 6 | { 7 | if (b) 8 | { 9 | {caret} 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestIf14.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:if} 2 | 3 | public class Foo 4 | { 5 | public void Bar(bool b) 6 | { 7 | F().{caret} 8 | } 9 | 10 | public bool F() { return true; } 11 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestIf14.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:if} 2 | 3 | public class Foo 4 | { 5 | public void Bar(bool b) 6 | { 7 | if (F()) 8 | { 9 | {caret} 10 | } 11 | } 12 | 13 | public bool F() { return true; } 14 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestIf15.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:if} 2 | 3 | public class Foo 4 | { 5 | static string Foo(object x) 6 | { 7 | x is System.String.{caret} 8 | var t = System.Console.ReadLine(); 9 | } 10 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestIf15.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:if} 2 | 3 | public class Foo 4 | { 5 | static string Foo(object x) 6 | { 7 | if (x is System.String) 8 | { 9 | {caret} 10 | } 11 | var t = System.Console.ReadLine(); 12 | } 13 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestIf16.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:else} 2 | 3 | class Foo 4 | { 5 | void Bar(bool a) 6 | { 7 | a.el{caret} 8 | } 9 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestIf16.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:else} 2 | 3 | class Foo 4 | { 5 | void Bar(bool a) 6 | { 7 | if (!a) 8 | { 9 | {caret} 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestIf17.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:else} 2 | 3 | class Foo 4 | { 5 | void Bar(int a) 6 | { 7 | a > 0.el{caret} 8 | } 9 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestIf17.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:else} 2 | 3 | class Foo 4 | { 5 | void Bar(int a) 6 | { 7 | if (a <= 0) 8 | { 9 | {caret} 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestIf18.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:if} 2 | 3 | using System.Text; 4 | 5 | class C { 6 | C M(StringBuilder builder) 7 | { 8 | if (!nameSpace.IsRootNamespace) 9 | InsertNamespaceDeclaration(builder, nameSpace, translator, declarationRange); 10 | 11 | builder.Length > 0.{caret} 12 | 13 | // copy whole declaration's text 14 | builder.Append(declaration.GetText()); 15 | } 16 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestIf18.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:if} 2 | 3 | using System.Text; 4 | 5 | class C { 6 | C M(StringBuilder builder) 7 | { 8 | if (!nameSpace.IsRootNamespace) 9 | InsertNamespaceDeclaration(builder, nameSpace, translator, declarationRange); 10 | 11 | if (builder.Length > 0) 12 | { 13 | {caret} 14 | } 15 | 16 | // copy whole declaration's text 17 | builder.Append(declaration.GetText()); 18 | } 19 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestIf19.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:if} 2 | 3 | class Program { 4 | void F(object element) { 5 | var str = element as string; 6 | if (str != null) { 7 | element = str.Length > 0 ? (object) str.Length : null; 8 | element == null.{caret}; 9 | 10 | var boo = 123; 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestIf19.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:if} 2 | 3 | class Program { 4 | void F(object element) { 5 | var str = element as string; 6 | if (str != null) { 7 | element = str.Length > 0 ? (object) str.Length : null; 8 | if (element == null) 9 | { 10 | {caret} 11 | } 12 | 13 | var boo = 123; 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestIf20.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:if} 2 | 3 | class Program { 4 | void F(int[] xs) { 5 | xs.Length > 0.{caret} 6 | (xs != null ? xs : xs)[42] = 42; 7 | } 8 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestIf20.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:if} 2 | 3 | class Program { 4 | void F(int[] xs) 5 | { 6 | if (xs.Length > 0) 7 | { 8 | {caret} 9 | } 10 | (xs != null ? xs : xs)[42] = 42; 11 | } 12 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestIf21.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:if} 2 | 3 | class Program { 4 | void F(object operand) { 5 | operand as Program.{caret} 6 | } 7 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestIf21.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:if} 2 | 3 | class Program { 4 | void F(object operand) 5 | { 6 | if (operand is Program) 7 | { 8 | {caret} 9 | } 10 | } 11 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestIf22.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:if} 2 | 3 | class Foo { 4 | void Bar() { 5 | "aaa".IsNullOrEmpty().i{caret} 6 | } 7 | } 8 | 9 | static class StringExtensions { 10 | public static bool IsNullOrEmpty(this string s) { 11 | return string.IsNullOrEmpty(s); 12 | } 13 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestIf22.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:if} 2 | 3 | class Foo { 4 | void Bar() 5 | { 6 | if ("aaa".IsNullOrEmpty()) 7 | { 8 | {caret} 9 | } 10 | } 11 | } 12 | 13 | static class StringExtensions { 14 | public static bool IsNullOrEmpty(this string s) { 15 | return string.IsNullOrEmpty(s); 16 | } 17 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestLock01.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:lock} 2 | 3 | class Foo 4 | { 5 | private readonly object _syncLock = new object(); 6 | 7 | void Bar() 8 | { 9 | _syncLock.{caret} 10 | 11 | var a = 123; 12 | } 13 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestLock01.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:lock} 2 | 3 | class Foo 4 | { 5 | private readonly object _syncLock = new object(); 6 | 7 | void Bar() 8 | { 9 | lock (_syncLock) 10 | { 11 | {caret} 12 | } 13 | 14 | var a = 123; 15 | } 16 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestNew01.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:new} 2 | 3 | class Foo 4 | { 5 | void Bar() 6 | { 7 | Foo.{caret} 8 | } 9 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestNew01.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:new} 2 | 3 | class Foo 4 | { 5 | void Bar() 6 | { 7 | new Foo(){caret} 8 | } 9 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestNew02.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:new} 2 | 3 | class Foo 4 | { 5 | Foo(string a) { } 6 | 7 | void Bar() 8 | { 9 | Foo.{caret} 10 | } 11 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestNew02.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:new} 2 | 3 | class Foo 4 | { 5 | Foo(string a) { } 6 | 7 | void Bar() 8 | { 9 | new Foo({caret}) 10 | } 11 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestNew03.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:new} 2 | 3 | class Foo 4 | { 5 | void Bar() 6 | { 7 | int.new{caret} 8 | } 9 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestNew03.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:new} 2 | 3 | class Foo 4 | { 5 | void Bar() 6 | { 7 | new int(){caret} 8 | } 9 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestNew04.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:new} 2 | 3 | class Foo 4 | { 5 | void Bar() 6 | { 7 | UnknownType("arg").new{caret} 8 | } 9 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestNew04.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:new} 2 | 3 | class Foo 4 | { 5 | void Bar() 6 | { 7 | new UnknownType("arg"){caret} 8 | } 9 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestNew05.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:new} 2 | 3 | class Foo 4 | { 5 | void Bar() 6 | { 7 | System.Text.StringBuilder("aa").new{caret} 8 | } 9 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestNew05.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:new} 2 | 3 | class Foo 4 | { 5 | void Bar() 6 | { 7 | new System.Text.StringBuilder("aa"){caret} 8 | } 9 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestNew06.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:new} 2 | 3 | class Foo 4 | { 5 | void Bar() 6 | { 7 | Unresolved.new{caret} 8 | } 9 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestNew06.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:new} 2 | 3 | class Foo 4 | { 5 | void Bar() 6 | { 7 | new Unresolved({caret}) 8 | } 9 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestNew07.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:new} 2 | // ${PARENS:None} 3 | 4 | class Foo 5 | { 6 | void Bar() 7 | { 8 | Unresolved.new{caret} 9 | } 10 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestNew07.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:new} 2 | // ${PARENS:None} 3 | 4 | class Foo 5 | { 6 | void Bar() 7 | { 8 | new Unresolved{caret} 9 | } 10 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestNew08.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:new} 2 | // ${PARENS:Left} 3 | 4 | class Foo 5 | { 6 | void Bar() 7 | { 8 | Unresolved.new{caret} 9 | } 10 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestNew08.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:new} 2 | // ${PARENS:Left} 3 | 4 | class Foo 5 | { 6 | void Bar() 7 | { 8 | new Unresolved({caret} 9 | } 10 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestNot01.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:not} 2 | 3 | public class Foo 4 | { 5 | public void Bar(bool b, int i) 6 | { 7 | b && i > 10 8 | .{caret} 9 | } 10 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestNot01.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:not} 2 | 3 | public class Foo 4 | { 5 | public void Bar(bool b, int i) 6 | { 7 | b && i <= 10{caret} 8 | } 9 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestNot02.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:not} 2 | 3 | class Foo 4 | { 5 | void Bar(bool b) 6 | { 7 | !b.{caret} 8 | } 9 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestNot02.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:not} 2 | 3 | class Foo 4 | { 5 | void Bar(bool b) 6 | { 7 | b{caret} 8 | } 9 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestNot03.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:not} 2 | 3 | class Foo 4 | { 5 | void Bar(int a, bool b, int[] xs) 6 | { 7 | !b.{caret} 8 | (a < 0 ? xs : xs)[0] = 42; 9 | } 10 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestNot03.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:not} 2 | 3 | class Foo 4 | { 5 | void Bar(int a, bool b, int[] xs) 6 | { 7 | b{caret}; 8 | (a < 0 ? xs : xs)[0] = 42; 9 | } 10 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestNotNull01.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:notnull} 2 | 3 | public class Foo 4 | { 5 | public void Bar(object a, System.Action f) 6 | { 7 | var b = a as String(); 8 | b.nn{caret} 9 | f(); 10 | } 11 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestNotNull01.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:notnull} 2 | 3 | public class Foo 4 | { 5 | public void Bar(object a, System.Action f) 6 | { 7 | var b = a as String(); 8 | if (b != null) 9 | { 10 | {caret} 11 | } 12 | f(); 13 | } 14 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestNotNull02.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:notnull} 2 | 3 | class Person 4 | { 5 | private string myName; 6 | 7 | public Person(string name) 8 | { 9 | (myName = name.nn{caret}); 10 | } 11 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestNotNull02.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:notnull} 2 | 3 | class Person 4 | { 5 | private string myName; 6 | 7 | public Person(string name) 8 | { 9 | ((myName = name) != null{caret}); 10 | } 11 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestPar01.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:par} 2 | 3 | class C { 4 | C M() { 5 | C c = new C().M().pa{caret} 6 | return c; 7 | } 8 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestPar01.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:par} 2 | 3 | class C { 4 | C M() { 5 | C c = (new C().M()){caret} 6 | return c; 7 | } 8 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestProp01.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:prop} 2 | 3 | class Person 4 | { 5 | public string Name { get; set; } 6 | 7 | public Person(string name) 8 | { 9 | Name = name; 10 | name.pr{caret} 11 | } 12 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestProp01.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:prop} 2 | 3 | class Person 4 | { 5 | public string Name { get; set; } 6 | public string S { get; set; } 7 | 8 | public Person(string name) 9 | { 10 | Name = name; 11 | S = name;{caret} 12 | } 13 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestReturn01.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:return} 2 | 3 | class A 4 | { 5 | static string Foo() 6 | { 7 | aaaa 8 | System.Console.ReadLine() 9 | . 10 | 11 | 12 | ret{caret}; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestReturn01.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:return} 2 | 3 | class A 4 | { 5 | static string Foo() 6 | { 7 | aaaa 8 | return System.Console.ReadLine();{caret} 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestReturn02.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:return} 2 | 3 | class A 4 | { 5 | static string Foo() 6 | { 7 | aaaa 8 | System.Console.ReadLine() 9 | . 10 | 11 | 12 | ret{caret} 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestReturn02.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:return} 2 | 3 | class A 4 | { 5 | static string Foo() 6 | { 7 | aaaa 8 | return System.Console.ReadLine();{caret} 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestReturn03.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:return} 2 | 3 | class A 4 | { 5 | static string Foo() 6 | { 7 | null.{caret} 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestReturn03.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:return} 2 | 3 | class A 4 | { 5 | static string Foo() 6 | { 7 | return null;{caret} 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestReturn04.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:return} 2 | 3 | class A 4 | { 5 | System.Action Foo() 6 | { 7 | (() => { }).{caret} 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestReturn04.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:return} 2 | 3 | class A 4 | { 5 | System.Action Foo() 6 | { 7 | return () => { };{caret} 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestReturn05.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:return} 2 | 3 | class A 4 | { 5 | A Foo(object o) 6 | { 7 | o as A.ret{caret} 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestReturn05.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:return} 2 | 3 | class A 4 | { 5 | A Foo(object o) 6 | { 7 | return o as A;{caret} 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestReturn06.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:return} 2 | 3 | class A 4 | { 5 | A Foo(object o) 6 | { 7 | o 8 | as 9 | A 10 | 11 | 12 | .ret{caret} 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestReturn06.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:return} 2 | 3 | class A 4 | { 5 | A Foo(object o) 6 | { 7 | return o 8 | as 9 | A;{caret} 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestThrow01.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:throw} 2 | 3 | class Foo 4 | { 5 | void Bar() 6 | { 7 | new System.Exception().{caret} 8 | } 9 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestThrow01.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:throw} 2 | 3 | class Foo 4 | { 5 | void Bar() 6 | { 7 | throw new System.Exception();{caret} 8 | } 9 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestThrow02.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:throw} 2 | 3 | class Foo 4 | { 5 | void Bar() 6 | { 7 | System.Exception.{caret} 8 | } 9 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestThrow02.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:throw} 2 | 3 | class Foo 4 | { 5 | void Bar() 6 | { 7 | throw new System.Exception({caret}); 8 | } 9 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestThrow03.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:throw} 2 | 3 | class Foo 4 | { 5 | void Bar() 6 | { 7 | E.throw{caret} 8 | 9 | var t = 123; 10 | } 11 | 12 | class E : System.Exception 13 | { 14 | public E(string name) { } 15 | } 16 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestThrow03.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:throw} 2 | 3 | class Foo 4 | { 5 | void Bar() 6 | { 7 | throw new E({caret}); 8 | 9 | var t = 123; 10 | } 11 | 12 | class E : System.Exception 13 | { 14 | public E(string name) { } 15 | } 16 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestThrow04.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:throw} 2 | 3 | class Foo 4 | { 5 | void Bar() 6 | { 7 | E.throw{caret} 8 | 9 | var t = 123; 10 | } 11 | 12 | class E : System.Exception 13 | { 14 | public E() { } 15 | } 16 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestThrow04.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:throw} 2 | 3 | class Foo 4 | { 5 | void Bar() 6 | { 7 | throw new E();{caret} 8 | 9 | var t = 123; 10 | } 11 | 12 | class E : System.Exception 13 | { 14 | public E() { } 15 | } 16 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestThrow05.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:throw} 2 | 3 | class Foo { 4 | void M() { 5 | System.Exception("message").{caret} 6 | } 7 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestThrow05.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:throw} 2 | 3 | class Foo { 4 | void M() 5 | { 6 | throw new System.Exception("message");{caret} 7 | } 8 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestThrow06.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:throw} 2 | // ${PARENS:Left} 3 | 4 | class Foo { 5 | void M() { 6 | System.Exception.{caret} 7 | } 8 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestThrow06.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:throw} 2 | // ${PARENS:Left} 3 | 4 | class Foo { 5 | void M() 6 | { 7 | throw new System.Exception({caret} 8 | } 9 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestThrow07.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:throw} 2 | // ${PARENS:None} 3 | 4 | class Foo { 5 | void M() { 6 | System.Exception.{caret} 7 | } 8 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestThrow07.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:throw} 2 | // ${PARENS:None} 3 | 4 | class Foo { 5 | void M() 6 | { 7 | throw new System.Exception{caret} 8 | } 9 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestThrow08.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:throw} 2 | // ${PARENS:None} 3 | 4 | class Foo { 5 | void M() { 6 | Unresolved.{caret} 7 | } 8 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestThrow08.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:throw} 2 | // ${PARENS:None} 3 | 4 | class Foo { 5 | void M() 6 | { 7 | throw new Unresolved{caret} 8 | } 9 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestTo01.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:to} 2 | 3 | class Foo 4 | { 5 | void Bar() 6 | { 7 | (new string('a', 42)).{caret} 8 | } 9 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestTo01.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:to} 2 | 3 | class Foo 4 | { 5 | void Bar() 6 | { 7 | target = new string('a', 42);{caret} 8 | } 9 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestTypeof01.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:typeof} 2 | 3 | class C { 4 | void M() { 5 | int.typeof{caret} 6 | } 7 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestTypeof01.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:typeof} 2 | 3 | class C { 4 | void M() { 5 | typeof (int){caret} 6 | } 7 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestUsing01.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:using} 2 | 3 | public class Foo : System.IDisposable 4 | { 5 | public void Bar() 6 | { 7 | new Foo().u{caret} 8 | } 9 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestUsing01.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:using} 2 | 3 | public class Foo : System.IDisposable 4 | { 5 | public void Bar() 6 | { 7 | using (var foo = new Foo()) 8 | { 9 | {caret} 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestUsing02.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:using} 2 | 3 | public class Foo : System.IDisposable 4 | { 5 | public void Bar() 6 | { 7 | var foo = new Foo(); 8 | foo.u{caret} 9 | } 10 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestUsing02.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:using} 2 | 3 | public class Foo : System.IDisposable 4 | { 5 | public void Bar() 6 | { 7 | var foo = new Foo(); 8 | using (foo) 9 | { 10 | {caret} 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestUsing03.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:using} 2 | 3 | public class Foo 4 | { 5 | public void Bar() 6 | { 7 | StartTransaction().u{caret} 8 | } 9 | 10 | public System.IDisposable StartTransaction() { return null; } 11 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestUsing03.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:using} 2 | 3 | public class Foo 4 | { 5 | public void Bar() 6 | { 7 | using (StartTransaction()) 8 | { 9 | {caret} 10 | } 11 | } 12 | 13 | public System.IDisposable StartTransaction() { return null; } 14 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestUsing04.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:using} 2 | 3 | public class Foo 4 | { 5 | public void Bar() 6 | { 7 | using (StartTransaction()) 8 | { 9 | StartTransaction().{caret} 10 | } 11 | } 12 | 13 | public System.IDisposable StartTransaction() { return null; } 14 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestUsing04.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:using} 2 | 3 | public class Foo 4 | { 5 | public void Bar() 6 | { 7 | using (StartTransaction()) 8 | { 9 | using (StartTransaction()) 10 | { 11 | {caret} 12 | } 13 | } 14 | } 15 | 16 | public System.IDisposable StartTransaction() { return null; } 17 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestUsing40.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:using} 2 | 3 | public class CoolType : System.IDisposable 4 | { 5 | public CoolType GetSomething() 6 | { 7 | GetSomething().u{caret} 8 | using (var coolType = GetSomething()) { } 9 | } 10 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestUsing40.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:using} 2 | 3 | public class CoolType : System.IDisposable 4 | { 5 | public CoolType GetSomething() 6 | { 7 | using (var coolType = GetSomething()) {caret} 8 | using (var coolType = GetSomething()) { } 9 | } 10 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestVar01.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:var} 2 | 3 | class Foo 4 | { 5 | private string myField; 6 | string Bar(object x) 7 | { 8 | System.Console.ReadLine().{caret} 9 | myField = System.Console.ReadLine(); 10 | } 11 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestVar01.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:var} 2 | 3 | class Foo 4 | { 5 | private string myField; 6 | string Bar(object x) 7 | { 8 | var readLine = System.Console.ReadLine();{caret} 9 | myField = System.Console.ReadLine(); 10 | } 11 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestVar02.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:var} 2 | 3 | class Foo 4 | { 5 | private string myField; 6 | string Bar(object x) 7 | { 8 | System.Console.ReadLine().{caret}; 9 | myField = System.Console.ReadLine(); 10 | } 11 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestVar02.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:var} 2 | 3 | class Foo 4 | { 5 | private string myField; 6 | string Bar(object x) 7 | { 8 | var readLine = System.Console.ReadLine();{caret} 9 | myField = System.Console.ReadLine(); 10 | } 11 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestVar03.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:var} 2 | 3 | class Foo 4 | { 5 | void Bar(object x) 6 | { 7 | x as System.String.{caret} 8 | var foo = System.Console.ReadLine(); 9 | } 10 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestVar03.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:var} 2 | 3 | class Foo 4 | { 5 | void Bar(object x) 6 | { 7 | var s = x as System.String;{caret} 8 | var foo = System.Console.ReadLine(); 9 | } 10 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestVar04.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:var} 2 | 3 | class Foo 4 | { 5 | void Bar(object x) 6 | { 7 | int referenceName; 8 | 9 | Boo1() && Boo2().{caret} 10 | referenceName = Blah(); 11 | } 12 | 13 | bool Boo1() { return true; } 14 | bool Boo2() { return true; } 15 | int Blah() { return 123; } 16 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestVar04.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:var} 2 | 3 | class Foo 4 | { 5 | void Bar(object x) 6 | { 7 | int referenceName; 8 | 9 | var b = Boo1() && Boo2();{caret} 10 | referenceName = Blah(); 11 | } 12 | 13 | bool Boo1() { return true; } 14 | bool Boo2() { return true; } 15 | int Blah() { return 123; } 16 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestVar05.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:var} 2 | 3 | class Foo 4 | { 5 | void Bar() 6 | { 7 | Foo.{caret} 8 | } 9 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestVar05.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:var} 2 | 3 | class Foo 4 | { 5 | void Bar() 6 | { 7 | var foo = new Foo();{caret} 8 | } 9 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestVar06.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:var} 2 | 3 | class Foo 4 | { 5 | Foo(string s) { } 6 | void Bar() 7 | { 8 | Foo.var{caret} 9 | } 10 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestVar06.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:var} 2 | 3 | class Foo 4 | { 5 | Foo(string s) { } 6 | void Bar() 7 | { 8 | var foo = new Foo({caret}); 9 | } 10 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestVar07.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:var} 2 | 3 | class Foo { 4 | void Bar() { 5 | var padRight = new string('d', 100).Substring(0).var{caret}.PadRight(10); 6 | } 7 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestVar07.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:var} 2 | 3 | class Foo { 4 | void Bar() 5 | { 6 | var substring = new string('d', 100).Substring(0); 7 | var padRight = substring{caret}.PadRight(10); 8 | } 9 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestVar08.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:var} 2 | 3 | class Foo { 4 | void Bar(string a) { 5 | Bar(a + a.{caret}); 6 | } 7 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestVar08.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:var} 2 | 3 | class Foo { 4 | void Bar(string a) 5 | { 6 | var s = a + a; 7 | Bar(s{caret}); 8 | } 9 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestVar09.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:var} 2 | 3 | class Foo { 4 | void Bar(string a) { 5 | Bar(a + Foo.{caret}); 6 | } 7 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestVar09.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:var} 2 | 3 | class Foo { 4 | void Bar(string a) 5 | { 6 | var foo = new Foo();{caret} 7 | Bar(a + foo); 8 | } 9 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestVar10.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:var} 2 | 3 | using System; 4 | using System.Linq; 5 | 6 | class Program 7 | { 8 | static void Main(string[] args) 9 | { 10 | var ts = from x in args 11 | select x.v{caret} + 1; 12 | } 13 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestVar10.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:var} 2 | 3 | using System; 4 | using System.Linq; 5 | 6 | class Program 7 | { 8 | static void Main(string[] args) 9 | { 10 | var ts = from x in args 11 | let x1 = x 12 | select x1{caret} + 1; 13 | } 14 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestVar11.cs: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:var} 2 | 3 | using System; 4 | using System.Text; 5 | 6 | class Program 7 | { 8 | static void Main(string[] args) 9 | { 10 | StringBuilder("initial text").{caret}; 11 | } 12 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/Completion/TestVar11.cs.gold: -------------------------------------------------------------------------------- 1 | // ${COMPLETE_ITEM:var} 2 | 3 | using System; 4 | using System.Text; 5 | 6 | class Program 7 | { 8 | static void Main(string[] args) 9 | { 10 | var stringBuilder = new StringBuilder("initial text");{caret} 11 | } 12 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Data/nuget.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /PostfixTemplates/Tests/PostfixTestBase.cs: -------------------------------------------------------------------------------- 1 | using JetBrains.ReSharper.FeaturesTestFramework.Completion; 2 | 3 | namespace JetBrains.ReSharper.PostfixTemplates 4 | { 5 | public abstract class PostfixCodeCompletionTestBase : CodeCompletionTestBase 6 | { 7 | protected override CodeCompletionTestType TestType 8 | { 9 | get { return CodeCompletionTestType.Action; } 10 | } 11 | 12 | protected override bool CheckAutomaticCompletionDefault() { return true; } 13 | } 14 | 15 | public abstract class PostfixCodeCompletionListTestBase : CodeCompletionTestBase 16 | { 17 | protected override CodeCompletionTestType TestType 18 | { 19 | get { return CodeCompletionTestType.List; } 20 | } 21 | 22 | protected override bool CheckAutomaticCompletionDefault() { return true; } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /PostfixTemplates/Tests/PostfixTestsAssembly.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Reflection; 3 | using JetBrains.Annotations; 4 | using JetBrains.Application; 5 | using JetBrains.ReSharper.PostfixTemplates; 6 | using JetBrains.Threading; 7 | using NUnit.Framework; 8 | using JetBrains.Application.BuildScript.Application.Zones; 9 | using JetBrains.TestFramework; 10 | using JetBrains.ReSharper.Resources.Shell; 11 | using JetBrains.ReSharper.TestFramework; 12 | using JetBrains.TestFramework.Application.Zones; 13 | // ReSharper disable CheckNamespace 14 | 15 | #pragma warning disable 618 16 | [assembly: TestDataPathBase(@".\Data\Completion")] 17 | #pragma warning restore 618 18 | 19 | [ZoneDefinition] 20 | public class IPostfixTestEnvironmentZone : ITestsZone, IRequire 21 | { 22 | } 23 | 24 | [SetUpFixture] 25 | public class ReSharperTestEnvironmentAssembly : ExtensionTestEnvironmentAssembly 26 | { 27 | //[NotNull] 28 | //private static IEnumerable GetAssembliesToLoad() 29 | //{ 30 | // yield return typeof(PostfixTemplatesManager<>).Assembly; 31 | // yield return Assembly.GetExecutingAssembly(); 32 | //} 33 | // 34 | //public override void SetUp() 35 | //{ 36 | // base.SetUp(); 37 | // 38 | // ReentrancyGuard.Current.Execute("LoadAssemblies", () => { 39 | // var assemblyManager = Shell.Instance.GetComponent(); 40 | // assemblyManager.LoadAssemblies(GetType().Name, GetAssembliesToLoad()); 41 | // }); 42 | //} 43 | // 44 | //public override void TearDown() 45 | //{ 46 | // ReentrancyGuard.Current.Execute("UnloadAssemblies", () => { 47 | // var assemblyManager = Shell.Instance.GetComponent(); 48 | // assemblyManager.UnloadAssemblies(GetType().Name, GetAssembliesToLoad()); 49 | // }); 50 | // 51 | // base.TearDown(); 52 | //} 53 | } -------------------------------------------------------------------------------- /PostfixTemplates/Tests/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | 3 | [assembly: AssemblyTitle("PostfixTemplates.Tests")] 4 | [assembly: AssemblyDescription("Templating/code completion plugin for ReSharper tests")] 5 | [assembly: AssemblyConfiguration("")] 6 | [assembly: AssemblyCompany("Shvedov Alexander")] 7 | [assembly: AssemblyProduct("Postfix Templates")] 8 | [assembly: AssemblyCopyright("Copyright © Shvedov Alexander, 2013")] 9 | [assembly: AssemblyTrademark("")] 10 | [assembly: AssemblyCulture("")] 11 | 12 | [assembly: AssemblyVersion("2.2.3")] 13 | [assembly: AssemblyFileVersion("1.0.0.0")] -------------------------------------------------------------------------------- /PostfixTemplates/Tests/ZoneMarker.cs: -------------------------------------------------------------------------------- 1 | using JetBrains.Application.BuildScript.Application.Zones; 2 | using JetBrains.ReSharper.Feature.Services; 3 | using JetBrains.ReSharper.Psi.CSharp; 4 | 5 | namespace JetBrains.ReSharper.PostfixTemplates 6 | { 7 | [ZoneMarker] 8 | public class ZoneMarker : IRequire, IRequire, IRequire 9 | { } 10 | } -------------------------------------------------------------------------------- /PostfixTemplates/ZoneMarker.cs: -------------------------------------------------------------------------------- 1 | using JetBrains.Application.BuildScript.Application.Zones; 2 | using JetBrains.ReSharper.Feature.Services; 3 | using JetBrains.ReSharper.Psi.CSharp; 4 | 5 | namespace JetBrains.ReSharper.PostfixTemplates 6 | { 7 | [ZoneMarker] 8 | public class ZoneMarker : IRequire, IRequire { } 9 | } -------------------------------------------------------------------------------- /build.ps1: -------------------------------------------------------------------------------- 1 | $config = 'Debug' 2 | $nuspec_file = 'PostfixTemplates.nuspec' 3 | $package_id = 'ReSharper.Postfix' 4 | 5 | # 9.1 6 | # nuget pack $nuspec_file -Exclude 'PostfixTemplates\bin.R92\**' -Properties "Configuration=$config;ReSharperDep=Wave;ReSharperVer=[2.0,3.0);PackageId=$package_id.R90" 7 | 8 | # 9.2 9 | nuget pack $nuspec_file -Exclude 'PostfixTemplates\bin.R91\**' -Properties "Configuration=$config;ReSharperDep=Wave;ReSharperVer=[3.0,4.0);PackageId=$package_id.R90" --------------------------------------------------------------------------------