// This is the ReSharper 8.1 version
        public RichTextBlock GetElementDescription(IDeclaredElement element, DeclaredElementDescriptionStyle style,
                                                   PsiLanguageType language, IPsiModule module)
        {
            var attribute = element as IHtmlAttributeDeclaredElement;
            if (attribute == null)
                return null;

            var attributeDescription = GetAttributeDescription(attribute.ShortName);

            var block = new RichTextBlock();
            var typeDescription = new RichText(htmlDescriptionsCache.GetDescriptionForHtmlValueType(attribute.ValueType));
            if (style.IntendedDescriptionPlacement == DescriptionPlacement.AFTER_NAME &&
                (style.ShowSummary || style.ShowFullDescription))
                block.SplitAndAdd(typeDescription);

            string description = null;
            if (style.ShowSummary && attributeDescription != null)
                description = attributeDescription.Summary;
            else if (style.ShowFullDescription && attributeDescription != null)
                description = attributeDescription.Description;

            if (!string.IsNullOrEmpty(description))
                block.SplitAndAdd(description);

            if (style.IntendedDescriptionPlacement == DescriptionPlacement.ON_THE_NEW_LINE &&
                (style.ShowSummary || style.ShowFullDescription))
            {
                // TODO: Perhaps we should show Value: Expression for attributes that take an Angular expression, etc
                typeDescription.Prepend("Value: ");
                block.SplitAndAdd(typeDescription);
            }

            return block;
        }
 public IconId GetImageId(IDeclaredElement declaredElement, PsiLanguageType languageType, out bool canApplyExtensions)
 {
     canApplyExtensions = false;
     if (declaredElement is IAngularJsDeclaredElement)
         return LogoThemedIcons.Angularjs.Id;
     return null;
 }
 public AngularJsLanguageService(PsiLanguageType psiLanguageType,
                                 IConstantValueService constantValueService,
                                 IJavaScriptCodeFormatter codeFormatter)
     : base(psiLanguageType, constantValueService)
 {
     this.codeFormatter = codeFormatter;
 }
 private static ITypePresenter GetTypePresenter(PsiLanguageType language) {
     JetBrains.ReSharper.Psi.LanguageService languageService = LanguageServiceManager.Instance.GetLanguageService(language);
     if (languageService != null) {
         return languageService.TypePresenter;
     }
     return null;
 }
        public RichTextBlock GetElementDescription(IDeclaredElement element, DeclaredElementDescriptionStyle style,
            PsiLanguageType language, IPsiModule module = null)
        {
            if (!element.IsFromUnityProject())
                return null;

            var method = element as IMethod;
            if (method != null)
            {
                var eventFunction = myUnityApi.GetUnityEventFunction(method);
                if (eventFunction?.Description != null)
                    return new RichTextBlock(eventFunction.Description);
            }

            var parameter = element as IParameter;
            var owner = parameter?.ContainingParametersOwner as IMethod;
            if (owner != null)
            {
                var eventFunction = myUnityApi.GetUnityEventFunction(owner);
                var eventFunctionParameter = eventFunction?.GetParameter(parameter.ShortName);
                if (eventFunctionParameter?.Description != null)
                    return new RichTextBlock(eventFunctionParameter.Description);
            }

            return null;
        }
 private static string GetPresentableName(PsiLanguageType psiLanguageType)
 {
     // Bah, WinRT JS is a different language, that supports control flow,
       // but has the same presentable name as normal JS. I don't like
       // adding language specific fixes...
       if (psiLanguageType is JavaScriptWinRTLanguage)
     return "JavaScript (WinRT)";
       return psiLanguageType.PresentableName;
 }
 public AngularJsCodeFormatter(Lifetime lifetime, PsiLanguageType language, ISettingsStore settingsStore,
                               ISettingsOptimization settingsOptimization,
                               JavaScriptFormattingInfoProviderBase formattingProvider,
                               JavaScriptIndentingInfoProviderBase indentingProvider,
                               IViewable<IJavaScriptCodeFormatterExtension> extensions)
     : base(lifetime, language, settingsStore, settingsOptimization,
            formattingProvider, indentingProvider, extensions)
 {
 }
        protected override string Format(IDeclaredElement declaredElement, ISubstitution substitution, PsiLanguageType languageType,
            DeclaredElementPresenterStyle presenter, IReference reference)
        {
            if (declaredElement == null)
                return "null";

            // Output the element like it is in the QuickDoc - element name + type
            return DeclaredElementPresenter.Format(JavaScriptLanguage.Instance, XmlDocPresenterUtil.MemberPresentationStyle,
                declaredElement, EmptySubstitution.INSTANCE);
        }
        public IconId GetImageId(IDeclaredElement declaredElement, PsiLanguageType languageType, out bool canApplyExtensions)
        {
            canApplyExtensions = false;

            var typeMember = declaredElement as ITypeMember;
            if (typeMember == null) return null;

            if (!UnityColorTypes.IsColorProperty(typeMember)) return null;

            var color = UnityNamedColors.Get(typeMember.ShortName);
            if (color == null) return null;

            return new ColorIconId(color.Value);
        }
        public QuickDocTitleAndText GetHtml(PsiLanguageType presentationLanguage)
        {
            var element = myEnvoy.GetValidDeclaredElement();
            if (element == null) return QuickDocTitleAndText.Empty;

            // Present in the standard fashion
            var details = GetDetails(element);
            var text = XmlDocHtmlPresenter.Run(details, element.Module,
                element, presentationLanguage, XmlDocHtmlUtil.NavigationStyle.All,
                XmlDocHtmlUtil.CrefManager, myTheming);
            var title = DeclaredElementPresenter.Format(presentationLanguage,
                DeclaredElementPresenter.FULL_NESTED_NAME_PRESENTER, element);

            return new QuickDocTitleAndText(text, title);
        }
        public IconId GetImageId(IDeclaredElement declaredElement, PsiLanguageType languageType, out bool canApplyExtensions)
        {
            if (declaredElement.GetElementType().PresentableName == @"css class")
            {
                canApplyExtensions = false;

                ImageSourceIconId value;
                if (GlyphfriendStorage.Glyphs.TryGetValue(declaredElement.ShortName, out value))
                {
                    return value;
                }
            }

            canApplyExtensions = true;

            return null;
        }
 /// <summary>Gets a lexer factory capable of handling preprocessor directives.</summary>
 /// <param name="primaryLanguage">The primary language.</param>
 /// <returns>Always <c>null</c> since there is no preprocessor directives in T4 files.</returns>
 public override ILexerFactory LexerFactoryWithPreprocessor(PsiLanguageType primaryLanguage)
 => null;
