diff --git a/src/LanguageServer.Engine/CompletionProviders/PackageReferenceCompletion.cs b/src/LanguageServer.Engine/CompletionProviders/PackageReferenceCompletion.cs
index 84f2787..ef41484 100644
--- a/src/LanguageServer.Engine/CompletionProviders/PackageReferenceCompletion.cs
+++ b/src/LanguageServer.Engine/CompletionProviders/PackageReferenceCompletion.cs
@@ -21,11 +21,6 @@ namespace MSBuildProjectTools.LanguageServer.CompletionProviders
public class PackageReferenceCompletion
: CompletionProvider
{
- ///
- /// A relative path representing an ItemGroup element.
- ///
- static readonly XSPath ItemGroupElementPath = XSPath.Parse("ItemGroup");
-
///
/// Create a new .
///
@@ -87,7 +82,7 @@ public PackageReferenceCompletion(ILogger logger)
completions.AddRange(packageCompletions);
}
}
- else if (location.CanCompleteElement(out XSElement replaceElement, parentPath: ItemGroupElementPath))
+ else if (location.CanCompleteElement(out XSElement replaceElement, parentPath: WellKnownElementPaths.ItemGroup))
{
if (replaceElement != null)
{
diff --git a/src/LanguageServer.Engine/CompletionProviders/PropertyElementCompletion.cs b/src/LanguageServer.Engine/CompletionProviders/PropertyElementCompletion.cs
index a2adefb..74e0e34 100644
--- a/src/LanguageServer.Engine/CompletionProviders/PropertyElementCompletion.cs
+++ b/src/LanguageServer.Engine/CompletionProviders/PropertyElementCompletion.cs
@@ -20,11 +20,6 @@ namespace MSBuildProjectTools.LanguageServer.CompletionProviders
public class PropertyElementCompletion
: CompletionProvider
{
- ///
- /// A relative path representing a PropertyGroup element.
- ///
- static readonly XSPath PropertyGroupElementPath = XSPath.Parse("PropertyGroup");
-
///
/// Create a new .
///
@@ -71,7 +66,7 @@ public PropertyElementCompletion(ILogger logger)
using (await projectDocument.Lock.ReaderLockAsync())
{
XSElement replaceElement;
- if (!location.CanCompleteElement(out replaceElement, parentPath: PropertyGroupElementPath))
+ if (!location.CanCompleteElement(out replaceElement, parentPath: WellKnownElementPaths.PropertyGroup))
{
Log.Verbose("Not offering any completions for {XmlLocation:l} (not a direct child of a 'PropertyGroup' element).", location);
diff --git a/src/LanguageServer.Engine/CompletionProviders/TopLevelElementCompletion.cs b/src/LanguageServer.Engine/CompletionProviders/TopLevelElementCompletion.cs
index 8ea6750..8d8af03 100644
--- a/src/LanguageServer.Engine/CompletionProviders/TopLevelElementCompletion.cs
+++ b/src/LanguageServer.Engine/CompletionProviders/TopLevelElementCompletion.cs
@@ -20,11 +20,6 @@ namespace MSBuildProjectTools.LanguageServer.CompletionProviders
public class TopLevelElementCompletion
: CompletionProvider
{
- ///
- /// A path representing the root ("Project") element.
- ///
- static readonly XSPath ProjectElementPath = XSPath.Parse("/Project");
-
///
/// Create a new .
///
@@ -71,7 +66,7 @@ public TopLevelElementCompletion(ILogger logger)
using (await projectDocument.Lock.ReaderLockAsync())
{
XSElement replaceElement;
- if (!location.CanCompleteElement(out replaceElement, parentPath: ProjectElementPath))
+ if (!location.CanCompleteElement(out replaceElement, parentPath: WellKnownElementPaths.Project))
{
Log.Verbose("Not offering any completions for {XmlLocation:l} (not a direct child of the 'Project' element).", location);
diff --git a/src/LanguageServer.SemanticModel.MSBuild/WellKnownElementPaths.cs b/src/LanguageServer.SemanticModel.MSBuild/WellKnownElementPaths.cs
new file mode 100644
index 0000000..4b6fd70
--- /dev/null
+++ b/src/LanguageServer.SemanticModel.MSBuild/WellKnownElementPaths.cs
@@ -0,0 +1,23 @@
+namespace MSBuildProjectTools.LanguageServer.SemanticModel
+{
+ ///
+ /// s representing well-known elements in MSBuild projects.
+ ///
+ public static class WellKnownElementPaths
+ {
+ ///
+ /// The absolute path of the root "Project" element.
+ ///
+ public static XSPath Project = XSPath.Parse("/Project");
+
+ ///
+ /// The relative path that represents a "PropertyGroup" element (static or dynamic).
+ ///
+ public static readonly XSPath PropertyGroup = XSPath.Parse("PropertyGroup");
+
+ ///
+ /// The relative path that represents a "ItemGroup" element (static or dynamic).
+ ///
+ public static readonly XSPath ItemGroup = XSPath.Parse("ItemGroup");
+ }
+}