Initial commit of SqlTools Service API

This commit is contained in:
Karl Burtram
2016-07-15 11:02:03 -07:00
parent 874ade9001
commit 790825cfab
112 changed files with 9782 additions and 1 deletions

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.
//
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Microsoft.PowerShell.EditorServices.Protocol.LanguageServer
{
/// <summary>
/// Defines a class that describes the capabilities of a language
/// client. At this time no specific capabilities are listed for
/// clients.
/// </summary>
public class ClientCapabilities
{
}
}

View File

@@ -0,0 +1,86 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System.Diagnostics;
using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol;
namespace Microsoft.PowerShell.EditorServices.Protocol.LanguageServer
{
public class CompletionRequest
{
public static readonly
RequestType<TextDocumentPosition, CompletionItem[]> Type =
RequestType<TextDocumentPosition, CompletionItem[]>.Create("textDocument/completion");
}
public class CompletionResolveRequest
{
public static readonly
RequestType<CompletionItem, CompletionItem> Type =
RequestType<CompletionItem, CompletionItem>.Create("completionItem/resolve");
}
public enum CompletionItemKind
{
Text = 1,
Method = 2,
Function = 3,
Constructor = 4,
Field = 5,
Variable = 6,
Class = 7,
Interface = 8,
Module = 9,
Property = 10,
Unit = 11,
Value = 12,
Enum = 13,
Keyword = 14,
Snippet = 15,
Color = 16,
File = 17,
Reference = 18
}
[DebuggerDisplay("NewText = {NewText}, Range = {Range.Start.Line}:{Range.Start.Character} - {Range.End.Line}:{Range.End.Character}")]
public class TextEdit
{
public Range Range { get; set; }
public string NewText { get; set; }
}
[DebuggerDisplay("Kind = {Kind.ToString()}, Label = {Label}, Detail = {Detail}")]
public class CompletionItem
{
public string Label { get; set; }
public CompletionItemKind? Kind { get; set; }
public string Detail { get; set; }
/// <summary>
/// Gets or sets the documentation string for the completion item.
/// </summary>
public string Documentation { get; set; }
public string SortText { get; set; }
public string FilterText { get; set; }
public string InsertText { get; set; }
public TextEdit TextEdit { get; set; }
/// <summary>
/// Gets or sets a custom data field that allows the server to mark
/// each completion item with an identifier that will help correlate
/// the item to the previous completion request during a completion
/// resolve request.
/// </summary>
public object Data { get; set; }
}
}

View File

@@ -0,0 +1,21 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol;
namespace Microsoft.PowerShell.EditorServices.Protocol.LanguageServer
{
public class DidChangeConfigurationNotification<TConfig>
{
public static readonly
EventType<DidChangeConfigurationParams<TConfig>> Type =
EventType<DidChangeConfigurationParams<TConfig>>.Create("workspace/didChangeConfiguration");
}
public class DidChangeConfigurationParams<TConfig>
{
public TConfig Settings { get; set; }
}
}

View File