Example #13
0
 public override bool IsCompatibleWithLanguage(PsiLanguageType languageType) => languageType.Is <FSharpLanguage>();
    public PsiLanguageService(PsiLanguageType psiLanguageType, IConstantValueService constantValueService, PsiCodeFormatter formatter)
      : base(psiLanguageType, constantValueService)

    {
      myFormatter = formatter;
    }
 /// <summary>
 /// Initializes a new instance of the <see cref="T4SecondaryLexingProcess"/> class.
 /// </summary>
 /// <param name="codeBehindLanguage">The code behind language.</param>
 /// <param name="mixedLexer">The mixed lexer.</param>
 internal T4SecondaryLexingProcess([NotNull] PsiLanguageType codeBehindLanguage, [NotNull] MixedLexer mixedLexer)
 {
     _codeBehindLanguage = codeBehindLanguage;
     _mixedLexer = mixedLexer;
 }
 // This is the ReSharper 8.2 version. 'context' has a default value of null
 public RichTextBlock GetElementDescription(IDeclaredElement element, DeclaredElementDescriptionStyle style,
     PsiLanguageType language, IPsiModule module, IModuleReferenceResolveContext context)
 {
     return GetElementDescription(element, style, language, module);
 }
 public bool IsCompatibleWithLanguage(PsiLanguageType languageType)
 {
   return ((languageType == PsiLanguage.Instance) || (languageType == CSharpLanguage.Instance));
 }
 public override bool IsApplicable(PsiLanguageType originalLanguage)
 {
     return(originalLanguage.Is <HtmlLanguage>());
 }
 public bool ProcessChangeFromGeneratedToPrimary(IPsiSourceFile sourceFile, TextRange range, string oldText, string newText, PsiLanguageType language)
 {
   return false;
 }
