List <(int Offset, int Length, ReferenceUsage Usage)> FindReferences(string docString, MSBuildReferenceKind kind, object reference) { string filename = "test.csproj"; var textDoc = TextEditorFactory.CreateNewDocument(new StringTextSource(docString), filename, MSBuildTextEditorExtension.MSBuildMimeType); var xmlParser = new XmlParser(new XmlRootState(), true); xmlParser.Parse(new StringReader(docString)); var xdoc = xmlParser.Nodes.GetRoot(); var doc = MSBuildTestHelpers.CreateEmptyDocument(); var sb = new MSBuildSchemaBuilder(true, null, new PropertyValueCollector(false), null, null); sb.Run(xdoc, filename, textDoc, doc); var collector = MSBuildReferenceCollector.Create(new MSBuildResolveResult { ReferenceKind = kind, Reference = reference, }); collector.Run(xdoc, filename, textDoc, doc); return(collector.Results); }
List <(int offset, MSBuildResolveResult result)> Resolve(string doc) { return(MSBuildTestHelpers .SelectAtMarkers(doc, "hello.csproj", (state) => MSBuildResolver.Resolve(state.parser, state.textDoc, state.doc)) .ToList()); }