Merge pull request #1 from xamarin/dev/allisonkim/schema

Dev/allisonkim/schema
This commit is contained in:
Kirill Osenkov 2021-08-06 09:08:28 -07:00 коммит произвёл GitHub
Родитель cdd3ddd5b4 e7a57da0e9
Коммит c1f1e31e5d
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
19 изменённых файлов: 7996 добавлений и 925 удалений

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

@ -12,6 +12,7 @@ namespace MonoDevelop.Xml.Editor.Classification
{
//[Export (typeof (ITaggerProvider))]
[TagType (typeof (IClassificationTag))]
[ContentType (XmlContentTypeNames.Csproj)]
[ContentType (XmlContentTypeNames.Xml)]
[ContentType (XmlContentTypeNames.Xsd)]
[ContentType (XmlContentTypeNames.Xslt)]

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

@ -27,16 +27,23 @@
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.ComponentModel.Composition;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion;
using Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.Data;
using Microsoft.VisualStudio.Text.Editor;
using Microsoft.VisualStudio.Utilities;
using MonoDevelop.Xml.Dom;
namespace MonoDevelop.Xml.Editor.Completion
{
class InferredXmlCompletionProvider : IXmlCompletionProvider
//[Export (typeof (IAsyncCompletionSourceProvider))]
//[ContentType (XmlContentTypeNames.XmlCore)]
//[Name ("Xml completion item source")]
class InferredXmlCompletionProvider : IXmlCompletionProvider, IAsyncCompletionSourceProvider
{
XmlCompletionSource source;
Dictionary<string, HashSet<string>> elementCompletions = new Dictionary<string, HashSet<string>> ();
Dictionary<string, HashSet<string>> attributeCompletions = new Dictionary<string, HashSet<string>> ();
@ -83,12 +90,12 @@ namespace MonoDevelop.Xml.Editor.Completion
public Task<CompletionContext> GetChildElementCompletionDataAsync (IAsyncCompletionSource source, XmlElementPath path, CancellationToken token)
{
return GetCompletions (source, elementCompletions, path);
return GetCompletionsAsync (source, elementCompletions, path);
}
public Task<CompletionContext> GetAttributeCompletionDataAsync (IAsyncCompletionSource source, XmlElementPath path, CancellationToken token)
{
return GetCompletions (source, attributeCompletions, path);
return GetCompletionsAsync (source, attributeCompletions, path);
}
public Task<CompletionContext> GetAttributeValueCompletionDataAsync (IAsyncCompletionSource source, XmlElementPath path, string name, CancellationToken token)
@ -98,12 +105,12 @@ namespace MonoDevelop.Xml.Editor.Completion
public Task<CompletionContext> GetChildElementCompletionDataAsync (IAsyncCompletionSource source, string tagName, CancellationToken token)
{
return GetCompletions (source, elementCompletions, tagName);
return GetCompletionsAsync (source, elementCompletions, tagName);
}
public Task<CompletionContext> GetAttributeCompletionDataAsync (IAsyncCompletionSource source, string tagName, CancellationToken token)
{
return GetCompletions (source, attributeCompletions, tagName);
return GetCompletionsAsync (source, attributeCompletions, tagName);
}
public Task<CompletionContext> GetAttributeValueCompletionDataAsync (IAsyncCompletionSource source, string tagName, string name, CancellationToken token)
@ -111,7 +118,7 @@ namespace MonoDevelop.Xml.Editor.Completion
return Task.FromResult (CompletionContext.Empty);
}
static Task<CompletionContext> GetCompletions (IAsyncCompletionSource source, Dictionary<string, HashSet<string>> map, string tagName)
static Task<CompletionContext> GetCompletionsAsync (IAsyncCompletionSource source, Dictionary<string, HashSet<string>> map, string tagName)
{
var items = ImmutableArray<CompletionItem>.Empty;
HashSet<string> values;
@ -122,11 +129,17 @@ namespace MonoDevelop.Xml.Editor.Completion
return Task.FromResult (context);
}
static Task<CompletionContext> GetCompletions (IAsyncCompletionSource source, Dictionary<string, HashSet<string>> map, XmlElementPath path)
static Task<CompletionContext> GetCompletionsAsync (IAsyncCompletionSource source, Dictionary<string, HashSet<string>> map, XmlElementPath path)
{
if (path == null || path.Elements.Count == 0)
return Task.FromResult (CompletionContext.Empty);
return GetCompletions (source, map, path.Elements[path.Elements.Count - 1].Name);
return GetCompletionsAsync (source, map, path.Elements[path.Elements.Count - 1].Name);
}
public IAsyncCompletionSource GetOrCreate (ITextView textView)
{
source = new InferredXmlCompletionSource (textView);
return source;
}
}
}

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