Example #20
0
        public static ISpecificCodeCompletionContext GetSpecificContext(
            CodeCompletionContext context, ReparsedCodeCompletionContext unterminatedContext, PsiLanguageType customLanguageType = null)
        {
            var elementToComplete = unterminatedContext.TreeNode;

            if (elementToComplete == null)
            {
                return(null);
            }

            var elementRange         = elementToComplete.GetTreeTextRange();
            var elementDocumentRange = unterminatedContext.ToDocumentRange(elementRange);

            var referenceToComplete    = unterminatedContext.Reference;
            var referenceRange         = referenceToComplete?.GetTreeTextRange() ?? elementRange;
            var referenceDocumentRange = unterminatedContext.ToDocumentRange(referenceRange);

            if (!referenceDocumentRange.IsValid())
            {
                return(null);
            }

            if (!referenceDocumentRange.Contains(context.EffectiveCaretDocumentOffset))
            {
                return(null);
            }
            if (!elementDocumentRange.Contains(context.EffectiveCaretDocumentOffset))
            {
                return(null);
            }

            var language = customLanguageType ?? PascalLanguage.Instance;

            if (language == null)
            {
                return(null);
            }

            var referenceRanges = GetTextLookupRanges(context, referenceDocumentRange);
            var elementRanges   = GetTextLookupRanges(context, elementDocumentRange);

            return(new PascalCodeCompletionContext(context, referenceRanges, elementRanges, unterminatedContext));
        }
        private IdentifierTooltipContent TryPresentColorized([CanBeNull] DeclaredElementInfo info, [NotNull] IContextBoundSettingsStore settings)
        {
            if (info == null)
            {
                return(null);
            }

            PsiLanguageType       languageType          = info.TreeNode.Language;
            IDeclaredElement      element               = info.DeclaredElement;
            IPsiModule            psiModule             = info.TreeNode.GetPsiModule();
            HighlighterIdProvider highlighterIdProvider = _highlighterIdProviderFactory.CreateProvider(settings);
            var reflectionCppTooltipContentProvider     = _solution.TryGetComponent <ReflectionCppTooltipContentProvider>();

            RichText identifierText;

            if (reflectionCppTooltipContentProvider != null && reflectionCppTooltipContentProvider.IsCppDeclaredElement(element))
            {
                identifierText = reflectionCppTooltipContentProvider.TryPresentCppDeclaredElement(element);
            }
            else
            {
                identifierText = _colorizerPresenter.TryPresent(
                    new DeclaredElementInstance(element, info.Substitution),
                    PresenterOptions.ForIdentifierToolTip(settings, !element.IsEnumMember()),
                    languageType,
                    highlighterIdProvider,
                    info.TreeNode,
                    out _);
            }

            if (identifierText == null || identifierText.IsEmpty)
            {
                return(null);
            }

            var identifierContent = new IdentifierTooltipContent(identifierText, info.SourceRange);

            if (settings.GetValue((IdentifierTooltipSettings s) => s.ShowIcon))
            {
                identifierContent.Icon = TryGetIcon(element);
            }

            if (settings.GetValue((IdentifierTooltipSettings s) => s.ShowDocumentation))
            {
                XmlNode xmlDoc = element.GetXMLDoc(true);
                identifierContent.Description = TryGetDescription(element, xmlDoc, psiModule, languageType);

                if (settings.GetValue((IdentifierTooltipSettings s) => s.ShowObsolete))
                {
                    identifierContent.Obsolete = TryRemoveObsoletePrefix(TryGetObsolete(element, psiModule, languageType));
                }

                if (settings.GetValue((IdentifierTooltipSettings s) => s.ShowReturn))
                {
                    identifierContent.Return = TryPresentDocNode(xmlDoc, "returns", languageType, psiModule);
                }

                if (settings.GetValue((IdentifierTooltipSettings s) => s.ShowValue))
                {
                    identifierContent.Value = TryPresentDocNode(xmlDoc, "value", languageType, psiModule);
                }

                if (settings.GetValue((IdentifierTooltipSettings s) => s.ShowRemarks))
                {
                    identifierContent.Remarks = TryPresentDocNode(xmlDoc, "remarks", languageType, psiModule);
                }

                if (settings.GetValue((IdentifierTooltipSettings s) => s.ShowExceptions))
                {
                    identifierContent.Exceptions.AddRange(GetExceptions(xmlDoc, languageType, psiModule));
                }
            }

            if (settings.GetValue((IdentifierTooltipSettings s) => s.ShowOverloadCount))
            {
                identifierContent.OverloadCount = TryGetOverloadCount(element as IFunction, info.Reference, languageType);
            }

            if (info.DeclaredElement is ITypeElement typeElement)
            {
                var baseTypeDisplayKind = settings.GetValue((IdentifierTooltipSettings s) => s.BaseTypeDisplayKind);
                var implementedInterfacesDisplayKind = settings.GetValue((IdentifierTooltipSettings s) => s.ImplementedInterfacesDisplayKind);
                if (baseTypeDisplayKind != BaseTypeDisplayKind.Never ||
                    implementedInterfacesDisplayKind != ImplementedInterfacesDisplayKind.Never)
                {
                    AddSuperTypes(identifierContent, typeElement, baseTypeDisplayKind, implementedInterfacesDisplayKind, languageType, info.TreeNode, highlighterIdProvider, settings);
                }

                if (settings.GetValue((IdentifierTooltipSettings s) => s.ShowAttributesUsage) && typeElement.IsAttribute())
                {
                    identifierContent.AttributeUsage = GetAttributeUsage((IClass)info.DeclaredElement);
                }
            }

            return(identifierContent);
        }
