-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #71141 from CyrusNajmabadi/lspApis3
Implement json serialization/deserialization for LSP json messages. Part 1/N.
- Loading branch information
Showing
362 changed files
with
19,146 additions
and
13 deletions.
There are no files selected for viewing
126 changes: 126 additions & 0 deletions
126
src/Features/LanguageServer/Protocol/LanguageServerProtocolResources.Designer.cs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
122 changes: 122 additions & 0 deletions
122
src/Features/LanguageServer/Protocol/LanguageServerProtocolResources.resx
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,122 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<root> | ||
<!-- | ||
Microsoft ResX Schema | ||
Version 1.3 | ||
The primary goals of this format is to allow a simple XML format | ||
that is mostly human readable. The generation and parsing of the | ||
various data types are done through the TypeConverter classes | ||
associated with the data types. | ||
Example: | ||
... ado.net/XML headers & schema ... | ||
<resheader name="resmimetype">text/microsoft-resx</resheader> | ||
<resheader name="version">1.3</resheader> | ||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> | ||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> | ||
<data name="Name1">this is my long string</data> | ||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> | ||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> | ||
[base64 mime encoded serialized .NET Framework object] | ||
</data> | ||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> | ||
[base64 mime encoded string representing a byte array form of the .NET Framework object] | ||
</data> | ||
There are any number of "resheader" rows that contain simple | ||
name/value pairs. | ||
Each data row contains a name, and value. The row also contains a | ||
type or mimetype. Type corresponds to a .NET class that support | ||
text/value conversion through the TypeConverter architecture. | ||
Classes that don't support this are serialized and stored with the | ||
mimetype set. | ||
The mimetype is used for serialized objects, and tells the | ||
ResXResourceReader how to depersist the object. This is currently not | ||
extensible. For a given mimetype the value must be set accordingly: | ||
Note - application/x-microsoft.net.object.binary.base64 is the format | ||
that the ResXResourceWriter will generate, however the reader can | ||
read any of the formats listed below. | ||
mimetype: application/x-microsoft.net.object.binary.base64 | ||
value : The object must be serialized with | ||
: System.Serialization.Formatters.Binary.BinaryFormatter | ||
: and then encoded with base64 encoding. | ||
mimetype: application/x-microsoft.net.object.soap.base64 | ||
value : The object must be serialized with | ||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter | ||
: and then encoded with base64 encoding. | ||
mimetype: application/x-microsoft.net.object.bytearray.base64 | ||
value : The object must be serialized into a byte array | ||
: using a System.ComponentModel.TypeConverter | ||
: and then encoded with base64 encoding. | ||
--> | ||
|
||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> | ||
<xsd:element name="root" msdata:IsDataSet="true"> | ||
<xsd:complexType> | ||
<xsd:choice maxOccurs="unbounded"> | ||
<xsd:element name="data"> | ||
<xsd:complexType> | ||
<xsd:sequence> | ||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> | ||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> | ||
</xsd:sequence> | ||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" /> | ||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> | ||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> | ||
</xsd:complexType> | ||
</xsd:element> | ||
<xsd:element name="resheader"> | ||
<xsd:complexType> | ||
<xsd:sequence> | ||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> | ||
</xsd:sequence> | ||
<xsd:attribute name="name" type="xsd:string" use="required" /> | ||
</xsd:complexType> | ||
</xsd:element> | ||
</xsd:choice> | ||
</xsd:complexType> | ||
</xsd:element> | ||
</xsd:schema> | ||
<resheader name="resmimetype"> | ||
<value>text/microsoft-resx</value> | ||
</resheader> | ||
<resheader name="version"> | ||
<value>1.3</value> | ||
</resheader> | ||
<resheader name="reader"> | ||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | ||
</resheader> | ||
<resheader name="writer"> | ||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | ||
</resheader> | ||
<data name="DocumentUriSerializationError" xml:space="preserve"> | ||
<value>Unable to deserialize Uri. Unexpected value encountered: {0}</value> | ||
</data> | ||
<data name="MarkupContentSerializationError" xml:space="preserve"> | ||
<value>Unable to deserialize MarkupContent. Unexpected value encountered: {0}</value> | ||
</data> | ||
<data name="NestedSumType" xml:space="preserve"> | ||
<value>A SumType cannot have another SumType as type parameter.</value> | ||
</data> | ||
<data name="NoSumTypeMatch" xml:space="preserve"> | ||
<value>None of the SumType type parameters could be deserialized</value> | ||
</data> | ||
<data name="StringEnumMissingConstructor" xml:space="preserve"> | ||
<value>Type {0} is missing a contructor that takes a single string as parameter.</value> | ||
</data> | ||
<data name="StringEnumSerializationError" xml:space="preserve"> | ||
<value>Unable to deserialize string-based enum. Unexpected data encountered: {0}</value> | ||
</data> | ||
<data name="TextDocumentSyncSerializationError" xml:space="preserve"> | ||
<value>Unable to deserialize TextDocumentSyncOptions. Unexpected value encountered: {0}</value> | ||
</data> | ||
</root> |
13 changes: 0 additions & 13 deletions
13
src/Features/LanguageServer/Protocol/LanguageServerResources.cs
This file was deleted.
Oops, something went wrong.
22 changes: 22 additions & 0 deletions
22
src/Features/LanguageServer/Protocol/Protocol/.editorconfig
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,22 @@ | ||
[*.cs] | ||
|
||
# CS0436: Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. | ||
dotnet_diagnostic.CS0436.severity = none | ||
|
||
# CS8618: Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. | ||
dotnet_diagnostic.CS8618.severity = none | ||
|
||
# CS8765: Nullability of type of parameter 'other' doesn't match overridden member (possibly because of nullability attributes). | ||
dotnet_diagnostic.CS8765.severity = none | ||
|
||
# CS8767: Nullability of reference types in type of parameter 'other' of 'bool CodeDescription.Equals(CodeDescription other)' doesn't match implicitly implemented member 'bool IEquatable<CodeDescription>.Equals(CodeDescription? other)' (possibly because of nullability attributes). | ||
dotnet_diagnostic.CS8767.severity = none | ||
|
||
# CS8603: Possible null reference return. | ||
dotnet_diagnostic.CS8603.severity = none | ||
|
||
# CS8604: Possible null reference argument for parameter 'uriString' in 'Uri.Uri(string uriString)'. | ||
dotnet_diagnostic.CS8604.severity = none | ||
|
||
# RS0030: The symbol 'Uri.Uri(string)' is banned in this project | ||
dotnet_diagnostic.RS0030.severity = none |
39 changes: 39 additions & 0 deletions
39
src/Features/LanguageServer/Protocol/Protocol/ApplyWorkspaceEditParams.cs
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,39 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
namespace Roslyn.LanguageServer.Protocol | ||
{ | ||
using System.Runtime.Serialization; | ||
using Newtonsoft.Json; | ||
|
||
/// <summary> | ||
/// Class representing the parameters sent from a server to a client for the workspace/applyEdit request. | ||
/// | ||
/// See the <see href="https://microsoft.github.io/language-server-protocol/specifications/specification-current/#applyWorkspaceEditParams">Language Server Protocol specification</see> for additional information. | ||
/// </summary> | ||
[DataContract] | ||
internal class ApplyWorkspaceEditParams | ||
{ | ||
/// <summary> | ||
/// Gets or sets the label associated with this edit. | ||
/// </summary> | ||
[DataMember(Name = "label")] | ||
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)] | ||
public string? Label | ||
{ | ||
get; | ||
set; | ||
} | ||
|
||
/// <summary> | ||
/// Gets or sets the edit to be applied to the workspace. | ||
/// </summary> | ||
[DataMember(Name = "edit")] | ||
public WorkspaceEdit Edit | ||
{ | ||
get; | ||
set; | ||
} | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
src/Features/LanguageServer/Protocol/Protocol/ApplyWorkspaceEditResponse.cs
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,39 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
namespace Roslyn.LanguageServer.Protocol | ||
{ | ||
using System.Runtime.Serialization; | ||
using Newtonsoft.Json; | ||
|
||
/// <summary> | ||
/// Class representing the response sent for a workspace/applyEdit request. | ||
/// | ||
/// See the <see href="https://microsoft.github.io/language-server-protocol/specifications/specification-current/#applyWorkspaceEditResult">Language Server Protocol specification</see> for additional information. | ||
/// </summary> | ||
[DataContract] | ||
internal class ApplyWorkspaceEditResponse | ||
{ | ||
/// <summary> | ||
/// Gets or sets a value indicating whether edits were applied or not. | ||
/// </summary> | ||
[DataMember(Name = "applied")] | ||
public bool Applied | ||
{ | ||
get; | ||
set; | ||
} | ||
|
||
/// <summary> | ||
/// Gets or sets a string with textual description for why the edit was not applied. | ||
/// </summary> | ||
[DataMember(Name = "failureReason")] | ||
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)] | ||
public string? FailureReason | ||
{ | ||
get; | ||
set; | ||
} | ||
} | ||
} |
Oops, something went wrong.