Skip to content
This repository has been archived by the owner on Oct 16, 2020. It is now read-only.

Commit

Permalink
Disabled out name filter for create field,property and method.
Browse files Browse the repository at this point in the history
  • Loading branch information
mkrueger committed Mar 27, 2012
1 parent b1dfdba commit 62ebfc7
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 28 deletions.
Expand Up @@ -66,10 +66,10 @@ public IEnumerable<CodeAction> GetActions(RefactoringContext context)
var state = context.GetResolverStateBefore(identifier);
bool isStatic = state.CurrentMember.IsStatic;

var service = (NamingConventionService)context.GetService(typeof(NamingConventionService));
if (service != null && !service.IsValidName(identifier.Identifier, AffectedEntity.Field, Modifiers.Private, isStatic)) {
yield break;
}
// var service = (NamingConventionService)context.GetService(typeof(NamingConventionService));
// if (service != null && !service.IsValidName(identifier.Identifier, AffectedEntity.Field, Modifiers.Private, isStatic)) {
// yield break;
// }

yield return new CodeAction(context.TranslateString("Create field"), script => {
var decl = new FieldDeclaration() {
Expand Down
Expand Up @@ -132,10 +132,10 @@ public IEnumerable<CodeAction> GetActionsFromInvocation(RefactoringContext conte
isStatic = invocation.Target is IdentifierExpression && state.CurrentMember.IsStatic;
}

var service = (NamingConventionService)context.GetService(typeof(NamingConventionService));
if (service != null && !service.IsValidName(methodName, AffectedEntity.Method, Modifiers.Private, isStatic)) {
yield break;
}
// var service = (NamingConventionService)context.GetService(typeof(NamingConventionService));
// if (service != null && !service.IsValidName(methodName, AffectedEntity.Method, Modifiers.Private, isStatic)) {
// yield break;
// }

yield return new CodeAction(context.TranslateString("Create method"), script => {
var decl = new MethodDeclaration() {
Expand Down
Expand Up @@ -83,10 +83,10 @@ public IEnumerable<CodeAction> GetActions(RefactoringContext context)
isStatic = identifier is IdentifierExpression && state.CurrentMember.IsStatic;
}

var service = (NamingConventionService)context.GetService(typeof(NamingConventionService));
if (service != null && !service.IsValidName(propertyName, AffectedEntity.Property, Modifiers.Private, isStatic)) {
yield break;
}
// var service = (NamingConventionService)context.GetService(typeof(NamingConventionService));
// if (service != null && !service.IsValidName(propertyName, AffectedEntity.Property, Modifiers.Private, isStatic)) {
// yield break;
// }

yield return new CodeAction(context.TranslateString("Create property"), script => {
var decl = new PropertyDeclaration() {
Expand Down
Expand Up @@ -32,22 +32,7 @@ namespace ICSharpCode.NRefactory.CSharp.CodeActions
[TestFixture]
public class CreateFieldTests : ContextActionTestBase
{
[Test()]
public void TestWrongContext1 ()
{
TestWrongContext<CreateFieldAction> (
"using System;" + Environment.NewLine +
"class TestClass" + Environment.NewLine +
"{" + Environment.NewLine +
" void Test ()" + Environment.NewLine +
" {" + Environment.NewLine +
" Console.WriteLine ($Foo);" + Environment.NewLine +
" }" + Environment.NewLine +
"}"
);
}

[Test()]
[Test()]
public void TestWrongContext2 ()
{
TestWrongContext<CreateFieldAction> (
Expand Down

0 comments on commit 62ebfc7

Please sign in to comment.