Example #22
0
 public TemplateWithNonDefaultPrefixesItemsProvider(PsiLanguageType language, IncludeTemplatesRule includeTemplatesRule, HotspotSessionExecutor hotspotSessionExecutor)
 {
     this.language               = language;
     this.includeTemplatesRule   = includeTemplatesRule;
     this.hotspotSessionExecutor = hotspotSessionExecutor;
 }
        ///<summary>
        ///
        ///            Initializes workflow with specified data context
        ///            
        ///</summary>
        ///
        public bool Initialize(IDataContext context, IInitializationContext initializationContext)
        {
            solution = context.GetData<ISolution>(JetBrains.ReSharper.DataConstants.SOLUTION);

            psiLanguageType = context.GetData<PsiLanguageType>(DataConstants.PSI_LANGUAGE_TYPE);

            Assert.CheckNotNull(solution);

            bool emptyResult = false;

            UnusedReferencesSearchRequest request = new UnusedReferencesSearchRequest(solution);
            UnusedReferencesSearchDescriptor searchDescriptor = new UnusedReferencesSearchDescriptor(request);
            using(ReadLockCookie cookie = ReadLockCookie.Create())
            {
                searchDescriptor.Search();
            }

            emptyResult = request.EmptyResult;
            searchResults = request.Results;
            if (searchDescriptor.Items == null)
                return false;

            if (emptyResult)
            {
                EmptyResultsPane panel = new EmptyResultsPane();
                page = panel;
            }
            else
            {
                ModulesChooserPane pane = new ModulesChooserPane(this);
                pane.AutoActivate = true;
                page = pane;
            }

            return true;
        }
Example #24
0
 public static RichTextBlock Run(XmlNode node, bool includeHeader, PsiLanguageType languageType, DeclaredElementPresenterTextStyles textStyles, IPsiModule module)
 {
     return(node == null ? new RichTextBlock(new RichTextBlockParameters()) : new XmlDocRichTextPresenterEx(node, languageType, textStyles, module).RichTextBlock);
 }
 /// <summary>
 /// Gets a lexer factory capable of handling preprocessor directives.
 /// </summary>
 /// <param name="primaryLanguage">The primary language.</param>
 /// <returns>Always <c>null</c> since there is no preprocessor directives in T4 files.</returns>
 public override ILexerFactory LexerFactoryWithPreprocessor(PsiLanguageType primaryLanguage)
 {
     return null;
 }
