public static string GetSubElementAtPosition(ProjectType projectType, string fileName, ITextSnapshot snapshot, string xaml, int position, ILogger logger, string projectFile, IVisualStudioProjectFilePath vspfp)
        {
            var startPos = xaml.LastIndexOf('<', position, position);

            var elementName = GetElementName(xaml.AsSpan(), startPos);

            string result = null;

            var processor = new SubElementProcessor(new ProcessorEssentials(projectType, logger, projectFile, vspfp));

            processor.SubElementFound += (s, e) => { result = e.SubElement; };

            XamlElementExtractor.Parse(fileName, snapshot, xaml.Substring(startPos), new List <(string element, XamlElementProcessor processor)> {
                (elementName, processor),
            }, new TagList(), suppressions: null, everyElementProcessor: null, logger);

#if DEBUG
            if (result == null)
            {
                // If get here it's because there's a subelement that can't be identified correctly by XamlElementExtractor
                // but was detected elsewhere. (Probably by something extending XamlElementProcessor.)
                System.Diagnostics.Debugger.Break();
            }
#endif

            return(result);
        }
 public CustomProcessorWrapper(RapidXaml.ICustomAnalyzer customProcessor, ProjectType projType, string projectPath, ILogger logger, IVisualStudioProjectFilePath vspfp)
     : base(new ProcessorEssentials(projType, logger, projectPath, vspfp))
 {
     this.CustomAnalyzer = customProcessor;
 }
Example #3
0
 public ProcessorEssentials(ProjectType projectType, ILogger logger, string projectFilePath, IVisualStudioProjectFilePath vspfp)
 {
     this.ProjectType     = projectType;
     this.Logger          = logger;
     this.ProjectFilePath = projectFilePath;
     this.Vspfp           = vspfp;
 }