public EnvDTE.CodeEnum AddEnum(string name, object position, object bases, EnvDTE.vsCMAccess access) { return(EnsureEditor(() => { return AddEnum(GetSyntaxRoot(), name, position, bases, access); })); }
public EnvDTE.CodeEnum AddEnum(string name, object position, object bases, EnvDTE.vsCMAccess access) { return(FileCodeModel.EnsureEditor(() => { return FileCodeModel.AddEnum(LookupNode(), name, position, bases, access); })); }
public EnvDTE80.CodeEvent AddEvent( string name, string fullDelegateName, bool createPropertyStyleEvent, object position, EnvDTE.vsCMAccess access ) => throw Exceptions.ThrowEFail();
public EnvDTE.CodeFunction AddFunction( string name, EnvDTE.vsCMFunction kind, object type, object position, EnvDTE.vsCMAccess access ) => throw Exceptions.ThrowEFail();
public EnvDTE.CodeFunction AddFunction( string name, object location, EnvDTE.vsCMFunction kind, object type, object position, EnvDTE.vsCMAccess access ) => GetFileCodeModel(location).Object.AddFunction(name, kind, type, position, access);
public EnvDTE.CodeProperty AddProperty( string getterName, string putterName, object type, object position, EnvDTE.vsCMAccess access, object location ) => throw Exceptions.ThrowEFail();
public EnvDTE.CodeProperty EncapsulateFieldNoUI( EnvDTE.CodeVariable variable, string propertyName, EnvDTE.vsCMAccess accessibility, ReferenceSelectionEnum refSelection, PropertyTypeEnum propertyType, bool fPreview, bool fSearchComments ) => throw new NotImplementedException();
private static CodeGenerationOptions GetCodeGenerationOptions( EnvDTE.vsCMAccess access, ParseOptions parseOptions) { var generateDefaultAccessibility = (access & EnvDTE.vsCMAccess.vsCMAccessDefault) == 0; return(new CodeGenerationOptions( generateDefaultAccessibility: generateDefaultAccessibility, parseOptions: parseOptions)); }
protected SyntaxNode CreateConstructorDeclaration( SyntaxNode containerNode, string typeName, EnvDTE.vsCMAccess access ) { var destination = CodeModelService.GetDestination(containerNode); var newMethodSymbol = CodeGenerationSymbolFactory.CreateConstructorSymbol( attributes: default,
internal void UpdateAccess(SyntaxNode node, EnvDTE.vsCMAccess access) { node = CodeModelService.GetNodeWithModifiers(node); var updatedNode = CodeModelService.SetAccess(node, access); if (node != updatedNode) { UpdateNode(node, updatedNode); } }
internal EnvDTE.CodeProperty AddProperty( SyntaxNode containerNode, string getterName, string putterName, object type, object position, EnvDTE.vsCMAccess access ) { var isGetterPresent = !string.IsNullOrEmpty(getterName); var isPutterPresent = !string.IsNullOrEmpty(putterName); if ( (!isGetterPresent && !isPutterPresent) || (isGetterPresent && isPutterPresent && getterName != putterName) ) { throw Exceptions.ThrowEInvalidArg(); } var containerNodePosition = containerNode.SpanStart; var semanticModel = GetSemanticModel(); var options = State.ThreadingContext.JoinableTaskFactory.Run( () => GetDocument().GetOptionsAsync(CancellationToken.None) ); var propertyType = CodeModelService.GetTypeSymbol( type, semanticModel, containerNodePosition ); var newProperty = CreatePropertyDeclaration( containerNode, CodeModelService.GetUnescapedName(isGetterPresent ? getterName : putterName), isGetterPresent, isPutterPresent, access, propertyType, options ); var insertionIndex = CodeModelService.PositionVariantToMemberInsertionIndex( position, containerNode, fileCodeModel: this ); newProperty = InsertMember(containerNode, newProperty, insertionIndex); return((EnvDTE.CodeProperty)CreateInternalCodeMember( this.State, fileCodeModel: this, node: newProperty )); }
private static CodeGenerationContextInfo GetCodeGenerationContextInfo( SyntaxNode containerNode, CodeGenerationOptions options, EnvDTE.vsCMAccess access = EnvDTE.vsCMAccess.vsCMAccessDefault, bool generateMethodBodies = true) { var generateDefaultAccessibility = (access & EnvDTE.vsCMAccess.vsCMAccessDefault) == 0; return(options.GetInfo( new CodeGenerationContext( generateDefaultAccessibility: generateDefaultAccessibility, generateMethodBodies: generateMethodBodies), containerNode.SyntaxTree.Options)); }
public EnvDTE.CodeDelegate AddDelegate( string name, object type, object position, EnvDTE.vsCMAccess access ) { return(EnsureEditor( () => { return AddDelegate(GetSyntaxRoot(), name, type, position, access); } )); }
public EnvDTE.CodeDelegate AddDelegate( string name, object type, object position, EnvDTE.vsCMAccess access = EnvDTE.vsCMAccess.vsCMAccessDefault ) { return(FileCodeModel.EnsureEditor( () => { return FileCodeModel.AddDelegate(LookupNode(), name, type, position, access); } )); }
public EnvDTE.CodeInterface AddInterface( string name, object position, object bases, EnvDTE.vsCMAccess access = EnvDTE.vsCMAccess.vsCMAccessDefault ) { return(FileCodeModel.EnsureEditor( () => { return FileCodeModel.AddInterface(LookupNode(), name, position, bases, access); } )); }
public EnvDTE.CodeStruct AddStruct( string name, object location, object position, object bases, object implementedInterfaces, EnvDTE.vsCMAccess access ) => GetFileCodeModel(location).Object.AddStruct( name, position, bases, implementedInterfaces, access );
private CodeGenerationOptions GetCodeGenerationOptions( SyntaxNode containerNode, OptionSet?options = null, EnvDTE.vsCMAccess access = EnvDTE.vsCMAccess.vsCMAccessDefault, bool generateMethodBodies = true) { var generateDefaultAccessibility = (access & EnvDTE.vsCMAccess.vsCMAccessDefault) == 0; return(CodeGenerationService.GetOptions( containerNode.SyntaxTree.Options, options ?? Workspace.Options, new CodeGenerationContext( generateDefaultAccessibility: generateDefaultAccessibility, generateMethodBodies: generateMethodBodies))); }
public EnvDTE.CodeVariable AddVariable( string name, object type, object position, EnvDTE.vsCMAccess access, object location ) { return(FileCodeModel.EnsureEditor( () => { return FileCodeModel.AddVariable(LookupNode(), name, type, position, access); } )); }
internal EnvDTE.CodeStruct AddStruct( SyntaxNode containerNode, string name, object position, object bases, object implementedInterfaces, EnvDTE.vsCMAccess access ) #pragma warning restore IDE0060 // Remove unused parameter { var containerNodePosition = containerNode.SpanStart; var semanticModel = GetSemanticModel(); var implementedInterfaceArray = GetValidArray(bases, allowMultipleElements: true); var implementedInterfaceSymbols = Array.ConvertAll( implementedInterfaceArray, i => (INamedTypeSymbol)CodeModelService.GetTypeSymbol( i, semanticModel, containerNodePosition ) ); var newType = CreateTypeDeclaration( containerNode, TypeKind.Struct, CodeModelService.GetUnescapedName(name), access, implementedInterfaces: implementedInterfaceSymbols.ToImmutableArray() ); var insertionIndex = CodeModelService.PositionVariantToMemberInsertionIndex( position, containerNode, fileCodeModel: this ); newType = InsertMember(containerNode, newType, insertionIndex); return((EnvDTE.CodeStruct)CreateInternalCodeMember( this.State, fileCodeModel: this, node: newType )); }
private CodeGenerationContextInfo GetCodeGenerationContextInfo( SyntaxNode containerNode, OptionSet?options = null, EnvDTE.vsCMAccess access = EnvDTE.vsCMAccess.vsCMAccessDefault, bool generateMethodBodies = true) { var generateDefaultAccessibility = (access & EnvDTE.vsCMAccess.vsCMAccessDefault) == 0; var globalOptions = State.ProjectCodeModelFactory.GlobalOptions; var languageServices = Workspace.Services.GetLanguageServices(containerNode.SyntaxTree.Options.Language); var fallbackOptions = globalOptions.GetCodeGenerationOptions(languageServices); var codeGenOptions = CodeGenerationOptions.Create(options ?? Workspace.Options, fallbackOptions, languageServices); return(codeGenOptions.GetInfo( new CodeGenerationContext( generateDefaultAccessibility: generateDefaultAccessibility, generateMethodBodies: generateMethodBodies), containerNode.SyntaxTree.Options)); }
public EnvDTE80.CodeEvent AddEvent( string name, string fullDelegateName, bool createPropertyStyleEvent, object position, EnvDTE.vsCMAccess access ) { return(FileCodeModel.EnsureEditor( () => { return FileCodeModel.AddEvent( LookupNode(), name, fullDelegateName, createPropertyStyleEvent, position, access ); } )); }
public EnvDTE.CodeStruct AddStruct( string name, object position, object bases, object implementedInterfaces, EnvDTE.vsCMAccess access ) { return(EnsureEditor( () => { return AddStruct( GetSyntaxRoot(), name, position, bases, implementedInterfaces, access ); } )); }
public EnvDTE.CodeClass AddClass( string name, object position, object bases, object implementedInterfaces, EnvDTE.vsCMAccess access ) { return(FileCodeModel.EnsureEditor( () => { return FileCodeModel.AddClass( LookupNode(), name, position, bases, implementedInterfaces, access ); } )); }
public EnvDTE.CodeFunction AddFunction( string name, EnvDTE.vsCMFunction kind, object type, object position, EnvDTE.vsCMAccess access ) { return(FileCodeModel.EnsureEditor( () => { return FileCodeModel.AddFunction( LookupNode(), name, kind, type, position, access ); } )); }
public EnvDTE80.CodeEvent AddEvent( SyntaxNode containerNode, string name, string fullDelegateName, bool createPropertyStyleEvent, object position, EnvDTE.vsCMAccess access ) { var containerNodePosition = containerNode.SpanStart; var semanticModel = GetSemanticModel(); var eventType = (INamedTypeSymbol)CodeModelService.GetTypeSymbol( fullDelegateName, semanticModel, containerNodePosition ); var newEvent = CreateEventDeclaration( containerNode, CodeModelService.GetUnescapedName(name), access, eventType, createPropertyStyleEvent ); var insertionIndex = CodeModelService.PositionVariantToMemberInsertionIndex( position, containerNode, fileCodeModel: this ); newEvent = InsertMember(containerNode, newEvent, insertionIndex); return((EnvDTE80.CodeEvent)CreateInternalCodeMember( this.State, fileCodeModel: this, node: newEvent )); }
public EnvDTE80.CodeEvent AddEvent( string name, string fullDelegateName, bool createPropertyStyleEvent, object position, EnvDTE.vsCMAccess access ) { return(FileCodeModel.EnsureEditor( () => { // Note: C# always creates field-like events in interfaces return FileCodeModel.AddEvent( LookupNode(), name, fullDelegateName, false, position, access ); } )); }
public EnvDTE.CodeProperty AddProperty( string getterName, string putterName, object type, object position, EnvDTE.vsCMAccess access, object location ) { return(FileCodeModel.EnsureEditor( () => { return FileCodeModel.AddProperty( LookupNode(), getterName, putterName, type, position, access ); } )); }
internal EnvDTE.CodeDelegate AddDelegate( SyntaxNode containerNode, string name, object type, object position, EnvDTE.vsCMAccess access ) { var containerNodePosition = containerNode.SpanStart; var semanticModel = GetSemanticModel(); var returnType = (INamedTypeSymbol)CodeModelService.GetTypeSymbol( type, semanticModel, containerNodePosition ); var newType = CreateDelegateTypeDeclaration( containerNode, CodeModelService.GetUnescapedName(name), access, returnType ); var insertionIndex = CodeModelService.PositionVariantToMemberInsertionIndex( position, containerNode, fileCodeModel: this ); newType = InsertMember(containerNode, newType, insertionIndex); return((EnvDTE.CodeDelegate)CreateInternalCodeMember( this.State, fileCodeModel: this, node: newType )); }
internal EnvDTE.CodeEnum AddEnum( SyntaxNode containerNode, string name, object position, object bases, EnvDTE.vsCMAccess access ) #pragma warning restore IDE0060 // Remove unused parameter { var newType = CreateTypeDeclaration(containerNode, TypeKind.Enum, name, access); var insertionIndex = CodeModelService.PositionVariantToMemberInsertionIndex( position, containerNode, fileCodeModel: this ); newType = InsertMember(containerNode, newType, insertionIndex); return((EnvDTE.CodeEnum)CreateInternalCodeMember( this.State, fileCodeModel: this, node: newType )); }
internal EnvDTE.CodeFunction AddFunction(SyntaxNode containerNode, string name, EnvDTE.vsCMFunction kind, object type, object position, EnvDTE.vsCMAccess access) { kind = CodeModelService.ValidateFunctionKind(containerNode, kind, name); SyntaxNode newMember; if (kind == EnvDTE.vsCMFunction.vsCMFunctionSub || kind == EnvDTE.vsCMFunction.vsCMFunctionFunction) { var containerNodePosition = containerNode.SpanStart; var semanticModel = GetSemanticModel(); var returnType = kind == EnvDTE.vsCMFunction.vsCMFunctionFunction ? CodeModelService.GetTypeSymbol(type, semanticModel, containerNodePosition) : semanticModel.Compilation.GetSpecialType(SpecialType.System_Void); newMember = CreateMethodDeclaration(containerNode, CodeModelService.GetUnescapedName(name), access, returnType); } else if (kind == EnvDTE.vsCMFunction.vsCMFunctionConstructor) { newMember = CreateConstructorDeclaration(containerNode, CodeModelService.GetUnescapedName(name), access); } else { newMember = CreateDestructorDeclaration(containerNode, CodeModelService.GetUnescapedName(name)); } var insertionIndex = CodeModelService.PositionVariantToMemberInsertionIndex(position, containerNode, fileCodeModel: this); newMember = InsertMember(containerNode, newMember, insertionIndex); return((EnvDTE.CodeFunction)CreateInternalCodeMember(this.State, fileCodeModel: this, node: newMember)); }