Example #26
0
 /// <summary>
 /// Gets a lexer factory capable of handling preprocessor directives.
 /// </summary>
 /// <param name="primaryLanguage">The primary language.</param>
 /// <returns>Always <c>null</c> since there is no preprocessor directives in T4 files.</returns>
 public override ILexerFactory LexerFactoryWithPreprocessor(PsiLanguageType primaryLanguage)
 {
     return(null);
 }
 public bool ProcessChangeFromGeneratedToPrimary(IPsiSourceFile sourceFile, TextRange range, string oldText, string newText, PsiLanguageType language)
 {
     return(false);
 }
Example #28
0
 public UseReflectionQuickFix(AccessRightsError error)
 {
     _error                   = error;
     _declaredElement         = error.Reference.CurrentResolveResult.DeclaredElement;
     _languageForPresentation = error.Reference.GetTreeNode().Language;
 }
Example #29
0
 public override bool IsPresentable(PsiLanguageType language)
 {
     return(language.Is <FSharpLanguage>());
 }
Example #30
0
 protected override ScopedActionExecutor GetScopedQuickFixExecutor(ISolution solution, IScopedFixingStrategy fixingStrategy,
                                                                   PsiLanguageType languageType)
 {
     return(new ScopedQuickFixExecutor(solution, fixingStrategy, null, languageType));
 }
 /// <summary>
 /// Returns presentation of this element is sound for given language type
 /// </summary>
 /// <param name="language">The language.</param>
 /// <returns><c>true</c> if the specified language is presentable; otherwise, <c>false</c>.</returns>
 public override bool IsPresentable(PsiLanguageType language)
 {
   return true;
 }
Example #32
0
 public DslLanguageService(
     PsiLanguageType lexLanguageType, IConstantValueService constantValueService, CommonIdentifierIntern commonIdentifierIntern)
     : base(lexLanguageType, constantValueService)
 {
     _commonIdentifierIntern = commonIdentifierIntern;
 }
 public override bool IsPresentable(PsiLanguageType language)
 {
     throw new NotImplementedException();
 }
 public T4SecondaryDocumentGenerationResult([NotNull] IPsiSourceFile sourceFile, [NotNull] string text, [NotNull] PsiLanguageType language,
                                            [NotNull] ISecondaryRangeTranslator secondaryRangeTranslator, [NotNull] ILexerFactory lexerFactory,
                                            [NotNull] FileDependency fileDependency, [NotNull] OneToSetMap <FileSystemPath, FileSystemPath> includedFiles)
     : base(sourceFile, text, language, secondaryRangeTranslator, lexerFactory)
 {
     _fileDependency = fileDependency;
     _includedFiles  = includedFiles;
 }
Example #35
0
        public static JetBrains.UI.RichText.RichText ProcessCRef(string crefValue, PsiLanguageType languageType, IPsiModule psiModule, DeclaredElementPresenterStyle presenterStyle)
        {
            var element = psiModule == null ? null : XMLDocUtil.ResolveId(psiModule.GetPsiServices(), crefValue, psiModule, true);

            return(element == null || !element.IsValid() ? new JetBrains.UI.RichText.RichText(XmlDocPresenterUtil.ProcessCref(crefValue), XmlDocRichTextPresenterEx.ourCRefStyle) : DeclaredElementPresenter.Format(languageType, presenterStyle, element));
        }
 public JsonNewLanguageService(PsiLanguageType psiLanguageType, IConstantValueService constantValueService, CommonIdentifierIntern intern)
     : base(psiLanguageType, constantValueService)
 {
     myIntern = intern;
 }
 public override bool IsSecondaryPsiLanguageType(IProject project, PsiLanguageType language)
 => language.Is <CSharpLanguage>();
 public static string SuggestShortReferenceName(IDeclaredElement declaredElement, PsiLanguageType language) =>
 SuggestShortReferenceName(declaredElement.GetSourceName(), language);