@@ -0,0 +1,17 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol;
namespace Microsoft.PowerShell.EditorServices.Protocol.LanguageServer
{
public class DefinitionRequest
{
public static readonly
RequestType<TextDocumentPosition, Location[]> Type =
RequestType<TextDocumentPosition, Location[]>.Create("textDocument/definition");
}
}

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.PowerShell.EditorServices.Protocol.MessageProtocol;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Microsoft.PowerShell.EditorServices.Protocol.LanguageServer
{
public class PublishDiagnosticsNotification
{
public static readonly
EventType<PublishDiagnosticsNotification> Type =
EventType<PublishDiagnosticsNotification>.Create("textDocument/publishDiagnostics");
/// <summary>
/// Gets or sets the URI for which diagnostic information is reported.
/// </summary>
public string Uri { get; set; }
/// <summary>
/// Gets or sets the array of diagnostic information items.
/// </summary>
public Diagnostic[] Diagnostics { get; set; }
}
public enum DiagnosticSeverity
{
/// <summary>
/// Indicates that the diagnostic represents an error.
/// </summary>
Error = 1,
/// <summary>
/// Indicates that the diagnostic represents a warning.
/// </summary>
Warning = 2,
/// <summary>
/// Indicates that the diagnostic represents an informational message.
/// </summary>
Information = 3,
/// <summary>
/// Indicates that the diagnostic represents a hint.
/// </summary>
Hint = 4
}
public class Diagnostic
{
public Range Range { get; set; }
/// <summary>
/// Gets or sets the severity of the diagnostic. If omitted, the
/// client should interpret the severity.
/// </summary>
public DiagnosticSeverity? Severity { get; set; }
/// <summary>
/// Gets or sets the diagnostic's code (optional).
/// </summary>
public string Code { get; set; }
/// <summary>
/// Gets or sets the diagnostic message.
/// </summary>
public string Message { get; set; }
}
}

View File

@@ -0,0 +1,31 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol;
namespace Microsoft.PowerShell.EditorServices.Protocol.LanguageServer
{
public enum DocumentHighlightKind
{
Text = 1,
Read = 2,
Write = 3
}
public class DocumentHighlight
{
public Range Range { get; set; }
public DocumentHighlightKind Kind { get; set; }
}
public class DocumentHighlightRequest
{
public static readonly
RequestType<TextDocumentPosition, DocumentHighlight[]> Type =
RequestType<TextDocumentPosition, DocumentHighlight[]>.Create("textDocument/documentHighlight");
}
}

View File

@@ -0,0 +1,111 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol;
namespace Microsoft.PowerShell.EditorServices.Protocol.LanguageServer
{
public class ExtensionCommandAddedNotification
{
public static readonly
EventType<ExtensionCommandAddedNotification> Type =
EventType<ExtensionCommandAddedNotification>.Create("powerShell/extensionCommandAdded");
public string Name { get; set; }
public string DisplayName { get; set; }
}
public class ExtensionCommandUpdatedNotification
{
public static readonly
EventType<ExtensionCommandUpdatedNotification> Type =
EventType<ExtensionCommandUpdatedNotification>.Create("powerShell/extensionCommandUpdated");
public string Name { get; set; }
}
public class ExtensionCommandRemovedNotification
{
public static readonly
EventType<ExtensionCommandRemovedNotification> Type =
EventType<ExtensionCommandRemovedNotification>.Create("powerShell/extensionCommandRemoved");
public string Name { get; set; }
}
public class ClientEditorContext
{
public string CurrentFilePath { get; set; }
public Position CursorPosition { get; set; }
public Range SelectionRange { get; set; }
}
public class InvokeExtensionCommandRequest
{
public static readonly
RequestType<InvokeExtensionCommandRequest, string> Type =
RequestType<InvokeExtensionCommandRequest, string>.Create("powerShell/invokeExtensionCommand");
public string Name { get; set; }
public ClientEditorContext Context { get; set; }
}
public class GetEditorContextRequest
{
public static readonly
RequestType<GetEditorContextRequest, ClientEditorContext> Type =
RequestType<GetEditorContextRequest, ClientEditorContext>.Create("editor/getEditorContext");
}
public enum EditorCommandResponse
{
Unsupported,
OK
}
public class InsertTextRequest
{
public static readonly
RequestType<InsertTextRequest, EditorCommandResponse> Type =
RequestType<InsertTextRequest, EditorCommandResponse>.Create("editor/insertText");
public string FilePath { get; set; }
public string InsertText { get; set; }
public Range InsertRange { get; set; }
}
public class SetSelectionRequest
{
public static readonly
RequestType<SetSelectionRequest, EditorCommandResponse> Type =
RequestType<SetSelectionRequest, EditorCommandResponse>.Create("editor/setSelection");
public Range SelectionRange { get; set; }
}
public class SetCursorPositionRequest
{
public static readonly
RequestType<SetCursorPositionRequest, EditorCommandResponse> Type =
RequestType<SetCursorPositionRequest, EditorCommandResponse>.Create("editor/setCursorPosition");
public Position CursorPosition { get; set; }
}
public class OpenFileRequest
{
public static readonly
RequestType<string, EditorCommandResponse> Type =
RequestType<string, EditorCommandResponse>.Create("editor/openFile");
}
}