@ -0,0 +1,13 @@
using System;
using Microsoft.VisualStudio.Text.Editor;
namespace MonoDevelop.Xml.Editor.Completion
{
public class InferredXmlCompletionSource : XmlCompletionSource
{
public InferredXmlCompletionSource (ITextView textView)
: base(textView)
{
}
}
}

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -0,0 +1,750 @@
<?xml version="1.0" encoding="utf-8"?>
<xs:schema targetNamespace="http://schemas.microsoft.com/developer/msbuild/2003" xmlns:msb="http://schemas.microsoft.com/developer/msbuild/2003" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<!-- ======================================================================================= -->
<xs:element name="Project">
<xs:annotation>
<xs:documentation><!-- _locID_text="Project" _locComment="" -->An MSBuild Project</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:group ref="msb:ProjectLevelTagExceptTargetOrImportType" minOccurs="0" maxOccurs="unbounded"/>
<!-- must be at least one Target or Import tag-->
<xs:group ref="msb:TargetOrImportType"/>
<xs:group ref="msb:ProjectLevelTagType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="DefaultTargets" type="xs:string" use="optional">
<xs:annotation>
<xs:documentation><!-- _locID_text="Project_DefaultTargets" _locComment="" -->Optional semi-colon separated list of one or more targets that will be built if no targets are otherwise specified</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="InitialTargets" type="xs:string" use="optional">
<xs:annotation>
<xs:documentation><!-- _locID_text="Project_InitialTargets" _locComment="" -->Optional semi-colon separated list of targets that should always be built before any other targets</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Sdk" type="xs:string" use="optional">
<xs:annotation>
<xs:documentation><!-- _locID_text="Project_Sdk" _locComment="" -->Optional string describing the MSBuild SDK(s) this project should be built with</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="ToolsVersion" type="xs:string" use="optional">
<xs:annotation>
<xs:documentation><!-- _locID_text="Project_ToolsVersion" _locComment="" -->Optional string describing the toolset version this project should normally be built with</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
<!-- ======================================================================================= -->
<xs:group name="ProjectLevelTagExceptTargetOrImportType">
<xs:choice>
<xs:element name="PropertyGroup" type="msb:PropertyGroupType"/>
<xs:element name="ItemGroup" type="msb:ItemGroupType"/>
<xs:element name="ItemDefinitionGroup" type="msb:ItemDefinitionGroupType"/>
<xs:element name="Choose" type="msb:ChooseType"/>
<xs:element name="UsingTask" type="msb:UsingTaskType"/>
<xs:element name="ProjectExtensions" type="msb:ProjectExtensionsType"/>
</xs:choice>
</xs:group>
<!-- ======================================================================================= -->
<xs:group name="ProjectLevelTagType">
<xs:choice>
<xs:element name="PropertyGroup" type="msb:PropertyGroupType"/>
<xs:element name="ItemGroup" type="msb:ItemGroupType"/>
<xs:element name="ItemDefinitionGroup" type="msb:ItemDefinitionGroupType"/>
<xs:element name="Choose" type="msb:ChooseType"/>
<xs:element name="UsingTask" type="msb:UsingTaskType"/>
<xs:element name="Target" type="msb:TargetType"/>
<xs:element name="Import" type="msb:ImportType"/>
<xs:element name="ImportGroup" type="msb:ImportGroupType"/>
<xs:element name="ProjectExtensions" type="msb:ProjectExtensionsType"/>
</xs:choice>
</xs:group>
<!-- ======================================================================================= -->
<xs:group name="TargetOrImportType">
<xs:choice>
<xs:element name="Target" type="msb:TargetType"/>
<xs:element name="Import" type="msb:ImportType"/>
<xs:element name="ImportGroup" type="msb:ImportGroupType"/>
</xs:choice>
</xs:group>
<!-- ======================================================================================= -->
<xs:complexType name="TargetType">
<xs:annotation>
<xs:documentation><!-- _locID_text="TargetType" _locComment="" -->Groups tasks into a section of the build process</xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:sequence>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element ref="msb:Task"/>
<xs:element name="PropertyGroup" type="msb:PropertyGroupType"/>
<xs:element name="ItemGroup" type="msb:ItemGroupType"/>
</xs:choice>
</xs:sequence>
<xs:element name="OnError" type="msb:OnErrorType" minOccurs="0" maxOccurs="unbounded"/>
<!-- no elements are allowed under Target after an OnError element-->
</xs:sequence>
<xs:attribute name="Name" type="msb:non_empty_string" use="required">
<xs:annotation>
<xs:documentation><!-- _locID_text="TargetType_Name" _locComment="" -->Name of the target</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="DependsOnTargets" type="xs:string" use="optional">
<xs:annotation>
<xs:documentation><!-- _locID_text="TargetType_DependsOnTargets" _locComment="" -->Optional semi-colon separated list of targets that should be run before this target</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Inputs" type="xs:string" use="optional">
<xs:annotation>
<xs:documentation><!-- _locID_text="TargetType_Inputs" _locComment="" -->Optional semi-colon separated list of files that form inputs into this target. Their timestamps will be compared with the timestamps of files in Outputs to determine whether the Target is up to date</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Outputs" type="xs:string" use="optional">
<xs:annotation>
<xs:documentation><!-- _locID_text="TargetType_Outputs" _locComment="" -->Optional semi-colon separated list of files that form outputs into this target. Their timestamps will be compared with the timestamps of files in Inputs to determine whether the Target is up to date</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Condition" type="xs:string" use="optional">
<xs:annotation>
<xs:documentation><!-- _locID_text="TargetType_Condition" _locComment="" -->Optional expression evaluated to determine whether the Target and the targets it depends on should be run</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="KeepDuplicateOutputs" type="xs:string" use="optional">
<xs:annotation>
<xs:documentation><!-- _locID_text="TargetType_KeepDuplicateOutputs" _locComment="" -->Optional expression evaluated to determine whether duplicate items in the Target's Returns should be removed before returning them. The default is not to eliminate duplicates.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Returns" type="xs:string" use="optional">
<xs:annotation>
<xs:documentation><!-- _locID_text="TargetType_Returns" _locComment="" -->Optional expression evaluated to determine which items generated by the target should be returned by the target. If there are no Returns attributes on Targets in the file, the Outputs attributes are used instead for this purpose.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="BeforeTargets" type="xs:string" use="optional">
<xs:annotation>
<xs:documentation><!-- _locID_text="TargetType_BeforeTargets" _locComment="" -->Optional semi-colon separated list of targets that this target should run before.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="AfterTargets" type="xs:string" use="optional">
<xs:annotation>
<xs:documentation><!-- _locID_text="TargetType_AfterTargets" _locComment="" -->Optional semi-colon separated list of targets that this target should run after.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Label" type="xs:string" use="optional">
<xs:annotation>
<xs:documentation><!-- _locID_text="ImportType_Label" _locComment="" -->Optional expression. Used to identify or order system and user elements</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
<!-- ======================================================================================= -->
<xs:complexType name="PropertyGroupType">
<xs:annotation>
<xs:documentation><!-- _locID_text="PropertyGroupType" _locComment="" -->Groups property definitions</xs:documentation>
</xs:annotation>
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:element ref="msb:Property"/>
</xs:sequence>
<xs:attribute name="Condition" type="xs:string" use="optional">
<xs:annotation>
<xs:documentation><!-- _locID_text="PropertyGroupType_Condition" _locComment="" -->Optional expression evaluated to determine whether the PropertyGroup should be used</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Label" type="xs:string" use="optional">
<xs:annotation>
<xs:documentation><!-- _locID_text="PropertyGroupType_Label" _locComment="" -->Optional expression. Used to identify or order system and user elements</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
<!-- ======================================================================================= -->
<xs:complexType name="ImportGroupType">
<xs:annotation>
<xs:documentation><!-- _locID_text="ImportGroupType" _locComment="" -->Groups import definitions</xs:documentation>
</xs:annotation>
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:element name="Import" type="msb:ImportType"/>
</xs:sequence>
<xs:attribute name="Condition" type="xs:string" use="optional">
<xs:annotation>
<xs:documentation><!-- _locID_text="ImportGroupType_Condition" _locComment="" -->Optional expression evaluated to determine whether the ImportGroup should be used</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Label" type="xs:string" use="optional">
<xs:annotation>
<xs:documentation><!-- _locID_text="ImportGroupType_Label" _locComment="" -->Optional expression. Used to identify or order system and user elements</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
<!-- ======================================================================================= -->
<xs:complexType name="ItemGroupType">
<xs:annotation>
<xs:documentation><!-- _locID_text="ItemGroupType" _locComment="" -->Groups item list definitions</xs:documentation>
</xs:annotation>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element ref="msb:Item"/>
<xs:element name="Link" type="msb:LinkItem" />
<xs:element name="ResourceCompile" type="msb:ResourceCompile" />
<xs:element name="PreBuildEvent" type="msb:PreBuildEventItem" />
<xs:element name="PostBuildEvent" type="msb:PostBuildEventItem" />
</xs:choice>
<xs:attribute name="Condition" type="xs:string" use="optional">
<xs:annotation>
<xs:documentation><!-- _locID_text="ItemGroupType_Condition" _locComment="" -->Optional expression evaluated to determine whether the ItemGroup should be used</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Label" type="xs:string" use="optional">
<xs:annotation>
<xs:documentation><!-- _locID_text="ItemGroupType_Label" _locComment="" -->Optional expression. Used to identify or order system and user elements</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
<!-- ======================================================================================= -->
<xs:complexType name="ItemDefinitionGroupType">
<xs:annotation>
<xs:documentation><!-- _locID_text="ItemDefinitionGroupType" _locComment="" -->Groups item metadata definitions</xs:documentation>
</xs:annotation>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element ref="msb:Item"/>
<xs:element name="Link" type="msb:LinkItem" />
<xs:element name="ResourceCompile" type="msb:ResourceCompile" />
<xs:element name="PreBuildEvent" type="msb:PreBuildEventItem" />
<xs:element name="PostBuildEvent" type="msb:PostBuildEventItem" />
</xs:choice>
<xs:attribute name="Condition" type="xs:string" use="optional">
<xs:annotation>
<xs:documentation><!-- _locID_text="ItemDefinitionGroupType_Condition" _locComment="" -->Optional expression evaluated to determine whether the ItemDefinitionGroup should be used</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Label" type="xs:string" use="optional">
<xs:annotation>
<xs:documentation><!-- _locID_text="ItemDefinitionGroupType_Label" _locComment="" -->Optional expression. Used to identify or order system and user elements</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
<!-- ======================================================================================= -->
<xs:complexType name="ChooseType">
<xs:annotation>
<xs:documentation><!-- _locID_text="ChooseType" _locComment="" -->Groups When and Otherwise elements</xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:element name="When" type="msb:WhenType" maxOccurs="unbounded"/>
<xs:element name="Otherwise" type="msb:OtherwiseType" minOccurs="0"/>
</xs:sequence>
<xs:attribute name="Label" type="xs:string" use="optional">
<xs:annotation>
<xs:documentation><!-- _locID_text="ChooseType_Label" _locComment="" -->Optional expression. Used to identify or order system and user elements</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
<!-- ======================================================================================= -->
<xs:complexType name="WhenType">
<xs:annotation>
<xs:documentation><!-- _locID_text="WhenType" _locComment="" -->Groups PropertyGroup and/or ItemGroup elements</xs:documentation>
</xs:annotation>
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:choice>
<xs:element name="PropertyGroup" type="msb:PropertyGroupType"/>
<xs:element name="ItemGroup" type="msb:ItemGroupType"/>
<xs:element name="Choose" type="msb:ChooseType"/>
</xs:choice>
</xs:sequence>
<xs:attribute name="Condition" type="xs:string" use="required">
<xs:annotation>
<xs:documentation><!-- _locID_text="WhenType_Condition" _locComment="" -->Optional expression evaluated to determine whether the child PropertyGroups and/or ItemGroups should be used</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
<!-- ======================================================================================= -->
<xs:complexType name="OtherwiseType">
<xs:annotation>
<xs:documentation><!-- _locID_text="OtherwiseType" _locComment="" -->Groups PropertyGroup and/or ItemGroup elements that are used if no Conditions on sibling When elements evaluate to true</xs:documentation>
</xs:annotation>
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:choice>
<xs:element name="PropertyGroup" type="msb:PropertyGroupType"/>
<xs:element name="ItemGroup" type="msb:ItemGroupType"/>
<xs:element name="Choose" type="msb:ChooseType"/>
</xs:choice>
</xs:sequence>
</xs:complexType>
<!-- ======================================================================================= -->
<xs:complexType name="OnErrorType">
<xs:annotation>
<xs:documentation><!-- _locID_text="OnErrorType" _locComment="" -->Specifies targets to execute in the event of a recoverable error</xs:documentation>
</xs:annotation>
<xs:attribute name="Condition" type="xs:string" use="optional">
<xs:annotation>
<xs:documentation><!-- _locID_text="OnErrorType_Condition" _locComment="" -->Optional expression evaluated to determine whether the targets should be executed</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="ExecuteTargets" type="msb:non_empty_string" use="required">
<xs:annotation>
<xs:documentation><!-- _locID_text="OnErrorType_ExecuteTargets" _locComment="" -->Semi-colon separated list of targets to execute</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Label" type="xs:string" use="optional">
<xs:annotation>
<xs:documentation><!-- _locID_text="ImportType_Label" _locComment="" -->Optional expression. Used to identify or order system and user elements</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
<!-- ======================================================================================= -->
<xs:complexType name="UsingTaskType">
<xs:annotation>
<xs:documentation><!-- _locID_text="UsingTaskType" _locComment="" -->Defines the assembly containing a task's implementation, or contains the implementation itself.</xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:element name="ParameterGroup" type="msb:ParameterGroupType" minOccurs="0" maxOccurs="1"/>
<xs:element name="Task" type="msb:UsingTaskBodyType" minOccurs="0" maxOccurs="1"/>
</xs:sequence>
<xs:attribute name="Condition" type="xs:string" use="optional">
<xs:annotation>
<xs:documentation><!-- _locID_text="UsingTaskType_Condition" _locComment="" -->Optional expression evaluated to determine whether the declaration should be evaluated</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="AssemblyName" type="msb:non_empty_string" use="optional">
<xs:annotation>
<xs:documentation><!-- _locID_text="UsingTaskType_AssemblyName" _locComment="" -->Optional name of assembly containing the task. Either AssemblyName or AssemblyFile must be used</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="AssemblyFile" type="msb:non_empty_string" use="optional">
<xs:annotation>
<xs:documentation><!-- _locID_text="UsingTaskType_AssemblyFile" _locComment="" -->Optional path to assembly containing the task. Either AssemblyName or AssemblyFile must be used</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="TaskName" type="msb:non_empty_string" use="required">
<xs:annotation>
<xs:documentation><!-- _locID_text="UsingTaskType_TaskName" _locComment="" -->Name of task class in the assembly</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="TaskFactory" type="msb:non_empty_string" use="optional">
<xs:annotation>
<xs:documentation><!-- _locID_text="UsingTaskType_TaskFactory" _locComment="" -->Name of the task factory class in the assembly</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Architecture" type="msb:architecture" use="optional">
<xs:annotation>
<xs:documentation>
<!-- _locID_text="UsingTaskType_Architecture" _locComment="" -->Defines the architecture of the task host that this task should be run in. Currently supported values: x86, x64, CurrentArchitecture, and * (any). If Architecture is not specified, either the task will be run within the MSBuild process, or the task host will be launched using the architecture of the parent MSBuild process
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Runtime" type="msb:runtime" use="optional">
<xs:annotation>
<xs:documentation>
<!-- _locID_text="UsingTaskType_Runtime" _locComment="" -->Defines the .NET runtime version of the task host that this task should be run in. Currently supported values: CLR2, CLR4, CurrentRuntime, and * (any). If Runtime is not specified, either the task will be run within the MSBuild process, or the task host will be launched using the runtime of the parent MSBuild process
</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
<!-- ======================================================================================= -->
<xs:complexType name="ParameterGroupType">
<xs:annotation>
<xs:documentation><!-- _locID_text="ParameterGroupType" _locComment="" -->Groups parameters that are part of an inline task definition.</xs:documentation>
</xs:annotation>
<!-- ParameterGroup contains parameter elements whose element names are the parameter names.
Attributes are:
* ParameterType. Optional string. Type of the task parameter. Defaults to string type.
* Output. Optional bool. Whether this task parameter can be retrieved as an output. Defaults to false.
* Required. Optional bool. Whether this task parameter is required to be passed a value. Defaults to false.
It is not possible to validate attributes on elements with undefined names using XSD.
-->
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:any processContents="skip"/>
</xs:sequence>
</xs:complexType>
<!-- ======================================================================================= -->
<xs:complexType name="UsingTaskBodyType" mixed="true">
<xs:annotation>
<xs:documentation><!-- _locID_text="UsingTaskBodyType" _locComment="" -->Contains the inline task implementation. Content is opaque to MSBuild.</xs:documentation>
</xs:annotation>
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:any namespace="##any" processContents="skip"/>
</xs:sequence>
<xs:attribute name="Evaluate" type="msb:boolean" use="optional">
<xs:annotation>
<xs:documentation><!-- _locID_text="UsingTaskBodyType_Evaluate" _locComment="" -->Whether the body should have properties expanded before use. Defaults to false.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
<!-- ======================================================================================= -->
<xs:complexType name="ImportType">
<xs:annotation>
<xs:documentation><!-- _locID_text="ImportType" _locComment="" -->Declares that the contents of another project file should be inserted at this location</xs:documentation>
</xs:annotation>
<xs:attribute name="Condition" type="xs:string" use="optional">
<xs:annotation>
<xs:documentation><!-- _locID_text="ImportType_Condition" _locComment="" -->Optional expression evaluated to determine whether the import should occur</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Project" type="msb:non_empty_string" use="required">
<xs:annotation>
<xs:documentation><!-- _locID_text="ImportType_Project" _locComment="" -->Project file to import</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Label" type="xs:string" use="optional">
<xs:annotation>
<xs:documentation><!-- _locID_text="ImportType_Label" _locComment="" -->Optional expression. Used to identify or order system and user elements</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Sdk" type="xs:string" use="optional">
<xs:annotation>
<xs:documentation>
<!-- _locID_text="ImportType_Sdk" _locComment="" -->Name of the SDK which contains the project file to import</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Version" type="xs:string" use="optional">
<xs:annotation>
<xs:documentation>
<!-- _locID_text="ImportType_Version" _locComment="" -->Optional expression used to specify the version of the SDK referenced by this import</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="MinimumVersion" type="xs:string" use="optional">
<xs:annotation>
<xs:documentation>
<!-- _locID_text="ImportType_MinimumVersion" _locComment="" -->Optional expression used to specify the minimum SDK version required by the referring import</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
<!-- ======================================================================================= -->
<xs:complexType name="ProjectExtensionsType" mixed="true">
<xs:annotation>
<xs:documentation><!-- _locID_text="ProjectExtensionsType" _locComment="" -->Optional section used by MSBuild hosts, that may contain arbitrary XML content that is ignored by MSBuild itself</xs:documentation>
</xs:annotation>
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:any processContents="skip"/>
</xs:sequence>
</xs:complexType>
<!-- ======================================================================================= -->
<xs:element name="Item" type="msb:SimpleItemType" abstract="true"/>
<!-- ======================================================================================= -->
<!-- convenience type for items that have no meta-data-->
<!-- note this allows Remove or no attribute instead of Include, which is too lax outside of Targets at present, but
it's the best we can reasonably do with an XSD -->
<xs:complexType name="SimpleItemType">
<xs:attribute name="Condition" type="xs:string" use="optional">
<xs:annotation>
<xs:documentation><!-- _locID_text="SimpleItemType_Condition" _locComment="" -->Optional expression evaluated to determine whether the items should be evaluated</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Include" type="xs:string" use="optional">
<xs:annotation>
<xs:documentation><!-- _locID_text="SimpleItemType_Include" _locComment="" -->Semi-colon separated list of files (wildcards are allowed) or other item names to include in this item list</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Exclude" type="xs:string" use="optional">
<xs:annotation>
<xs:documentation><!-- _locID_text="SimpleItemType_Exclude" _locComment="" -->Semi-colon separated list of files (wildcards are allowed) or other item names to exclude from the Include list</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Remove" type="xs:string" use="optional">
<xs:annotation>
<xs:documentation><!-- _locID_text="SimpleItemType_Remove" _locComment="" -->Semi-colon separated list of files (wildcards are allowed) or other item names to remove from the existing list contents</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Update" type="xs:string" use="optional">
<xs:annotation>
<xs:documentation><!-- _locID_text="SimpleItemType_Remove" _locComment="" -->Semi-colon separated list of files (wildcards are allowed) or other item names to be updated with the metadata from contained in this xml element</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Label" type="xs:string" use="optional">
<xs:annotation>
<xs:documentation>
<!-- _locID_text="ImportGroupType_Label" _locComment="" -->Optional expression. Used to identify or order system and user elements
</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
<!-- ======================================================================================= -->
<!-- general utility type allowing an item type to be defined but not its child meta-data-->
<xs:complexType name="GenericItemType">
<xs:complexContent>
<xs:extension base="msb:SimpleItemType">
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:any namespace="##any" processContents="skip"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<!-- ======================================================================================= -->
<!-- no type declared on this abstract element, so either a simple or complex type can be substituted for it.-->
<xs:element name="Property" abstract="true"/>
<!-- ======================================================================================= -->
<!-- convenience type for properties that just want to allow text and no elements in them-->
<xs:complexType name="StringPropertyType">
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="Condition" type="xs:string" use="optional">
<xs:annotation>
<xs:documentation><!-- _locID_text="StringPropertyType_Condition" _locComment="" -->Optional expression evaluated to determine whether the property should be evaluated</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Label" type="xs:string" use="optional">
<xs:annotation>
<xs:documentation>
<!-- _locID_text="ImportGroupType_Label" _locComment="" -->Optional expression. Used to identify or order system and user elements
</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<!-- ======================================================================================= -->
<!-- general utility type allowing text and/or elements inside-->
<xs:complexType name="GenericPropertyType" mixed="true">
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:any namespace="##any" processContents="skip"/>
</xs:sequence>
<xs:attribute name="Condition" type="xs:string" use="optional">
<xs:annotation>
<xs:documentation><!-- _locID_text="GenericPropertyType_Condition" _locComment="" -->Optional expression evaluated to determine whether the property should be evaluated</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Label" type="xs:string" use="optional">
<xs:annotation>
<xs:documentation>
<!-- _locID_text="ImportGroupType_Label" _locComment="" -->Optional expression. Used to identify or order system and user elements
</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
<!-- ======================================================================================= -->
<xs:element name="Task" type="msb:TaskType" abstract="true"/>
<!-- ======================================================================================= -->
<xs:complexType name="TaskType">
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:element name="Output">
<xs:annotation>
<xs:documentation><!-- _locID_text="TaskType_Output" _locComment="" -->Optional element specifying a specific task output to be gathered</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:attribute name="TaskParameter" type="msb:non_empty_string" use="required">
<xs:annotation>
<xs:documentation><!-- _locID_text="TaskType_Output_TaskParameter" _locComment="" -->Task parameter to gather. Matches the name of a .NET Property on the task class that has an [Output] attribute</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="ItemName" type="msb:non_empty_string" use="optional">
<xs:annotation>
<xs:documentation><!-- _locID_text="TaskType_Output_ItemName" _locComment="" -->Optional name of an item list to put the gathered outputs into. Either ItemName or PropertyName must be specified</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="PropertyName" type="msb:non_empty_string" use="optional">
<xs:annotation>
<xs:documentation><!-- _locID_text="TaskType_Output_PropertyName" _locComment="" -->Optional name of a property to put the gathered output into. Either PropertyName or ItemName must be specified</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Condition" type="xs:string" use="optional">
<xs:annotation>
<xs:documentation><!-- _locID_text="TaskType_Output_Condition" _locComment="" -->Optional expression evaluated to determine whether the output should be gathered</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="Condition" type="xs:string" use="optional">
<xs:annotation>
<xs:documentation><!-- _locID_text="TaskType_Condition" _locComment="" -->Optional expression evaluated to determine whether the task should be executed</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="ContinueOnError" type="msb:boolean" use="optional">
<xs:annotation>
<xs:documentation><!-- _locID_text="TaskType_ContinueOnError" _locComment="" -->Optional boolean indicating whether a recoverable task error should be ignored. Default false</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Architecture" type="msb:architecture" use="optional">
<xs:annotation>
<xs:documentation>
<!-- _locID_text="TaskType_Architecture" _locComment="" -->Defines the bitness of the task if it must be run specifically in a 32bit or 64bit process. If not specified, it will run with the bitness of the build process. If there are multiple tasks defined in UsingTask with the same name but with different Architecture attribute values, the value of the Architecture attribute specified here will be used to match and select the correct task
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Runtime" type="msb:runtime" use="optional">
<xs:annotation>
<xs:documentation>
<!-- _locID_text="TaskType_Runtime" _locComment="" -->Defines the .NET runtime of the task. This must be specified if the task must run on a specific version of the .NET runtime. If not specified, the task will run on the runtime being used by the build process. If there are multiple tasks defined in UsingTask with the same name but with different Runtime attribute values, the value of the Runtime attribute specified here will be used to match and select the correct task
</xs:documentation>
</xs:annotation>
</xs:attribute>
<!-- We don't need the anyAttribute here because other types deriving from this type will add the right attributes.-->
</xs:complexType>
<!-- ======================================================================================= -->
<!-- XSD considers an empty-valued attribute to satisfy use="required", but we want it to have a non-empty value in most cases, hence this utility type. -->
<xs:simpleType name="non_empty_string">
<xs:restriction base="xs:string">
<xs:minLength value="1"/>
</xs:restriction>
</xs:simpleType>
<!-- This type causes intellisense to suggest "true" or "false", but doesn't actually constrain the value beyond msb:non_empty_string.
We can't constrain the value, because the project author might want to pass a property or item instead of a literal value.
Besides, MSBuild will accept other literal values, like "on" and "off", just as well. -->
<xs:simpleType name="boolean">
<xs:union memberTypes="msb:non_empty_string">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="true" />
<xs:enumeration value="false" />
</xs:restriction>
</xs:simpleType>
</xs:union>
</xs:simpleType>
<!-- Similar trick for Importance -->
<xs:simpleType name="importance">
<xs:union memberTypes="msb:non_empty_string">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="high" />
<xs:enumeration value="normal" />
<xs:enumeration value="low" />
</xs:restriction>
</xs:simpleType>
</xs:union>
</xs:simpleType>
<!-- Similar trick for Architecture -->
<xs:simpleType name="architecture">
<xs:union memberTypes="msb:non_empty_string">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="*" />
<xs:enumeration value="CurrentArchitecture" />
<xs:enumeration value="x86" />
<xs:enumeration value="x64" />
</xs:restriction>
</xs:simpleType>
</xs:union>
</xs:simpleType>
<!-- Similar trick for Runtime -->
<xs:simpleType name="runtime">
<xs:union memberTypes="msb:non_empty_string">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="*" />
<xs:enumeration value="CurrentRuntime" />
<xs:enumeration value="CLR2" />
<xs:enumeration value="CLR4" />
</xs:restriction>
</xs:simpleType>
</xs:union>
</xs:simpleType>
<!-- ======================================================================================= -->
<!-- These types are used to enable Tasks and TaskItems global elements to exist in the schema.
They cannot both be declared as "Link" Elements of differing types in global scope. -->
<xs:complexType name="LinkItem">
<xs:complexContent>
<xs:extension base="msb:SimpleItemType">
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="AdditionalDependencies" />
<xs:element name="OutputFile" />
<xs:element name="AssemblyDebug" />
<xs:element name="SubSystem" />
<xs:element name="ShowProgress" />
<xs:element name="GenerateDebugInformation" />
<xs:element name="EnableCOMDATFolding" />
<xs:element name="OptimizeReferences" />
<xs:element name="Version" />
<xs:element name="Driver"/>
<xs:element name="RandomizedBaseAddress" />
<xs:element name="SuppressStartupBanner" />
<xs:element name="AdditionalLibraryDirectories" />
<xs:element name="Profile" />
<xs:element name="LinkStatus" />
<xs:element name="FixedBaseAddress"/>
<xs:element name="DataExecutionPrevention" />
<xs:element name="SwapRunFromCD"/>
<xs:element name="SwapRunFromNET" />
<xs:element name="RegisterOutput" />
<xs:element name="AllowIsolation" />
<xs:element name="EnableUAC" />
<xs:element name="UACExecutionLevel" />
<xs:element name="UACUIAccess" />
<xs:element name="PreventDllBinding" />
<xs:element name="IgnoreStandardIncludePath"/>
<xs:element name="GenerateMapFile" />
<xs:element name="IgnoreEmbeddedIDL" />
<xs:element name="TypeLibraryResourceID" />
<xs:element name="LinkErrorReporting" />
<xs:element name="MapExports"/>
<xs:element name="TargetMachine" />
<xs:element name="TreatLinkerWarningAsErrors" />
<xs:element name="ForceFileOutput" />
<xs:element name="CreateHotPatchableImage" />
<xs:element name="SpecifySectionAttributes" />
<xs:element name="MSDOSStubFileName" />
<xs:element name="IgnoreAllDefaultLibraries" />
<xs:element name="IgnoreSpecificDefaultLibraries" />
<xs:element name="ModuleDefinitionFile" />
<xs:element name="AddModuleNamesToAssembly" />
<xs:element name="EmbedManagedResourceFile" />
<xs:element name="ForceSymbolReferences" />
<xs:element name="DelayLoadDLLs" />
<xs:element name="AssemblyLinkResource" />
<xs:element name="AdditionalManifestDependencies" />
<xs:element name="StripPrivateSymbols" />
<xs:element name="MapFileName" />
<xs:element name="MinimumRequiredVersion" />
<xs:element name="HeapReserveSize" />
<xs:element name="HeapCommitSize" />
<xs:element name="StackReserveSize" />
<xs:element name="StackCommitSize" />
<xs:element name="LargeAddressAware" />
<xs:element name="TerminalServerAware" />
<xs:element name="FunctionOrder" />
<xs:element name="ProfileGuidedDatabase" />
<xs:element name="LinkTimeCodeGeneration" />
<xs:element name="MidlCommandFile" />
<xs:element name="MergedIDLBaseFileName" />
<xs:element name="TypeLibraryFile" />
<xs:element name="EntryPointSymbol" />
<xs:element name="BaseAddress" />
<xs:element name="ProgramDatabaseFile"/>
<xs:element name="SupportUnloadOfDelayLoadedDLL" />
<xs:element name="SupportNobindOfDelayLoadedDLL" />
<xs:element name="ImportLibrary" />
<xs:element name="MergeSections" />
<xs:element name="CLRThreadAttribute" />
<xs:element name="CLRImageType" />
<xs:element name="KeyFile" />
<xs:element name="KeyContainer" />
<xs:element name="DelaySign" />
<xs:element name="CLRUnmanagedCodeCheck" />
<xs:element name="SectionAlignment" />
<xs:element name="CLRSupportLastError" />
<xs:element name="ImageHasSafeExceptionHandlers" />
</xs:choice>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="ResourceCompile">
<xs:complexContent>
<xs:extension base="msb:SimpleItemType">
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="Culture" />
<xs:element name="PreprocessorDefinitions" />
<xs:element name="UndefinePreprocessorDefinitions" />
<xs:element name="AdditionalIncludeDirectories" />
<xs:element name="IgnoreStandardIncludePath" />
<xs:element name="ShowProgress" />
<xs:element name="NullTerminateStrings" />
<xs:element name="SuppressStartupBanner" />
<xs:element name="ResourceOutputFileName" />
</xs:choice>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="PreBuildEventItem" >
<xs:complexContent>
<xs:extension base="msb:SimpleItemType">
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="Message" />
<xs:element name="Command" />
</xs:choice>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="PostBuildEventItem" >
<xs:complexContent>
<xs:extension base="msb:SimpleItemType">
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="Message" />
<xs:element name="Command" />
</xs:choice>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:schema>

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

