-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Define schema help model for elements.
- Loading branch information
Showing
2 changed files
with
81 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
using Newtonsoft.Json; | ||
using System; | ||
using System.Collections.Generic; | ||
|
||
namespace MSBuildProjectTools.LanguageServer.Help | ||
{ | ||
/// <summary> | ||
/// Help information for an MSBuild element. | ||
/// </summary> | ||
public class ElementHelp | ||
{ | ||
/// <summary> | ||
/// The property description. | ||
/// </summary> | ||
[JsonProperty("description")] | ||
public string Description { get; set; } | ||
|
||
/// <summary> | ||
/// Help link for the element (if any). | ||
/// </summary> | ||
[JsonProperty("help")] | ||
public string HelpLink { get; set; } | ||
|
||
/// <summary> | ||
/// Load help property help from JSON. | ||
/// </summary> | ||
/// <param name="json"> | ||
/// A <see cref="JsonReader"/> representing the JSON ("PropertyName": { "description": "PropertyDescription" }). | ||
/// </param> | ||
/// <returns> | ||
/// A sorted dictionary of help items, keyed by property name. | ||
/// </returns> | ||
public static SortedDictionary<string, ElementHelp> FromJson(JsonReader json) | ||
{ | ||
if (json == null) | ||
throw new ArgumentNullException(nameof(json)); | ||
|
||
return new JsonSerializer().Deserialize<SortedDictionary<string, ElementHelp>>(json); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters