//
// 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.SqlTools.EditorServices.Protocol.MessageProtocol;
namespace Microsoft.SqlTools.EditorServices.Protocol.LanguageServer
{
///
/// Defines a base parameter class for identifying a text document.
///
[DebuggerDisplay("TextDocumentIdentifier = {Uri}")]
public class TextDocumentIdentifier
{
///
/// Gets or sets the URI which identifies the path of the
/// text document.
///
public string Uri { get; set; }
}
///
/// Defines a position in a text document.
///
[DebuggerDisplay("TextDocumentPosition = {Position.Line}:{Position.Character}")]
public class TextDocumentPosition : TextDocumentIdentifier
{
///
/// Gets or sets the position in the document.
///
public Position Position { get; set; }
}
public class DidOpenTextDocumentNotification : TextDocumentIdentifier
{
public static readonly
EventType Type =
EventType.Create("textDocument/didOpen");
///
/// Gets or sets the full content of the opened document.
///
public string Text { get; set; }
}
public class DidCloseTextDocumentNotification
{
public static readonly
EventType Type =
EventType.Create("textDocument/didClose");
}
public class DidChangeTextDocumentNotification
{
public static readonly
EventType Type =
EventType.Create("textDocument/didChange");
}
public class DidChangeTextDocumentParams : TextDocumentIdentifier
{
public TextDocumentUriChangeEvent TextDocument { get; set; }
///
/// Gets or sets the list of changes to the document content.
///
public TextDocumentChangeEvent[] ContentChanges { get; set; }
}
public class TextDocumentUriChangeEvent
{
///
/// Gets or sets the Uri of the changed text document
///
public string Uri { get; set; }
///
/// Gets or sets the Version of the changed text document
///
public int Version { get; set; }
}
public class TextDocumentChangeEvent
{
///
/// Gets or sets the Range where the document was changed. Will
/// be null if the server's TextDocumentSyncKind is Full.
///
public Range? Range { get; set; }
///
/// Gets or sets the length of the Range being replaced in the
/// document. Will be null if the server's TextDocumentSyncKind is
/// Full.
///
public int? RangeLength { get; set; }
///
/// Gets or sets the new text of the document.
///
public string Text { get; set; }
}
[DebuggerDisplay("Position = {Line}:{Character}")]
public class Position
{
///
/// Gets or sets the zero-based line number.
///
public int Line { get; set; }
///
/// Gets or sets the zero-based column number.
///
public int Character { get; set; }
}
[DebuggerDisplay("Start = {Start.Line}:{Start.Character}, End = {End.Line}:{End.Character}")]
public struct Range
{
///
/// Gets or sets the starting position of the range.
///
public Position Start { get; set; }
///
/// Gets or sets the ending position of the range.
///
public Position End { get; set; }
}
[DebuggerDisplay("Range = {Range.Start.Line}:{Range.Start.Character} - {Range.End.Line}:{Range.End.Character}, Uri = {Uri}")]
public class Location
{
///
/// Gets or sets the URI indicating the file in which the location refers.
///
public string Uri { get; set; }
///
/// Gets or sets the Range indicating the range in which location refers.
///
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; }
}
}