@ -0,0 +1,50 @@
<?xml version="1.0" encoding="utf-8"?>
<xs:schema targetNamespace="http://schemas.microsoft.com/developer/msbuild/2003"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msb="http://schemas.microsoft.com/developer/msbuild/2003"
elementFormDefault="qualified">
<!-- =================== IMPORT COMMON SCHEMA =========================== -->
<xs:include schemaLocation="Microsoft.Build.CommonTypes.xsd"/>
<!-- ========= ADD CUSTOM ITEMS, PROPERTIES, AND TASKS BELOW ======= -->
<!-- Note that these will be in the msbuild namespace. A future version of
msbuild may require that custom itemtypes, properties, and tasks be in a
custom namespace, but currently msbuild only supports the msbuild namespace. -->
<!-- example custom itemtype with particular meta-data required-->
<!--<xs:element name="MyItem" substitutionGroup="msb:Item">
<xs:complexType>
<xs:complexContent>
<xs:extension base="msb:SimpleItemType">
<xs:sequence maxOccurs="1">
<xs:choice>
<xs:element name="MyMetaData" type="xs:string"/>
</xs:choice>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:element>-->
<!-- Example custom itemtype with NO meta-data -->
<!--<xs:element name="MySimpleItem" type="msb:SimpleItemType" substitutionGroup="msb:Item"/>-->
<!-- Example custom itemtype with ANY meta-data -->
<!--<xs:element name="MyFlexibleItem" type="msb:GenericItemType" substitutionGroup="msb:Item"/>-->
<!-- example custom property that allows string content only-->
<!--<xs:element name="MySimpleProperty" type="msb:StringPropertyType" substitutionGroup="msb:Property"/>-->
<!-- example custom task with single required parameter-->
<!--<xs:element name="MyTask" substitutionGroup="msb:Task">
<xs:complexType>
<xs:complexContent>
<xs:extension base="msb:TaskType">
<xs:attribute name="MyParameter" type="xs:boolean" use="required"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:element>-->
</xs:schema>

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