Example #39
0
 public PascalLanguageService([NotNull] PsiLanguageType psiLanguageType,
                              [NotNull] IConstantValueService constantValueService) : base(psiLanguageType, constantValueService)
 {
 }
 public static string SuggestShortReferenceName(string sourceName, PsiLanguageType language) =>
 NamingManager.GetNamingLanguageService(language).MangleNameIfNecessary(sourceName);
 public override bool IsSecondaryPsiLanguageType(IProject project, PsiLanguageType language)
 {
     return language.Is<CSharpLanguage>();
 }
Example #42
0
 public override bool IsPresentable(PsiLanguageType language)
 {
     throw new NotImplementedException();
 }
Example #43
0
 public bool IsCompatibleWithLanguage(PsiLanguageType languageType)
 {
     return languageType.Is<DslLanguage>();
 }
Example #44
0
        /// <summary>
        /// Gets the type configuration.
        /// </summary>
        /// <param name="type">
        /// The type.
        /// </param>
        /// <param name="languageType">
        /// Type of the language.
        /// </param>
        /// <returns>
        /// The type configuration.
        /// </returns>
        public static Rule GetRule(IType type, PsiLanguageType languageType)
        {
            string clrName = null;

              var arrayType = type as IArrayType;
              if (arrayType != null)
              {
            clrName = arrayType.GetLongPresentableName(languageType);
              }

              var declaredType = type as IDeclaredType;
              if (declaredType != null)
              {
            clrName = declaredType.GetCLRName();
              }

              if (string.IsNullOrEmpty(clrName))
              {
            return null;
              }

              var module = type.Module;
              if (module == null)
              {
            return null;
              }

              var configurations = ValueAnalysisSettings.Instance.Rules;

              foreach (var configuration in configurations)
              {
            if (configuration.TypeName == "*" || configuration.TypeName == "System.Object")
            {
              continue;
            }

            if (!string.IsNullOrEmpty(clrName) && clrName == configuration.TypeName)
            {
              return configuration;
            }
              }

              if (declaredType == null)
              {
            return null;
              }

              // check for subclass
              foreach (var configuration in configurations)
              {
            if (configuration.TypeName == "*" || configuration.TypeName == "System.Object")
            {
              continue;
            }

            var baseType = TypeFactory.CreateTypeByCLRName(configuration.TypeName, module);

            if (declaredType.IsSubtypeOf(baseType))
            {
              return configuration;
            }
              }

              return null;
        }
 public override bool IsApplicable(PsiLanguageType originalLanguage)
 {
     return originalLanguage.Is<HtmlLanguage>();
 }
 public override bool IsCompatibleWithLanguage(PsiLanguageType languageType)
 {
     return(languageType.Is <UnityYamlLanguage>());
 }
 public ILexerFactory LexerFactoryWithPreprocessor(PsiLanguageType primaryLanguage)
 {
   return new CSharpLexerFactory();
 }
 public ILexerFactory LexerFactoryWithPreprocessor(PsiLanguageType primaryLanguage)
 {
     return(new CSharpLexerFactory());
 }
 private JsonNewElementFactory([NotNull] IPsiModule module, [NotNull] ISolution solution, [NotNull] PsiLanguageType language)
 {
     myModule          = module;
     mySolution        = solution;
     myLanguage        = language;
     myLanguageService = language.LanguageService();
 }
 protected override string Format(IDeclaredElement declaredElement, ISubstitution substitution, PsiLanguageType languageType, DeclaredElementPresenterStyle presenter, IReference reference)
 {
     var format = base.Format(declaredElement, substitution, languageType, presenter, reference);
     if (declaredElement != null)
         format += " (" + declaredElement.GetElementType().PresentableName + ")";
     return format;
 }
 // ReSharper disable once UnusedParameter.Local
 public T4SecondaryDocumentGenerationResult([NotNull] IPsiSourceFile sourceFile, [NotNull] string text, [NotNull] PsiLanguageType language,
                                            [NotNull] ISecondaryRangeTranslator secondaryRangeTranslator, [NotNull] ILexerFactory lexerFactory,
                                            [NotNull] T4FileDependencyManager t4FileDependencyManager, [NotNull] IEnumerable <FileSystemPath> includedFiles)
     : base(text, language, secondaryRangeTranslator, lexerFactory)
 {
     _sourceFile = sourceFile;
     _t4FileDependencyManager = t4FileDependencyManager;
     _includedFiles           = new HashSet <FileSystemPath>(includedFiles);
 }