View File

@@ -0,0 +1,16 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol;
namespace Microsoft.PowerShell.EditorServices.Protocol.LanguageServer
{
public class ExpandAliasRequest
{
public static readonly
RequestType<string, string> Type =
RequestType<string, string>.Create("powerShell/expandAlias");
}
}

View File

@@ -0,0 +1,24 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol;
using System.Collections.Generic;
namespace Microsoft.PowerShell.EditorServices.Protocol.LanguageServer
{
public class FindModuleRequest
{
public static readonly
RequestType<List<PSModuleMessage>, object> Type =
RequestType<List<PSModuleMessage>, object>.Create("powerShell/findModule");
}
public class PSModuleMessage
{
public string Name { get; set; }
public string Description { get; set; }
}
}

View File

@@ -0,0 +1,37 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Microsoft.PowerShell.EditorServices.Protocol.LanguageServer
{
public class MarkedString
{
public string Language { get; set; }
public string Value { get; set; }
}
public class Hover
{
public MarkedString[] Contents { get; set; }
public Range? Range { get; set; }
}
public class HoverRequest
{
public static readonly
RequestType<TextDocumentPosition, Hover> Type =
RequestType<TextDocumentPosition, Hover>.Create("textDocument/hover");
}
}

View File

@@ -0,0 +1,46 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol;
namespace Microsoft.PowerShell.EditorServices.Protocol.LanguageServer
{
public class InitializeRequest
{
public static readonly
RequestType<InitializeRequest, InitializeResult> Type =
RequestType<InitializeRequest, InitializeResult>.Create("initialize");
/// <summary>
/// Gets or sets the root path of the editor's open workspace.
/// If null it is assumed that a file was opened without having
/// a workspace open.
/// </summary>
public string RootPath { get; set; }
/// <summary>
/// Gets or sets the capabilities provided by the client (editor).
/// </summary>
public ClientCapabilities Capabilities { get; set; }
}
public class InitializeResult
{
/// <summary>
/// Gets or sets the capabilities provided by the language server.
/// </summary>
public ServerCapabilities Capabilities { get; set; }
}
public class InitializeError
{
/// <summary>
/// Gets or sets a boolean indicating whether the client should retry
/// sending the Initialize request after showing the error to the user.
/// </summary>
public bool Retry { get; set;}
}
}

View File

@@ -0,0 +1,16 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol;
namespace Microsoft.PowerShell.EditorServices.Protocol.LanguageServer
{
class InstallModuleRequest
{
public static readonly
RequestType<string, object> Type =
RequestType<string, object>.Create("powerShell/installModule");
}
}

View File

@@ -0,0 +1,27 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol;
namespace Microsoft.PowerShell.EditorServices.Protocol.LanguageServer
{
public class ReferencesRequest
{
public static readonly
RequestType<ReferencesParams, Location[]> Type =
RequestType<ReferencesParams, Location[]>.Create("textDocument/references");
}
public class ReferencesParams : TextDocumentPosition
{
public ReferencesContext Context { get; set; }
}
public class ReferencesContext
{
public bool IncludeDeclaration { get; set; }
}
}

View File