@ -108,7 +108,7 @@ namespace MonoDevelop.Xml.Editor.Completion
foreach (XmlNode node in schemaDocumentation.Markup) {
var textNode = node as XmlText;
if (textNode != null && !string.IsNullOrEmpty (textNode.Data))
documentationBuilder.Append (textNode.Data);
documentationBuilder.Append (textNode.Data.Trim ());
}
}
}

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

@ -7,7 +7,8 @@ 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;
@ -24,11 +25,29 @@ 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);
TextView = textView;
InitializeBuiltinItems ();
// test
//sampleItems = ImmutableArray.Create (
// new CompletionItem ("Hello", this),
// new CompletionItem ("World", this));
}
protected XmlCompletionSource (ITextView textView, XmlSchema schema) : this(textView)
{
this.schema = schema;
}
public async virtual Task<CompletionContext> GetCompletionContextAsync (
@ -107,12 +126,12 @@ namespace MonoDevelop.Xml.Editor.Completion
return null;
}
public virtual Task<object> GetDescriptionAsync (
public async virtual Task<object> GetDescriptionAsync (
IAsyncCompletionSession session,
CompletionItem item,
CancellationToken token)
{
return item.GetDocumentationAsync (session, token);
return await item.GetDocumentationAsync (session, token);
}
public virtual CompletionStartData InitializeCompletion (CompletionTrigger trigger, SnapshotPoint triggerLocation, CancellationToken token)

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

@ -86,7 +86,7 @@ namespace MonoDevelop.Xml.Editor.Completion
var text = parser.GetContext ().KeywordBuilder;
if (isBackspace && text[text.Length-1] == '&') {
if (isBackspace && text.Length > 0 && text[text.Length-1] == '&') {
return (XmlCompletionTrigger.Entity, 0);
}

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

@ -31,7 +31,7 @@ namespace MonoDevelop.Xml.Editor.Completion
/// Represents the path to an xml element starting from the root of the
/// document.
/// </summary>
class XmlElementPath
public class XmlElementPath
{
readonly List<QualifiedName> elements;
XmlNamespacePrefixMap nsMap = new XmlNamespacePrefixMap ();

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

@ -2,6 +2,7 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Collections.Generic;
using Microsoft.VisualStudio.Core.Imaging;
using Microsoft.VisualStudio.Imaging;
using Microsoft.VisualStudio.Text.Adornments;
@ -10,8 +11,13 @@ namespace MonoDevelop.Xml.Editor.Completion
{
public static class XmlImages
{
public static readonly ImageElement Element = CreateElement (KnownImageIds.XMLElement);
public static readonly ImageElement Attribute = CreateElement (KnownImageIds.XMLAttribute);
public static readonly Dictionary<string, int> TempImageIds = new Dictionary<string, int> ()
{
{ "XMLElement", 3245 },
{ "XMLAttribute", 3335 },
};
public static readonly ImageElement Element = CreateElement (TempImageIds["XMLElement"]);
public static readonly ImageElement Attribute = CreateElement (TempImageIds["XMLAttribute"]);
public static readonly ImageElement AttributeValue = CreateElement (KnownImageIds.Constant);
public static readonly ImageElement Namespace = CreateElement (KnownImageIds.XMLNamespace);
public static readonly ImageElement Comment = CreateElement (KnownImageIds.XMLCommentTag);
@ -21,6 +27,12 @@ namespace MonoDevelop.Xml.Editor.Completion
public static ImageElement ClosingTag = Element;
static readonly Guid KnownImagesGuid = KnownImageIds.ImageCatalogGuid;
static ImageElement CreateElement (int id) => new ImageElement (new ImageId (KnownImagesGuid, id));
static ImageElement CreateElement (int id) =>
new ImageElement (new ImageId (new Guid (KnownImageIds.ImageCatalogGuidString), 3335));
//new ImageElement( new ImageId (new Guid ("ae27a6b0-e345-4288-96df-5eaf394ee369"), 3573));
//new ImageElement (new ImageId (new System.Guid ("{ae27a6b0-e345-4288-96df-5eaf394ee369}"), 324));
}
}

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

@ -28,7 +28,7 @@ using System.Collections.Generic;
namespace MonoDevelop.Xml.Editor.Completion
{
class XmlNamespacePrefixMap
public class XmlNamespacePrefixMap
{
readonly Dictionary<string, string> pfNsMap = new Dictionary<string, string> ();
readonly Dictionary<string, string> nsPfMap = new Dictionary<string, string> ();

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

@ -128,7 +128,9 @@ namespace MonoDevelop.Xml.Editor.Completion
name = string.Concat (prefix, ":", name);
var item = new CompletionItem (name, source, XmlImages.Element);
item.AddDocumentation (annotation);
if (annotation != null) {
item.AddDocumentation (annotation);
}
items.Add (item);
}

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -0,0 +1,298 @@
<?xml version="1.0" encoding="utf-8"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet"
xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<xs:element name="CodeSnippets" xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<xs:annotation>
<xs:documentation><!-- _locID_text="CodeSnippets" _locComment="" -->Groups CodeSnippet elements. The CodeSnippets element is the root element of the code snippet XML schema.</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element ref="CodeSnippet" minOccurs="1" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="CodeSnippet" >
<xs:annotation>
<xs:documentation><!-- _locID_text="CodeSnippet" _locComment="" -->Allows you to specify a heading and multiple IntelliSense Code Snippets, which you can insert into Visual Studio 2005 code files.</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="Header">
<xs:annotation>
<xs:documentation><!-- _locID_text="Header" _locComment="" -->Specifies general information about the IntelliSense Code Snippet.</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:choice maxOccurs="unbounded">
<xs:element name="Title" type="xs:string" minOccurs="1" maxOccurs="1">
<xs:annotation>
<xs:documentation><!-- _locID_text="Title" _locComment="" -->
Specifies the title for the code snippet. The title stored in the Title element of the code snippet appears in the Code Snippet Inserter and in the code snippet's description in the Code Snippets Manager.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="Author" type="xs:string" minOccurs="0" maxOccurs="1" >
<xs:annotation>
<xs:documentation><!-- _locID_text="Author" _locComment="" -->
Specifies the name of the snippet author. The Code Snippets Manager displays the code snippet name stored in the Author element of the code snippet.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="Description" type="xs:string" minOccurs="0" maxOccurs="1" >
<xs:annotation>
<xs:documentation><!-- _locID_text="Description" _locComment="" -->
Specifies descriptive information about the contents of an IntelliSense Code Snippet. The text value of the Description element provides a ToolTip for the code snippet in the Code Snippet Inserter and the description for the code snippet in the Code Snippets Manager.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="HelpUrl" type="xs:string" minOccurs="0" maxOccurs="1" >
<xs:annotation>
<xs:documentation><!-- _locID_text="HelpUrl" _locComment="" -->
Specifies a URL that provides more information about a code snippet.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="SnippetTypes" minOccurs="0" maxOccurs="1">
<xs:annotation>
<xs:documentation><!-- _locID_text="SnippetTypes" _locComment="" -->Groups individual SnippetType elements. If the SnippetTypes element is not present, the code snippet can be inserted anywhere in the code.</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" name="SnippetType" >
<xs:annotation>
<xs:documentation><!-- _locID_text="SnippetType" _locComment="" -->Specifies how Visual Studio inserts the code snippet. A value of SurroundsWith allows the code snippet to be placed around a selected piece of code while a value of Expansion allows the code snippet to be inserted at the cursor.</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:union>
<xs:simpleType>
<xs:restriction base="xs:string"/>
</xs:simpleType>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="Expansion" />
<xs:enumeration value="SurroundsWith" />
<xs:enumeration value="Refactoring" />
</xs:restriction>
</xs:simpleType>
</xs:union>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Keywords" minOccurs="0" maxOccurs="1">
<xs:annotation>
<xs:documentation><!-- _locID_text="Keywords" _locComment="" -->Groups individual Keyword elements. The code snippet keywords are used by Visual Studio and represent a standard way for online content providers to add custom keywords.</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" name="Keyword" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Shortcut" type="xs:string" minOccurs="0" maxOccurs="1" >
<xs:annotation>
<xs:documentation><!-- _locID_text="Shortcut" _locComment="" -->Specifies the shortcut text used to insert the snippet. </xs:documentation>
</xs:annotation>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
<xs:element name="Snippet">
<xs:annotation>
<xs:documentation><!-- _locID_text="Snippet" _locComment="" -->Specifies the references, imports, declarations, and code for the code snippet.</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:choice minOccurs="1" maxOccurs="unbounded">
<xs:element name="References" minOccurs="0" maxOccurs="1">
<xs:annotation>
<xs:documentation><!-- _locID_text="References" _locComment="" -->Groups individual Reference elements.</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="Reference" maxOccurs="unbounded" >
<xs:complexType>
<xs:choice>
<xs:element name="Assembly" type="xs:string" minOccurs ="1" maxOccurs ="unbounded">
<xs:annotation>
<xs:documentation><!-- _locID_text="Assembly" _locComment="" -->Specifies the name of the assembly referenced by the code snippet. The Assembly element is only supported by Visual Basic code snippets. The text value of the Assembly element is either the friendly text name of the assembly, such as System.dll, or its strong name, such as System,Version=1.0.0.1,Culture=neutral,PublicKeyToken=9b35aa323c18d4fb1.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="Url" type="xs:string" minOccurs="0" maxOccurs="1">
<xs:annotation>
<xs:documentation><!-- _locID_text="Url" _locComment="" -->Specifies a URL that provides more information about the referenced assembly.</xs:documentation>
</xs:annotation>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Imports" minOccurs="0" maxOccurs="1">
<xs:annotation>
<xs:documentation><!-- _locID_text="Imports" _locComment="" -->Groups individual Import elements. </xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="Import" maxOccurs="unbounded">
<xs:annotation>
<xs:documentation><!-- _locID_text="Import" _locComment="" -->Specifies the imported namespaces used by an IntelliSense Code Snippet.</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="Namespace" type="xs:string">
<xs:annotation>
<xs:documentation><!-- _locID_text="Namespace" _locComment="" -->Specifies the namespace of the code snippet.</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Declarations" minOccurs="0" maxOccurs="1">
<xs:annotation>
<xs:documentation><!-- _locID_text="Declarations" _locComment="" -->Specifies the literals and objects that make up the parts of a code snippet that you can edit.</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:choice minOccurs="1" maxOccurs="unbounded">
<xs:element name="Literal">
<xs:annotation>
<xs:documentation><!-- _locID_text="Literal" _locComment="" -->Defines the literals of the code snippet that you can edit. The Literal element is used to identify a replacement for a piece of code that is entirely contained within the snippet, but will likely be customized after it is inserted into the code. For example, literal strings, numeric values, and some variable names should be declared as literals.</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:choice minOccurs="1" maxOccurs="unbounded">
<xs:element name="ID" type="xs:string">
<xs:annotation>
<xs:documentation><!-- _locID_text="Literal.ID" _locComment="" -->Specifies a unique identifier for a Literal or Object element.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="Type" type="xs:string" minOccurs="0" maxOccurs="1">
<xs:annotation>
<xs:documentation><!-- _locID_text="Literal.Type" _locComment="" -->Specifies the type of the object.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="ToolTip" type="xs:string" minOccurs="0" maxOccurs="1">
<xs:annotation>
<xs:documentation><!-- _locID_text="Literal.ToolTip" _locComment="" -->Describes the expected value and usage of a literal or object in a code snippet, which Visual Studio displays in a ToolTip when it inserts the code snippet into a project.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="Default" type="xs:string">
<xs:annotation>
<xs:documentation><!-- _locID_text="Literal.Default" _locComment="" -->Specifies the default value of the literal or object for an IntelliSense Code Snippet.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="Function" type="xs:string" minOccurs="0" maxOccurs="1">
<xs:annotation>
<xs:documentation><!-- _locID_text="Literal.Function" _locComment="" -->Specifies a function to execute when the literal or object receives focus in Visual Studio.</xs:documentation>
</xs:annotation>
</xs:element>
</xs:choice>
<xs:attribute name="Editable" type="xs:boolean" use="optional" >
<xs:annotation>
<xs:documentation><!-- _locID_text="Literal.Editable" _locComment="" -->Specifies whether or not you can edit the literal after the code snippet is inserted. The default value of this attribute is true.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
<xs:element name="Object">
<xs:annotation>
<xs:documentation><!-- _locID_text="Object" _locComment="" -->Defines the objects of the code snippet that you can edit.</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:choice minOccurs="1" maxOccurs="unbounded">
<xs:element name="ID" type="xs:string" >
<xs:annotation>
<xs:documentation><!-- _locID_text="Object.ID" _locComment="" -->Specifies a unique identifier for a Literal or Object element.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="Type" type="xs:string" minOccurs="1" maxOccurs="1">
<xs:annotation>
<xs:documentation><!-- _locID_text="Object.Type" _locComment="" -->Required. Specifies the type of the object.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="ToolTip" type="xs:string" minOccurs="0" maxOccurs="1">
<xs:annotation>
<xs:documentation><!-- _locID_text="Object.Tooltip" _locComment="" -->Describes the expected value and usage of a literal or object in a code snippet, which Visual Studio displays in a ToolTip when it inserts the code snippet into a project.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="Default" type="xs:string" >
<xs:annotation>
<xs:documentation><!-- _locID_text="Object.Default" _locComment="" -->Specifies the default value of the literal or object for an IntelliSense Code Snippet. This text specifies the default value of the literal or object that fills the fields of the code snippet that you can edit.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="Function" type="xs:string" minOccurs="0" maxOccurs="1">
<xs:annotation>
<xs:documentation><!-- _locID_text="Function" _locComment="" -->
Specifies a function to execute when the literal or object receives focus in Visual Studio.
</xs:documentation>
</xs:annotation>
</xs:element>
</xs:choice>
<xs:attribute name="Editable" type="xs:boolean" use="optional" >
<xs:annotation>
<xs:documentation><!-- _locID_text="Object.Editable" _locComment="" -->Specifies whether or not the object can be edited after the code snippet is inserted. The default value of this attribute is true.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
<xs:element minOccurs="1" maxOccurs="1" name="Code">
<xs:annotation>
<xs:documentation><!-- _locID_text="Code" _locComment="" -->Provides a container the short code blocks of IntelliSense Code Snippets.</xs:documentation>
</xs:annotation>
<xs:complexType mixed="true">
<xs:attribute name="Language" use="required">
<xs:annotation>
<xs:documentation><!-- _locID_text="Language" _locComment="" -->Specifies the language of the code snippet. The values available are VB, CSharp, VJSharp, or XML.</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:union>
<xs:simpleType>
<xs:restriction base="xs:string"/>
</xs:simpleType>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="VB" />
<xs:enumeration value="CSharp" />
<xs:enumeration value="VJSharp" />
<xs:enumeration value="XML" />
</xs:restriction>
</xs:simpleType>
</xs:union>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="Kind" use="optional" >
<xs:annotation>
<xs:documentation><!-- _locID_text="Kind" _locComment="" -->Specifies the kind of code the snippet contains. This attribute filters out snippets based on the current location in the code</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string"/>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="Delimiter" type="xs:string" use="optional" >
<xs:annotation>
<xs:documentation><!-- _locID_text="Delimiter" _locComment="" --> Specifies the delimiter used to describe literals and objects in the code. By default, the delimiter is $.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="Format" type="xs:string" use="required">
<xs:annotation>
<xs:documentation><!-- _locID_text="Format" _locComment="" -->Specifies the schema version of the code snippet. The Format attribute must be a string in the syntax of x.x.x, where each "x" represents a numerical value of the version number. Visual Studio will ignore code snippets with Format attributes that it does not understand.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Hello" type="xs:boolean" use="optional">
<xs:annotation>
<xs:documentation><!-- _locID_text="Format" _locComment="" -->Specifies the schema version of the code snippet. The Format attribute must be a string in the syntax of x.x.x, where each "x" represents a numerical value of the version number. Visual Studio will ignore code snippets with Format attributes that it does not understand.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:schema>

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

@ -48,5 +48,10 @@ namespace MonoDevelop.Xml.Editor
[Name (XmlContentTypeNames.Xsd)]
[BaseDefinition (XmlContentTypeNames.Xml)]
public static readonly ContentTypeDefinition XsdContentTypeDefinition = null;
[Export]
[Name (XmlContentTypeNames.Csproj)]
[BaseDefinition (XmlContentTypeNames.Xml)]
public static readonly ContentTypeDefinition CsprojContentTypeDefinition = null;
}
}

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

@ -34,5 +34,6 @@ namespace MonoDevelop.Xml.Editor
public const string Xml = "xml";
public const string Xslt = "xslt";
public const string Xsd = "xsd";
public const string Csproj = "csproj";
}
}

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

@ -13,8 +13,7 @@
<ProjectReference Include="..\external\MiniEditor\Microsoft.VisualStudio.MiniEditor\Microsoft.VisualStudio.MiniEditor.csproj" />
</ItemGroup>
<ItemGroup>
<Compile Remove="Schema\SchemaAssociationTests.cs" />
<Compile Remove="Schema\XmlSchemaNamespaceTests.cs" />
<Compile Remove="Schema\**\*" />
</ItemGroup>
<ItemGroup>
<None Remove="Schema\xhtml1-strict.xsd" />
@ -24,10 +23,6 @@
<EmbeddedResource Include="Schema\xhtml1-strict.xsd" LogicalName="xhtml1-strict.xsd" />
<EmbeddedResource Include="Schema\XMLSchema.xsd" LogicalName="XMLSchema.xsd" />
</ItemGroup>
<ItemGroup>
<None Include="Schema\SchemaAssociationTests.cs" />
<None Include="Schema\XmlSchemaNamespaceTests.cs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.1.0" />
<PackageReference Include="NUnit" Version="3.12.0" />