public UnityEventFunctionQuickDocProvider(ISolution solution, UnityApi unityApi, DocumentManager documentManager, QuickDocTypeMemberProvider quickDocTypeMemberProvider, HelpSystem helpSystem, ITheming theming) { mySolution = solution; myUnityApi = unityApi; myDocumentManager = documentManager; myQuickDocTypeMemberProvider = quickDocTypeMemberProvider; myHelpSystem = helpSystem; myTheming = theming; }
public RiderTypeDetector(ISolution solution, IApplicationWideContextBoundSettingStore settingsStore, UnityApi unityApi, AssetIndexingSupport assetIndexingSupport, UnityUsagesCodeVisionProvider usagesCodeVisionProvider, UnityCodeInsightProvider codeInsightProvider, AssetScriptUsagesElementContainer assetScriptUsagesElementContainer, DeferredCacheController deferredCacheController, UnitySolutionTracker solutionTracker, BackendUnityHost backendUnityHost, IconHost iconHost, AssetSerializationMode assetSerializationMode, PerformanceCriticalContextProvider contextProvider) : base(solution, settingsStore, unityApi, contextProvider) { myAssetIndexingSupport = assetIndexingSupport; myUsagesCodeVisionProvider = usagesCodeVisionProvider; myCodeInsightProvider = codeInsightProvider; myAssetScriptUsagesElementContainer = assetScriptUsagesElementContainer; myDeferredCacheController = deferredCacheController; mySolutionTracker = solutionTracker; myBackendUnityHost = backendUnityHost; myIconHost = iconHost; myAssetSerializationMode = assetSerializationMode; }
private bool CheckPosition(CSharpCodeCompletionContext context, UnityApi unityApi, out IClassDeclaration classDeclaration, out AccessRights accessRights, out bool hasReturnType) { classDeclaration = GetClassDeclaration(context.NodeInFile); accessRights = AccessRights.NONE; hasReturnType = false; if (classDeclaration == null) { return(false); } // Make sure we're completing an identifier if (!(context.UnterminatedContext.TreeNode is ICSharpIdentifier identifier)) { return(false); } if (!unityApi.IsUnityType(classDeclaration.DeclaredElement)) { return(false); } // Make sure we're in the correct place for showing Unity event functions. if (!ShouldComplete(context.NodeInFile, identifier)) { return(false); } // We know we're in a place where we can complete, so now configure what we // complete and what we display hasReturnType = HasExistingReturnType(identifier, out var typeUsage); accessRights = GetAccessRights(typeUsage); return(true); }
public static bool IsPerformanceCriticalRootMethod(ITreeNode node) { if (!(node is ICSharpDeclaration declaration)) { return(false); } // TODO: 20.1, support lambda if (declaration.DeclaredElement is IAttributesOwner attributesOwner && HasFrequentlyCalledMethodAttribute(attributesOwner)) { return(true); } if (!(declaration is ITypeMemberDeclaration typeMemberDeclaration)) { return(false); } var typeElement = typeMemberDeclaration.DeclaredElement?.GetContainingType(); if (typeElement == null) { return(false); } if (!UnityApi.IsDescendantOfMonoBehaviour(typeElement)) { return(false); } if (declaration.DeclaredElement is IClrDeclaredElement clrDeclaredElement) { return(ourKnownHotMonoBehaviourMethods.Contains(clrDeclaredElement.ShortName)); } return(false); }
private UnityPresentationType GetUnityPresentationType(IType type) { if (UnityApi.IsDescendantOfScriptableObject(type.GetTypeElement())) { return(UnityPresentationType.ScriptableObject); } if (type.IsBool()) { return(UnityPresentationType.Bool); } if (type.IsEnumType()) { return(UnityPresentationType.Enum); } if (type.IsString()) { return(UnityPresentationType.String); } if (type.IsSimplePredefined()) { return(UnityPresentationType.OtherSimple); } if (type.IsValueType()) { return(UnityPresentationType.ValueType); } if (IsSerializedViaFileId(type)) { return(UnityPresentationType.FileId); } return(UnityPresentationType.Other); }
public FormerlySerializedAsAttributeProblemAnalyzer(UnityApi unityApi) : base(unityApi) { }
public CustomCodeAnnotationProvider(ExternalAnnotationsModuleFactory externalAnnotationsModuleFactory, IPredefinedTypeCache predefinedTypeCache, UnityApi unityApi) { myPredefinedTypeCache = predefinedTypeCache; myUnityApi = unityApi; myAnnotationsPsiModule = externalAnnotationsModuleFactory .GetPsiModule(TargetFrameworkId.Default); }
public RedundantEventFunctionProblemAnalyzer(UnityApi unityApi) : base(unityApi) { }
public RedundantSerializeFieldAttributeProblemAnalyzer(UnityApi unityApi) : base(unityApi) { }
public PreferNonAllocApiAnalyzer([NotNull] UnityApi unityApi) : base(unityApi) { }
public override IEnumerable <BulbMenuItem> CreateAdditionalMenuItem(IDeclaration declaration, UnityApi api, ITextControl textControl) { var declaredElement = declaration.DeclaredElement; if (declaredElement != null && (declaredElement is IMethod method && !api.IsEventFunction(method) || declaration is IClassDeclaration)) { var action = new UnityFindUsagesNavigationAction(declaredElement, declaration.GetSolution().GetComponent <UnityEditorFindUsageResultCreator>(), myConnectionTracker); return(new[] { new BulbMenuItem( new IntentionAction.MyExecutableProxi(action, Solution, textControl), action.Text, BulbThemedIcons.ContextAction.Id, BulbMenuAnchors.FirstClassContextItems) }); } return(EmptyList <BulbMenuItem> .Instance); }
public UnityHighlightingStage(IEnumerable <IUnityDeclarationHiglightingProvider> higlightingProviders, UnityApi api, UnityHighlightingContributor unityHighlightingContributor) : base(higlightingProviders, api, unityHighlightingContributor) { }
public MultiplicationOrderAnalyzer(UnityApi unityApi) : base(unityApi) { }
public UnityInitialiseOnLoadCctorDetector(UnityApi unityApi) : base(unityApi) { }
public CompareTagProblemAnalyzer(UnityApi unityApi) : base(unityApi) { }
public InitializeOnLoadSignatureProblemAnalyzer(UnityApi unityApi, IPredefinedTypeCache predefinedTypeCache) : base(unityApi) { myPredefinedTypeCache = predefinedTypeCache; }
public UnityTypeDetector(UnityApi unityApi) : base(unityApi) { }
public UnityObjectNullCoalescingProblemAnalyzer([NotNull] UnityApi unityApi) : base(unityApi) { }
public CustomCodeAnnotationProvider(ExternalAnnotationsModuleFactory externalAnnotationsModuleFactory, IPredefinedTypeCache predefinedTypeCache, UnityApi unityApi) { myPredefinedTypeCache = predefinedTypeCache; myUnityApi = unityApi; myAnnotationsPsiModule = externalAnnotationsModuleFactory.Modules.OfType <IExternalAnnotationPsiModule>().Single(); }
public DrawGizmoAttributeProblemAnalyzer([NotNull] UnityApi unityApi, IPredefinedTypeCache predefinedTypeCache) : base(unityApi) { myPredefinedTypeCache = predefinedTypeCache; }
public TypeDetector(ISolution solution, CallGraphSwaExtensionProvider callGraphSwaExtensionProvider, SettingsStore settingsStore, UnityApi unityApi, PerformanceCriticalCodeCallGraphMarksProvider marksProvider, IElementIdProvider provider) : base(solution, callGraphSwaExtensionProvider, settingsStore, marksProvider, provider) { myUnityApi = unityApi; }
private static string GetUnityName(IPsiDocumentRangeView psiDocumentRangeView, UnityApi unityApi) { var psiView = psiDocumentRangeView.View <CSharpLanguage>(); if (psiView.ContainingNodes.All(n => !n.IsFromUnityProject())) { return(string.Empty); } if (!(FindDeclaredElement(psiView) is IClrDeclaredElement element)) { return(string.Empty); } var unityName = GetUnityEventFunctionName(element, unityApi); if (unityName != null) { return(unityName); } return(GetFullyQualifiedUnityName(element)); }
public VsUnityVersionPropertiesExtenderProvider(Lifetime lifetime, IShellLocks locks, UnityVersion unityVersion, UnityApi unityApi) { myLifetime = lifetime; myLocks = locks; myUnityVersion = unityVersion; myUnityApi = unityApi; }
public ChangeNamingRuleWindowProvider(ILogger logger, UnityApi unityApi) : base(logger) { myUnityApi = unityApi; }
public UnityFieldDetector(UnityApi unityApi) { myUnityApi = unityApi; }
public UnityEventFunctionAnalyzer(UnityApi unityApi) : base(unityApi) { }
private static string GetUnityEventFunctionName([NotNull] IDeclaredElement element, UnityApi unityApi) { var method = element as IMethod; if (method == null && element is IParameter parameter) { method = parameter.ContainingParametersOwner as IMethod; } if (method == null) { return(null); } var unityEventFunction = unityApi.GetUnityEventFunction(method); if (unityEventFunction == null) { return(null); } return(unityEventFunction.TypeName + "." + element.ShortName); }
protected MethodSignatureProblemAnalyzerBase([NotNull] UnityApi unityApi) : base(unityApi) { }
public SyncVarUsageProblemAnalyzer(UnityApi unityApi) : base(unityApi) { }
public RedundantAttributeOnTargetProblemAnalyzer([NotNull] UnityApi unityApi) : base(unityApi) { }
public UnityEventFunctionDescriptionProvider(UnityApi unityApi) { myUnityApi = unityApi; }
protected UnityElementProblemAnalyzer(UnityApi unityApi) { Api = unityApi; }