Move unused forked code to external directory (#1192)

* Move unused forked code to external directory

* Fix SLN build errors

* Add back resource provider core since it's referenced by main resource provider project

* Update PackageProjects step of pipeline
This commit is contained in:
Karl Burtram
2021-04-16 15:33:35 -07:00
committed by GitHub
parent dc6555a823
commit ccf95aed77
229 changed files with 10058 additions and 10124 deletions

View File

@@ -0,0 +1,19 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
namespace Microsoft.SqlTools.DataProtocol.Contracts.ServerCapabilities
{
/// <summary>
/// Options about Code Lens that the server supports
/// </summary>
public class CodeLensOptions
{
/// <summary>
/// Code lens has a resolve provider, as well
/// TODO: WTF does this mean??
/// </summary>
public bool? ResolveProvider { get; set; }
}
}

View File

@@ -0,0 +1,30 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
namespace Microsoft.SqlTools.DataProtocol.Contracts.ServerCapabilities
{
/// <summary>
/// Defines completion options that the server can support
/// </summary>
public class CompletionOptions
{
/// <summary>
/// Most tools trigger completion request automatically without explicitly requesting it
/// using a keyboard shortcut (eg, ctrl+space). Typically they do so when the user starts
/// to type an identifier. For example if the user types 'c' in a JavaScript file, code
/// completion will automatically pop up and present 'console' besides others as a
/// completion item. Characters that make up identifiers don't need to be listed here.
///
/// If code completion should automatically be triggered on characters not being valid
/// inside an identifier (for example '.' in JavaScript) list them in this.
/// </summary>
public string[] TriggerCharacters { get; set; }
/// <summary>
/// Server provides support to resolve additional information about a completion item
/// </summary>
public bool? ResolveProvider { get; set; }
}
}

View File

@@ -0,0 +1,19 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
namespace Microsoft.SqlTools.DataProtocol.Contracts.ServerCapabilities
{
/// <summary>
/// Options the server support for document links
/// </summary>
public class DocumentLinkOptions
{
/// <summary>
/// Document links have a resolve provider, as well
/// TODO: WTF does this mean?
/// </summary>
public bool? ResolveProvider { get; set; }
}
}

View File

@@ -0,0 +1,23 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
namespace Microsoft.SqlTools.DataProtocol.Contracts.ServerCapabilities
{
/// <summary>
/// Options the server supports regarding formatting a document on type
/// </summary>
public class DocumentOnTypeFormattingOptions
{
/// <summary>
/// Character on which formatting should be triggered, eg '}'
/// </summary>
public string FirstTriggerCharacter { get; set; }
/// <summary>
/// More charactres that trigger formatting
/// </summary>
public string[] MoreTriggerCharacters { get; set; }
}
}

View File

@@ -0,0 +1,18 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
namespace Microsoft.SqlTools.DataProtocol.Contracts.ServerCapabilities
{
/// <summary>
/// Options the server supports regarding command execution
/// </summary>
public class ExecuteCommandOptions
{
/// <summary>
/// Commands the server can execute
/// </summary>
public string[] Commands { get; set; }
}
}

View File

@@ -0,0 +1,18 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
namespace Microsoft.SqlTools.DataProtocol.Contracts.ServerCapabilities
{
/// <summary>
/// Options the server supports for saving
/// </summary>
public class SaveOptions
{
/// <summary>
/// Whether the client is supposed to include the content on save
/// </summary>
public bool? IncludeText { get; set; }
}
}

View File

@@ -0,0 +1,122 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
namespace Microsoft.SqlTools.DataProtocol.Contracts.ServerCapabilities
{
public class ServerCapabilities
{
/// <summary>
/// Defines how text documents are synced. Is either a detailed structure defining each
/// notification or for backwards compatibility the TextDocumentSyncKind number.
/// </summary>
/// TODO: Use the Union type
public TextDocumentSyncKind TextDocumentSync { get; set; }
/// <summary>
/// Whether the server provides code actions. Can be <c>null</c>
/// </summary>
public bool? CodeActionProvider { get; set; }
/// <summary>
/// Options that the server provides for code lens. Can be <c>null</c> to indicate code
/// lens is not supported.
/// </summary>
public CodeLensOptions CodeLensProvider { get; set; }
/// <summary>
/// Options that the server supports for completion. Can be <c>null</c> to indicate
/// completion is not supported.
/// </summary>
public CompletionOptions CompletionProvider { get; set; }
/// <summary>
/// Whether the server provides goto definition support. Can be <c>null</c>
/// </summary>
public bool? DefinitionProvider { get; set; }
/// <summary>
/// Whether the server provides document formatting. Can be <c>null</c>
/// </summary>
public bool? DocumentFormattingProvider { get; set; }
/// <summary>
/// Whether the server provides document highlight support. Can be <c>null</c>
/// </summary>
public bool? DocumentHighlightProvider { get; set; }
/// <summary>
/// Options the server supports for document linking. Can be <c>null</c> to indicate the
/// feature is not supported
/// </summary>
public DocumentLinkOptions DocumentLinkProvider { get; set; }
/// <summary>
/// Options that the server supports for document formatting on type. Can be <c>null</c> to
/// indicate the feature is not supported
/// </summary>
public DocumentOnTypeFormattingOptions DocumentOnTypeFormattingProvider { get; set; }
/// <summary>
/// Whether the server provides document symbol support. Can be <c>null</c>
/// </summary>
public bool? DocumentSymbolProvider { get; set; }
/// <summary>
/// Options the server supports for executing commands. Can be <c>null</c> to indicate the
/// feature is not supported.
/// </summary>
public ExecuteCommandOptions ExecuteCommandProvider { get; set; }
/// <summary>
/// Any experimental features the server supports
/// </summary>
/// TODO: Should this be a parameterized type?
public object Experimental { get; set; }
/// <summary>
/// Whether or not the server supports goto implementation requests. Can be <c>null</c>
/// </summary>
/// TODO: Union type
public bool? ImplementationProvider { get; set; }
/// <summary>
/// Whether the server provides hover support. Can be <c>null</c>
/// </summary>
public bool? HoverProvider { get; set; }
/// <summary>
/// Whether the server provides find references support. Can be <c>null</c>
/// </summary>
public bool? ReferencesProvider { get; set; }
/// <summary>
/// Whether the server provides support for renaming. Can be <c>null</c>
/// </summary>
public bool? RenameProvider { get; set; }
/// <summary>
/// Options that the server supports for signature help. Can be <c>null</c> to indicate
/// completion is not supported
/// </summary>
public SignatureHelpOptions SignatureHelpProvider { get; set; }
/// <summary>
/// Whether the server provides goto type definition support. Can be <c>null</c>
/// </summary>
/// TODO: Union type
public bool? TypeDefinitionProvider { get; set; }
/// <summary>
/// Options specific to workspaces the server supoorts. Can be <c>null</c> to indicate the
/// server does not support workspace requests.
/// </summary>
public WorkspaceCapabilities Workspace { get; set; }
/// <summary>
/// Whether the server provides workpace symbol support. Can be <c>null</c>
/// </summary>
public bool? WorkspaceSymbolProvider { get; set; }
}
}

View File

@@ -0,0 +1,18 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
namespace Microsoft.SqlTools.DataProtocol.Contracts.ServerCapabilities
{
/// <summary>
/// Defines options for signature help that the server supports
/// </summary>
public class SignatureHelpOptions
{
/// <summary>
/// Characters that trigger signature help automatically
/// </summary>
public string[] TriggerCharacters { get; set; }
}
}

View File

@@ -0,0 +1,76 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using Microsoft.SqlTools.DataProtocol.Contracts.Utilities;
namespace Microsoft.SqlTools.DataProtocol.Contracts.ServerCapabilities
{
public enum TextDocumentSyncKind
{
None = 0,
Full = 1,
Incremental = 2
}
/// <summary>
/// Defines options for sae notifications
/// </summary>
public class TextDocumentSaveOptions
{
/// <summary>
/// Whether the client should send the content of the file being saved with the save notification
/// </summary>
public bool? IncludeText { get; set; }
}
public class TextDocumentSync : Union<TextDocumentSyncOptions, TextDocumentSyncKind?>
{
public static TextDocumentSync FromTextDocumentSyncKind(TextDocumentSyncKind value)
{
return new TextDocumentSync
{
value1 = null,
value2 = value
};
}
public static TextDocumentSync FromTextDocumentSyncOptions(TextDocumentSyncOptions value)
{
return new TextDocumentSync
{
value1 = value,
value2 = null
};
}
}
public class TextDocumentSyncOptions
{
/// <summary>
/// What kind of change notifications are sent to the server
/// </summary>
public TextDocumentSyncKind? Change { get; set; }
/// <summary>
/// Whether open and close notifications are sent to the server
/// </summary>
public bool? OpenClose { get; set; }
/// <summary>
/// Options for save notifications
/// </summary>
public TextDocumentSaveOptions SaveOptions { get; set; }
/// <summary>
/// Whether notifications indicating the client will save are sent to the server
/// </summary>
public bool? WillSave { get; set; }
/// <summary>
/// Whether requests should be sent to the server when the client is about to save
/// </summary>
public bool? WillSaveWaitUntil { get; set; }
}
}

View File

@@ -0,0 +1,118 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace Microsoft.SqlTools.DataProtocol.Contracts.ServerCapabilities
{
public class WorkspaceCapabilities
{
/// <summary>
/// Options specific to workspace folders the server supports
/// </summary>
public WorkspaceFolderCapabilities WorkspaceFolders { get; set; }
}
public class WorkspaceFolderCapabilities
{
/// <summary>
/// Whether or not the server supports multiple workspace folders
/// </summary>
public bool? Supported { get; set; }
/// <summary>
/// Whether the server wants to receive workspace folder change notifications
/// </summary>
/// <remarks>
/// If a string is provided, the string is treated as an ID under which the notification is
/// registered on the client side. The ID can be used to unregister for these events using
/// the client/unregisterCapability request
/// </remarks>
public WorkspaceChangeNotification ChangeNotifications { get; set; }
}
[JsonConverter(typeof(WorkspaceChangeNotificationJsonConverter))]
public class WorkspaceChangeNotification
{
public bool BooleanValue { get; }
public string UnregisterId { get; }
private WorkspaceChangeNotification(bool booleanValue, string unregisterId)
{
BooleanValue = booleanValue;
UnregisterId = unregisterId;
}
/// <summary>
/// Indicates that this server can accept notifications that the workspace has changed
/// </summary>
public static WorkspaceChangeNotification True => new WorkspaceChangeNotification(true, null);
/// <summary>
/// Indicates that this server cannot accept notifications that the workspace has changed
/// </summary>
public static WorkspaceChangeNotification False => new WorkspaceChangeNotification(false, null);
/// <summary>
/// Indicates that this server can accept notifications that the workspace has changed but
/// reserves the right to unsubscribe from receiving workspace change notifications
/// </summary>
/// <param name="unregisterId">ID to use when unregistering for workspace change notifications</param>
public static WorkspaceChangeNotification WithId(string unregisterId)
{
return unregisterId == null ? null : new WorkspaceChangeNotification(true, unregisterId);
}
}
internal class WorkspaceChangeNotificationJsonConverter : JsonConverter
{
public override bool CanRead => true;
public override bool CanWrite => true;
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
{
if (value == null)
{
writer.WriteNull();
return;
}
WorkspaceChangeNotification castValue = (WorkspaceChangeNotification) value;
if (castValue.UnregisterId != null)
{
writer.WriteValue(castValue.UnregisterId);
}
else
{
writer.WriteValue(castValue.BooleanValue);
}
}
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
JToken jToken = JToken.Load(reader);
if (jToken.Type == JTokenType.Null)
{
return null;
}
if (jToken.Type == JTokenType.Boolean)
{
return jToken.Value<bool>()
? WorkspaceChangeNotification.True
: WorkspaceChangeNotification.False;
}
return WorkspaceChangeNotification.WithId(jToken.Value<string>());
}
public override bool CanConvert(Type objectType)
{
return objectType == typeof(WorkspaceChangeNotificationJsonConverter);
}
}
}