Example #52
0
        private static int?TryGetOverloadCountCount([CanBeNull] IFunction function, [CanBeNull] IReference reference, PsiLanguageType languageType)
        {
            if (function == null || reference == null)
            {
                return(null);
            }

            var candidateCountProvider = LanguageManager.Instance.TryGetService <IInvocationCandidateCountProvider>(languageType);

            if (candidateCountProvider == null)
            {
                return(null);
            }

            int?candidateCount = candidateCountProvider.TryGetInvocationCandidateCount(reference);

            if (candidateCount == null || candidateCount.Value <= 1)
            {
                return(null);
            }

            return(candidateCount.Value - 1);
        }
Example #53
0
 public NHElementFactory(PsiLanguageType languageType)
     : base(languageType)
 {
 }
Example #54
0
        private static IEnumerable <ExceptionContent> GetExceptions([NotNull] IDeclaredElement element, [NotNull] PsiLanguageType languageType,
                                                                    [NotNull] IPsiModule psiModule, [NotNull] IModuleReferenceResolveContext resolveContext)
        {
            XmlNode xmlDoc = element.GetXMLDoc(true);

            if (xmlDoc == null)
            {
                return(EmptyList <ExceptionContent> .InstanceList);
            }

            XmlNodeList exceptionNodes = xmlDoc.SelectNodes("exception");

            if (exceptionNodes == null || exceptionNodes.Count == 0)
            {
                return(EmptyList <ExceptionContent> .InstanceList);
            }

            var exceptions = new LocalList <ExceptionContent>();

            foreach (XmlNode exceptionNode in exceptionNodes)
            {
                ExceptionContent exceptionContent = TryExtractException(exceptionNode as XmlElement, languageType, psiModule, resolveContext);
                if (exceptionContent != null)
                {
                    exceptions.Add(exceptionContent);
                }
            }
            return(exceptions.ResultingList());
        }
 public DeclaredElementFullNameLookupItem(DeclaredElementInstance instance, IElementPointerFactory elementPointerFactory, PsiLanguageType languageType)
     : base(instance, elementPointerFactory, languageType)
 {
 }
Example #56
0
        private static ExceptionContent TryExtractException([CanBeNull] XmlElement exceptionElement, [NotNull] PsiLanguageType languageType,
                                                            [NotNull] IPsiModule psiModule, IModuleReferenceResolveContext resolveContext)
        {
            if (exceptionElement == null)
            {
                return(null);
            }

            string cref = exceptionElement.GetAttribute("cref");

            if (String.IsNullOrEmpty(cref))
            {
                return(null);
            }

            cref = XmlDocPresenterUtil.ProcessCref(cref);
            if (String.IsNullOrEmpty(cref))
            {
                return(null);
            }

            var exceptionContent = new ExceptionContent {
                Exception = cref
            };

            if (exceptionElement.HasChildNodes)
            {
                RichText richText = XmlDocRichTextPresenter.Run(exceptionElement, false, languageType, psiModule, resolveContext).RichText;
                if (!richText.IsNullOrEmpty())
                {
                    exceptionContent.Description = richText;
                }
            }
            return(exceptionContent);
        }
 public override bool IsPresentable(PsiLanguageType language)
 {
     return Equals(Language, language);
 }
Example #58
0
        private RichText TryGetDescription([NotNull] IDeclaredElement element, [NotNull] IPsiModule psiModule, [NotNull] PsiLanguageType languageType,
                                           [NotNull] DeclaredElementDescriptionStyle style)
        {
            RichTextBlock description = _declaredElementDescriptionPresenter.GetDeclaredElementDescription(element, style, languageType, psiModule);

            return(description != null ? description.RichText : null);
        }
 public bool IsCompatibleWithLanguage(PsiLanguageType languageType)
 {
     return(languageType.Is <LexLanguage>());
 }
Example #60
0
 public override bool IsPresentable(PsiLanguageType language) => language.Is <JsonNewLanguage>();