@@ -0,0 +1,63 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
namespace Microsoft.PowerShell.EditorServices.Protocol.LanguageServer
{
public class ServerCapabilities
{
public TextDocumentSyncKind? TextDocumentSync { get; set; }
public bool? HoverProvider { get; set; }
public CompletionOptions CompletionProvider { get; set; }
public SignatureHelpOptions SignatureHelpProvider { get; set; }
public bool? DefinitionProvider { get; set; }
public bool? ReferencesProvider { get; set; }
public bool? DocumentHighlightProvider { get; set; }
public bool? DocumentSymbolProvider { get; set; }
public bool? WorkspaceSymbolProvider { get; set; }
}
/// <summary>
/// Defines the document synchronization strategies that a server may support.
/// </summary>
public enum TextDocumentSyncKind
{
/// <summary>
/// Indicates that documents should not be synced at all.
/// </summary>
None = 0,
/// <summary>
/// Indicates that document changes are always sent with the full content.
/// </summary>
Full,
/// <summary>
/// Indicates that document changes are sent as incremental changes after
/// the initial document content has been sent.
/// </summary>
Incremental
}
public class CompletionOptions
{
public bool? ResolveProvider { get; set; }
public string[] TriggerCharacters { get; set; }
}
public class SignatureHelpOptions
{
public string[] TriggerCharacters { get; set; }
}
}

View File

@@ -0,0 +1,16 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol;
namespace Microsoft.PowerShell.EditorServices.Protocol.LanguageServer
{
public class ShowOnlineHelpRequest
{
public static readonly
RequestType<string, object> Type =
RequestType<string, object>.Create("powerShell/showOnlineHelp");
}
}

View File

@@ -0,0 +1,32 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol;
namespace Microsoft.PowerShell.EditorServices.Protocol.LanguageServer
{
/// <summary>
/// Defines a message that is sent from the client to request
/// that the server shut down.
/// </summary>
public class ShutdownRequest
{
public static readonly
RequestType<object, object> Type =
RequestType<object, object>.Create("shutdown");
}
/// <summary>
/// Defines an event that is sent from the client to notify that
/// the client is exiting and the server should as well.
/// </summary>
public class ExitNotification
{
public static readonly
EventType<object> Type =
EventType<object>.Create("exit");
}
}

View File

@@ -0,0 +1,42 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol;
namespace Microsoft.PowerShell.EditorServices.Protocol.LanguageServer
{
public class SignatureHelpRequest
{
public static readonly
RequestType<TextDocumentPosition, SignatureHelp> Type =
RequestType<TextDocumentPosition, SignatureHelp>.Create("textDocument/signatureHelp");
}
public class ParameterInformation
{
public string Label { get; set; }
public string Documentation { get; set; }
}
public class SignatureInformation
{
public string Label { get; set; }
public string Documentation { get; set; }
public ParameterInformation[] Parameters { get; set; }
}
public class SignatureHelp
{
public SignatureInformation[] Signatures { get; set; }
public int? ActiveSignature { get; set; }
public int? ActiveParameter { get; set; }
}
}

View File

