Remove XmlSchema dependency from XmlCompletionSource.

This commit is contained in:
Kirill Osenkov 2021-08-02 18:32:29 -07:00
Родитель c4027cd858
Коммит f56b7719c9
2 изменённых файлов: 11 добавлений и 21 удалений

Просмотреть файл

@ -7,8 +7,6 @@ using System.Collections.Immutable;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using System.Xml;
using System.Xml.Schema;
using Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion;
using Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.Data;
using Microsoft.VisualStudio.Text;
@ -25,14 +23,6 @@ namespace MonoDevelop.Xml.Editor.Completion
protected ITextView TextView { get; }
protected XmlSchema schema { get; }
/// <summary>
/// Stores attributes that have been prohibited whilst the code
/// generates the attribute completion data.
/// </summary>
protected XmlSchemaObjectCollection prohibitedAttributes = new XmlSchemaObjectCollection ();
protected XmlCompletionSource (ITextView textView)
{
XmlParser = XmlBackgroundParser.GetParser (textView.TextBuffer);
@ -40,11 +30,6 @@ namespace MonoDevelop.Xml.Editor.Completion
InitializeBuiltinItems ();
}
protected XmlCompletionSource (ITextView textView, XmlSchema schema) : this(textView)
{
this.schema = schema;
}
public async virtual Task<CompletionContext> GetCompletionContextAsync (
IAsyncCompletionSession session,
CompletionTrigger trigger,

Просмотреть файл

@ -1,6 +1,4 @@
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
@ -8,9 +6,7 @@ using System.Xml;
using System.Xml.Schema;
using Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion;
using Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.Data;
using Microsoft.VisualStudio.Language.StandardClassification;
using Microsoft.VisualStudio.Text;
using Microsoft.VisualStudio.Text.Adornments;
using Microsoft.VisualStudio.Text.Editor;
using MonoDevelop.Xml.Dom;
@ -19,9 +15,18 @@ namespace MonoDevelop.Xml.Editor.Completion
public class XmlSchemaCompletionSource : XmlCompletionSource
{
protected XmlSchema lastSearchedSchema = null;
protected XmlSchema schema { get; }
public XmlSchemaCompletionSource (ITextView textView, XmlSchema schema) : base(textView, schema)
{}
public XmlSchemaCompletionSource (ITextView textView, XmlSchema schema) : base(textView)
{
this.schema = schema;
}
/// <summary>
/// Stores attributes that have been prohibited whilst the code
/// generates the attribute completion data.
/// </summary>
protected XmlSchemaObjectCollection prohibitedAttributes = new XmlSchemaObjectCollection ();
/// <summary>
/// Converts the element to a complex type if possible.