@@ -0,0 +1,149 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System.Diagnostics;
using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol;
namespace Microsoft.PowerShell.EditorServices.Protocol.LanguageServer
{
/// <summary>
/// Defines a base parameter class for identifying a text document.
/// </summary>
[DebuggerDisplay("TextDocumentIdentifier = {Uri}")]
public class TextDocumentIdentifier
{
/// <summary>
/// Gets or sets the URI which identifies the path of the
/// text document.
/// </summary>
public string Uri { get; set; }
}
/// <summary>
/// Defines a position in a text document.
/// </summary>
[DebuggerDisplay("TextDocumentPosition = {Position.Line}:{Position.Character}")]
public class TextDocumentPosition : TextDocumentIdentifier
{
/// <summary>
/// Gets or sets the position in the document.
/// </summary>
public Position Position { get; set; }
}
public class DidOpenTextDocumentNotification : TextDocumentIdentifier
{
public static readonly
EventType<DidOpenTextDocumentNotification> Type =
EventType<DidOpenTextDocumentNotification>.Create("textDocument/didOpen");
/// <summary>
/// Gets or sets the full content of the opened document.
/// </summary>
public string Text { get; set; }
}
public class DidCloseTextDocumentNotification
{
public static readonly
EventType<TextDocumentIdentifier> Type =
EventType<TextDocumentIdentifier>.Create("textDocument/didClose");
}
public class DidChangeTextDocumentNotification
{
public static readonly
EventType<DidChangeTextDocumentParams> Type =
EventType<DidChangeTextDocumentParams>.Create("textDocument/didChange");
}
public class DidChangeTextDocumentParams : TextDocumentIdentifier
{
/// <summary>
/// Gets or sets the list of changes to the document content.
/// </summary>
public TextDocumentChangeEvent[] ContentChanges { get; set; }
}
public class TextDocumentChangeEvent
{
/// <summary>
/// Gets or sets the Range where the document was changed. Will
/// be null if the server's TextDocumentSyncKind is Full.
/// </summary>
public Range? Range { get; set; }
/// <summary>
/// Gets or sets the length of the Range being replaced in the
/// document. Will be null if the server's TextDocumentSyncKind is
/// Full.
/// </summary>
public int? RangeLength { get; set; }
/// <summary>
/// Gets or sets the new text of the document.
/// </summary>
public string Text { get; set; }
}
[DebuggerDisplay("Position = {Line}:{Character}")]
public class Position
{
/// <summary>
/// Gets or sets the zero-based line number.
/// </summary>
public int Line { get; set; }
/// <summary>
/// Gets or sets the zero-based column number.
/// </summary>
public int Character { get; set; }
}
[DebuggerDisplay("Start = {Start.Line}:{Start.Character}, End = {End.Line}:{End.Character}")]
public struct Range
{
/// <summary>
/// Gets or sets the starting position of the range.
/// </summary>
public Position Start { get; set; }
/// <summary>
/// Gets or sets the ending position of the range.
/// </summary>
public Position End { get; set; }
}
[DebuggerDisplay("Range = {Range.Start.Line}:{Range.Start.Character} - {Range.End.Line}:{Range.End.Character}, Uri = {Uri}")]
public class Location
{
/// <summary>
/// Gets or sets the URI indicating the file in which the location refers.
/// </summary>
public string Uri { get; set; }
/// <summary>
/// Gets or sets the Range indicating the range in which location refers.
/// </summary>
public Range Range { get; set; }
}
public enum FileChangeType
{
Created = 1,
Changed,
Deleted
}
public class FileEvent
{
public string Uri { get; set; }
public FileChangeType Type { get; set; }
}
}

View File

@@ -0,0 +1,62 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol;
namespace Microsoft.PowerShell.EditorServices.Protocol.LanguageServer
{
public enum SymbolKind
{
File = 1,
Module = 2,
Namespace = 3,
Package = 4,
Class = 5,
Method = 6,
Property = 7,
Field = 8,
Constructor = 9,
Enum = 10,
Interface = 11,
Function = 12,
Variable = 13,
Constant = 14,
String = 15,
Number = 16,
Boolean = 17,
Array = 18,
}
public class SymbolInformation
{
public string Name { get; set; }
public SymbolKind Kind { get; set; }
public Location Location { get; set; }
public string ContainerName { get; set;}
}
public class DocumentSymbolRequest
{
public static readonly
RequestType<TextDocumentIdentifier, SymbolInformation[]> Type =
RequestType<TextDocumentIdentifier, SymbolInformation[]>.Create("textDocument/documentSymbol");
}
public class WorkspaceSymbolRequest
{
public static readonly
RequestType<WorkspaceSymbolParams, SymbolInformation[]> Type =
RequestType<WorkspaceSymbolParams, SymbolInformation[]>.Create("workspace/symbol");
}
public class WorkspaceSymbolParams
{
public string Query { get; set;}
}
}