2017-03-05 02:16:23 +00:00
|
|
|
#pragma once
|
|
|
|
|
2017-05-21 19:51:15 +00:00
|
|
|
#include "config.h"
|
2017-03-25 23:58:11 +00:00
|
|
|
#include "ipc.h"
|
2017-03-25 20:32:44 +00:00
|
|
|
#include "serializer.h"
|
|
|
|
#include "utils.h"
|
|
|
|
|
|
|
|
#include <optional.h>
|
|
|
|
#include <rapidjson/writer.h>
|
|
|
|
|
2017-03-25 21:57:06 +00:00
|
|
|
#include <algorithm>
|
2017-03-05 02:16:23 +00:00
|
|
|
#include <iostream>
|
2017-03-25 19:18:25 +00:00
|
|
|
#include <sstream>
|
2017-03-05 02:16:23 +00:00
|
|
|
#include <unordered_map>
|
|
|
|
#include <unordered_set>
|
|
|
|
|
|
|
|
using std::experimental::nullopt;
|
2017-09-22 01:14:57 +00:00
|
|
|
using std::experimental::optional;
|
2017-03-05 02:16:23 +00:00
|
|
|
|
2017-03-10 07:06:01 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
///////////////////////////// OUTGOING MESSAGES /////////////////////////////
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
2017-03-12 00:36:00 +00:00
|
|
|
|
2017-03-25 22:13:19 +00:00
|
|
|
struct lsRequestId {
|
2017-03-10 07:06:01 +00:00
|
|
|
optional<int> id0;
|
|
|
|
optional<std::string> id1;
|
|
|
|
};
|
2017-03-25 22:13:19 +00:00
|
|
|
void Reflect(Writer& visitor, lsRequestId& value);
|
|
|
|
void Reflect(Reader& visitor, lsRequestId& id);
|
2017-03-05 02:16:23 +00:00
|
|
|
|
2017-03-10 07:06:01 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
///////////////////////////// INCOMING MESSAGES /////////////////////////////
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
2017-03-05 02:16:23 +00:00
|
|
|
|
2017-03-10 07:06:01 +00:00
|
|
|
struct MessageRegistry {
|
|
|
|
static MessageRegistry* instance_;
|
|
|
|
static MessageRegistry* instance();
|
2017-03-05 02:16:23 +00:00
|
|
|
|
2017-09-22 01:14:57 +00:00
|
|
|
using Allocator =
|
|
|
|
std::function<std::unique_ptr<BaseIpcMessage>(Reader& visitor)>;
|
2017-03-10 07:06:01 +00:00
|
|
|
std::unordered_map<std::string, Allocator> allocators;
|
2017-03-05 02:16:23 +00:00
|
|
|
|
2017-09-22 01:14:57 +00:00
|
|
|
template <typename T>
|
2017-03-10 07:06:01 +00:00
|
|
|
void Register() {
|
2017-03-25 22:13:19 +00:00
|
|
|
std::string method_name = IpcIdToString(T::kIpcId);
|
2017-03-25 19:18:25 +00:00
|
|
|
allocators[method_name] = [](Reader& visitor) {
|
|
|
|
auto result = MakeUnique<T>();
|
|
|
|
Reflect(visitor, *result);
|
|
|
|
return result;
|
2017-03-10 07:06:01 +00:00
|
|
|
};
|
2017-03-05 02:16:23 +00:00
|
|
|
}
|
|
|
|
|
2017-11-30 04:22:10 +00:00
|
|
|
std::unique_ptr<BaseIpcMessage> ReadMessageFromStdin(
|
|
|
|
bool log_stdin_to_stderr);
|
2017-03-25 22:13:19 +00:00
|
|
|
std::unique_ptr<BaseIpcMessage> Parse(Reader& visitor);
|
2017-03-10 07:06:01 +00:00
|
|
|
};
|
2017-03-05 02:16:23 +00:00
|
|
|
|
2017-04-16 20:43:30 +00:00
|
|
|
struct lsBaseOutMessage {
|
2017-06-09 06:20:29 +00:00
|
|
|
virtual ~lsBaseOutMessage();
|
2017-04-16 20:43:30 +00:00
|
|
|
virtual void Write(std::ostream& out) = 0;
|
|
|
|
};
|
2017-03-05 02:16:23 +00:00
|
|
|
|
2017-09-22 01:14:57 +00:00
|
|
|
template <typename TDerived>
|
2017-04-16 20:43:30 +00:00
|
|
|
struct lsOutMessage : lsBaseOutMessage {
|
2017-03-25 21:45:49 +00:00
|
|
|
// All derived types need to reflect on the |jsonrpc| member.
|
|
|
|
std::string jsonrpc = "2.0";
|
2017-03-24 07:59:47 +00:00
|
|
|
|
|
|
|
// Send the message to the language client by writing it to stdout.
|
2017-04-16 20:43:30 +00:00
|
|
|
void Write(std::ostream& out) override {
|
2017-03-24 07:59:47 +00:00
|
|
|
rapidjson::StringBuffer output;
|
|
|
|
Writer writer(output);
|
2017-03-25 21:45:49 +00:00
|
|
|
auto that = static_cast<TDerived*>(this);
|
|
|
|
Reflect(writer, *that);
|
2017-03-24 07:59:47 +00:00
|
|
|
|
2017-03-25 19:18:25 +00:00
|
|
|
out << "Content-Length: " << output.GetSize();
|
2017-09-22 01:14:57 +00:00
|
|
|
out << (char)13 << char(10) << char(13) << char(10); // CRLFCRLF
|
2017-03-25 19:18:25 +00:00
|
|
|
out << output.GetString();
|
|
|
|
out.flush();
|
2017-03-24 07:59:47 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct lsResponseError {
|
|
|
|
struct Data {
|
|
|
|
virtual void Write(Writer& writer) = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
enum class lsErrorCodes : int {
|
|
|
|
ParseError = -32700,
|
|
|
|
InvalidRequest = -32600,
|
|
|
|
MethodNotFound = -32601,
|
|
|
|
InvalidParams = -32602,
|
|
|
|
InternalError = -32603,
|
|
|
|
serverErrorStart = -32099,
|
|
|
|
serverErrorEnd = -32000,
|
|
|
|
ServerNotInitialized = -32002,
|
|
|
|
UnknownErrorCode = -32001
|
|
|
|
};
|
|
|
|
|
|
|
|
lsErrorCodes code;
|
|
|
|
// Short description.
|
|
|
|
std::string message;
|
|
|
|
std::unique_ptr<Data> data;
|
|
|
|
|
2017-03-25 22:13:19 +00:00
|
|
|
void Write(Writer& visitor);
|
2017-03-24 07:59:47 +00:00
|
|
|
};
|
|
|
|
|
2017-03-10 07:06:01 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
////////////////////////////// PRIMITIVE TYPES //////////////////////////////
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
2017-03-05 02:16:23 +00:00
|
|
|
|
2017-03-10 07:06:01 +00:00
|
|
|
struct lsDocumentUri {
|
2017-03-25 22:13:19 +00:00
|
|
|
static lsDocumentUri FromPath(const std::string& path);
|
2017-03-11 08:07:32 +00:00
|
|
|
|
2017-03-25 22:13:19 +00:00
|
|
|
lsDocumentUri();
|
|
|
|
bool operator==(const lsDocumentUri& other) const;
|
2017-03-25 23:58:11 +00:00
|
|
|
|
2017-03-25 22:13:19 +00:00
|
|
|
void SetPath(const std::string& path);
|
2017-03-26 21:40:34 +00:00
|
|
|
std::string GetPath() const;
|
2017-03-05 02:16:23 +00:00
|
|
|
|
2017-03-25 22:13:19 +00:00
|
|
|
std::string raw_uri;
|
2017-03-10 07:06:01 +00:00
|
|
|
};
|
2017-03-16 07:36:49 +00:00
|
|
|
MAKE_HASHABLE(lsDocumentUri, t.raw_uri);
|
2017-03-05 02:16:23 +00:00
|
|
|
|
2017-09-22 01:14:57 +00:00
|
|
|
template <typename TVisitor>
|
2017-03-10 07:06:01 +00:00
|
|
|
void Reflect(TVisitor& visitor, lsDocumentUri& value) {
|
|
|
|
Reflect(visitor, value.raw_uri);
|
|
|
|
}
|
2017-03-05 02:16:23 +00:00
|
|
|
|
2017-03-10 07:06:01 +00:00
|
|
|
struct lsPosition {
|
2017-03-25 22:13:19 +00:00
|
|
|
lsPosition();
|
|
|
|
lsPosition(int line, int character);
|
|
|
|
|
|
|
|
bool operator==(const lsPosition& other) const;
|
|
|
|
|
2017-05-15 07:28:53 +00:00
|
|
|
std::string ToString() const;
|
|
|
|
|
2017-03-10 07:06:01 +00:00
|
|
|
// Note: these are 0-based.
|
|
|
|
int line = 0;
|
|
|
|
int character = 0;
|
2017-11-22 17:52:33 +00:00
|
|
|
static const lsPosition kZeroPosition;
|
2017-03-10 07:06:01 +00:00
|
|
|
};
|
2017-03-16 07:36:49 +00:00
|
|
|
MAKE_HASHABLE(lsPosition, t.line, t.character);
|
2017-03-25 23:58:11 +00:00
|
|
|
MAKE_REFLECT_STRUCT(lsPosition, line, character);
|
2017-03-05 02:16:23 +00:00
|
|
|
|
2017-03-10 07:06:01 +00:00
|
|
|
struct lsRange {
|
2017-03-25 22:13:19 +00:00
|
|
|
lsRange();
|
2017-04-05 08:06:18 +00:00
|
|
|
lsRange(lsPosition start, lsPosition end);
|
2017-03-15 07:14:44 +00:00
|
|
|
|
2017-03-25 22:13:19 +00:00
|
|
|
bool operator==(const lsRange& other) const;
|
2017-03-16 07:36:49 +00:00
|
|
|
|
2017-03-25 22:13:19 +00:00
|
|
|
lsPosition start;
|
|
|
|
lsPosition end;
|
2017-03-10 07:06:01 +00:00
|
|
|
};
|
2017-03-16 07:36:49 +00:00
|
|
|
MAKE_HASHABLE(lsRange, t.start, t.end);
|
2017-03-25 23:58:11 +00:00
|
|
|
MAKE_REFLECT_STRUCT(lsRange, start, end);
|
2017-03-05 02:16:23 +00:00
|
|
|
|
2017-03-10 07:06:01 +00:00
|
|
|
struct lsLocation {
|
2017-03-25 22:13:19 +00:00
|
|
|
lsLocation();
|
|
|
|
lsLocation(lsDocumentUri uri, lsRange range);
|
2017-03-15 07:14:44 +00:00
|
|
|
|
2017-03-25 22:13:19 +00:00
|
|
|
bool operator==(const lsLocation& other) const;
|
2017-03-16 07:36:49 +00:00
|
|
|
|
2017-03-25 22:13:19 +00:00
|
|
|
lsDocumentUri uri;
|
|
|
|
lsRange range;
|
2017-03-10 07:06:01 +00:00
|
|
|
};
|
2017-03-25 23:58:11 +00:00
|
|
|
MAKE_HASHABLE(lsLocation, t.uri, t.range);
|
|
|
|
MAKE_REFLECT_STRUCT(lsLocation, uri, range);
|
2017-03-05 02:16:23 +00:00
|
|
|
|
2017-03-10 07:06:01 +00:00
|
|
|
enum class lsSymbolKind : int {
|
|
|
|
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
|
|
|
|
};
|
2017-03-25 23:58:11 +00:00
|
|
|
MAKE_REFLECT_TYPE_PROXY(lsSymbolKind, int);
|
2017-03-05 02:16:23 +00:00
|
|
|
|
2017-03-10 07:06:01 +00:00
|
|
|
struct lsSymbolInformation {
|
|
|
|
std::string name;
|
|
|
|
lsSymbolKind kind;
|
|
|
|
lsLocation location;
|
|
|
|
std::string containerName;
|
|
|
|
};
|
2017-03-25 23:58:11 +00:00
|
|
|
MAKE_REFLECT_STRUCT(lsSymbolInformation, name, kind, location, containerName);
|
2017-03-05 02:16:23 +00:00
|
|
|
|
2017-09-22 01:14:57 +00:00
|
|
|
template <typename T>
|
2017-03-10 07:06:01 +00:00
|
|
|
struct lsCommand {
|
|
|
|
// Title of the command (ie, 'save')
|
|
|
|
std::string title;
|
|
|
|
// Actual command identifier.
|
|
|
|
std::string command;
|
2017-03-15 07:14:44 +00:00
|
|
|
// Arguments to run the command with.
|
2017-05-20 19:31:07 +00:00
|
|
|
// **NOTE** This must be serialized as an array. Use
|
|
|
|
// MAKE_REFLECT_STRUCT_WRITER_AS_ARRAY.
|
2017-03-15 07:14:44 +00:00
|
|
|
T arguments;
|
2017-03-10 07:06:01 +00:00
|
|
|
};
|
2017-09-22 01:14:57 +00:00
|
|
|
template <typename TVisitor, typename T>
|
2017-03-15 07:14:44 +00:00
|
|
|
void Reflect(TVisitor& visitor, lsCommand<T>& value) {
|
2017-03-10 07:06:01 +00:00
|
|
|
REFLECT_MEMBER_START();
|
|
|
|
REFLECT_MEMBER(title);
|
|
|
|
REFLECT_MEMBER(command);
|
|
|
|
REFLECT_MEMBER(arguments);
|
|
|
|
REFLECT_MEMBER_END();
|
|
|
|
}
|
2017-03-05 02:16:23 +00:00
|
|
|
|
2017-09-22 01:14:57 +00:00
|
|
|
template <typename TData, typename TCommandArguments>
|
2017-03-15 07:14:44 +00:00
|
|
|
struct lsCodeLens {
|
|
|
|
// The range in which this code lens is valid. Should only span a single line.
|
|
|
|
lsRange range;
|
|
|
|
// The command this code lens represents.
|
|
|
|
optional<lsCommand<TCommandArguments>> command;
|
|
|
|
// A data entry field that is preserved on a code lens item between
|
|
|
|
// a code lens and a code lens resolve request.
|
|
|
|
TData data;
|
|
|
|
};
|
2017-09-22 01:14:57 +00:00
|
|
|
template <typename TVisitor, typename TData, typename TCommandArguments>
|
2017-03-15 07:14:44 +00:00
|
|
|
void Reflect(TVisitor& visitor, lsCodeLens<TData, TCommandArguments>& value) {
|
|
|
|
REFLECT_MEMBER_START();
|
|
|
|
REFLECT_MEMBER(range);
|
|
|
|
REFLECT_MEMBER(command);
|
|
|
|
REFLECT_MEMBER(data);
|
|
|
|
REFLECT_MEMBER_END();
|
|
|
|
}
|
|
|
|
|
2017-03-10 07:06:01 +00:00
|
|
|
struct lsTextDocumentIdentifier {
|
|
|
|
lsDocumentUri uri;
|
|
|
|
};
|
2017-03-25 23:58:11 +00:00
|
|
|
MAKE_REFLECT_STRUCT(lsTextDocumentIdentifier, uri);
|
2017-03-05 02:16:23 +00:00
|
|
|
|
2017-03-26 06:47:59 +00:00
|
|
|
struct lsVersionedTextDocumentIdentifier {
|
|
|
|
lsDocumentUri uri;
|
|
|
|
// The version number of this document.
|
2017-04-14 08:21:03 +00:00
|
|
|
int version = 0;
|
2017-09-22 02:25:33 +00:00
|
|
|
|
|
|
|
lsTextDocumentIdentifier AsTextDocumentIdentifier() const;
|
2017-03-26 06:47:59 +00:00
|
|
|
};
|
|
|
|
MAKE_REFLECT_STRUCT(lsVersionedTextDocumentIdentifier, uri, version);
|
|
|
|
|
|
|
|
struct lsTextDocumentPositionParams {
|
|
|
|
// The text document.
|
|
|
|
lsTextDocumentIdentifier textDocument;
|
|
|
|
|
|
|
|
// The position inside the text document.
|
|
|
|
lsPosition position;
|
|
|
|
};
|
|
|
|
MAKE_REFLECT_STRUCT(lsTextDocumentPositionParams, textDocument, position);
|
|
|
|
|
2017-05-21 07:37:53 +00:00
|
|
|
struct lsTextEdit {
|
|
|
|
// The range of the text document to be manipulated. To insert
|
|
|
|
// text into a document create a range where start === end.
|
|
|
|
lsRange range;
|
|
|
|
|
|
|
|
// The string to be inserted. For delete operations use an
|
|
|
|
// empty string.
|
|
|
|
std::string newText;
|
|
|
|
|
|
|
|
bool operator==(const lsTextEdit& that);
|
|
|
|
};
|
|
|
|
MAKE_REFLECT_STRUCT(lsTextEdit, range, newText);
|
|
|
|
|
2017-03-26 06:47:59 +00:00
|
|
|
// Defines whether the insert text in a completion item should be interpreted as
|
|
|
|
// plain text or a snippet.
|
|
|
|
enum class lsInsertTextFormat {
|
|
|
|
// The primary text to be inserted is treated as a plain string.
|
|
|
|
PlainText = 1,
|
|
|
|
|
|
|
|
// The primary text to be inserted is treated as a snippet.
|
|
|
|
//
|
|
|
|
// A snippet can define tab stops and placeholders with `$1`, `$2`
|
|
|
|
// and `${3:foo}`. `$0` defines the final tab stop, it defaults to
|
|
|
|
// the end of the snippet. Placeholders with equal identifiers are linked,
|
|
|
|
// that is typing in one will update others too.
|
|
|
|
//
|
2017-09-22 01:14:57 +00:00
|
|
|
// See also:
|
|
|
|
// https://github.com/Microsoft/vscode/blob/master/src/vs/editor/contrib/snippet/common/snippet.md
|
2017-03-26 06:47:59 +00:00
|
|
|
Snippet = 2
|
|
|
|
};
|
|
|
|
MAKE_REFLECT_TYPE_PROXY(lsInsertTextFormat, int);
|
|
|
|
|
|
|
|
// The kind of a completion entry.
|
|
|
|
enum class lsCompletionItemKind {
|
|
|
|
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
|
|
|
|
};
|
|
|
|
MAKE_REFLECT_TYPE_PROXY(lsCompletionItemKind, int);
|
|
|
|
|
|
|
|
struct lsCompletionItem {
|
2017-09-22 01:14:57 +00:00
|
|
|
// A set of function parameters. Used internally for signature help. Not sent
|
|
|
|
// to vscode.
|
2017-05-15 07:28:53 +00:00
|
|
|
std::vector<std::string> parameters_;
|
|
|
|
|
2017-03-26 06:47:59 +00:00
|
|
|
// The label of this completion item. By default
|
|
|
|
// also the text that is inserted when selecting
|
|
|
|
// this completion.
|
|
|
|
std::string label;
|
|
|
|
|
|
|
|
// The kind of this completion item. Based of the kind
|
|
|
|
// an icon is chosen by the editor.
|
|
|
|
lsCompletionItemKind kind = lsCompletionItemKind::Text;
|
2017-03-05 02:16:23 +00:00
|
|
|
|
2017-03-26 06:47:59 +00:00
|
|
|
// A human-readable string with additional information
|
|
|
|
// about this item, like type or symbol information.
|
|
|
|
std::string detail;
|
2017-03-05 02:16:23 +00:00
|
|
|
|
2017-03-26 06:47:59 +00:00
|
|
|
// A human-readable string that represents a doc-comment.
|
|
|
|
std::string documentation;
|
2017-03-05 02:16:23 +00:00
|
|
|
|
2017-03-26 06:47:59 +00:00
|
|
|
// A string that shoud be used when comparing this item
|
|
|
|
// with other items. When `falsy` the label is used.
|
|
|
|
std::string sortText;
|
2017-03-05 02:16:23 +00:00
|
|
|
|
2017-03-26 06:47:59 +00:00
|
|
|
// A string that should be used when filtering a set of
|
|
|
|
// completion items. When `falsy` the label is used.
|
2017-09-22 01:14:57 +00:00
|
|
|
// std::string filterText;
|
2017-03-05 02:16:23 +00:00
|
|
|
|
2017-03-26 06:47:59 +00:00
|
|
|
// A string that should be inserted a document when selecting
|
|
|
|
// this completion. When `falsy` the label is used.
|
2017-05-15 07:28:53 +00:00
|
|
|
std::string insertText;
|
2017-03-05 02:16:23 +00:00
|
|
|
|
2017-09-22 01:14:57 +00:00
|
|
|
// The format of the insert text. The format applies to both the `insertText`
|
|
|
|
// property and the `newText` property of a provided `textEdit`.
|
2017-05-15 07:28:53 +00:00
|
|
|
lsInsertTextFormat insertTextFormat = lsInsertTextFormat::Snippet;
|
2017-03-26 06:47:59 +00:00
|
|
|
|
2017-09-22 01:14:57 +00:00
|
|
|
// An edit which is applied to a document when selecting this completion. When
|
|
|
|
// an edit is provided the value of `insertText` is ignored.
|
2017-03-26 06:47:59 +00:00
|
|
|
//
|
2017-09-22 01:14:57 +00:00
|
|
|
// *Note:* The range of the edit must be a single line range and it must
|
|
|
|
// contain the position at which completion has been requested.
|
2017-05-21 07:37:53 +00:00
|
|
|
optional<lsTextEdit> textEdit;
|
2017-03-26 06:47:59 +00:00
|
|
|
|
|
|
|
// An optional array of additional text edits that are applied when
|
|
|
|
// selecting this completion. Edits must not overlap with the main edit
|
|
|
|
// nor with themselves.
|
|
|
|
// std::vector<TextEdit> additionalTextEdits;
|
|
|
|
|
2017-09-22 01:14:57 +00:00
|
|
|
// An optional command that is executed *after* inserting this completion.
|
|
|
|
// *Note* that additional modifications to the current document should be
|
|
|
|
// described with the additionalTextEdits-property. Command command;
|
2017-03-26 06:47:59 +00:00
|
|
|
|
|
|
|
// An data entry field that is preserved on a completion item between
|
|
|
|
// a completion and a completion resolve request.
|
|
|
|
// data ? : any
|
2017-06-29 06:59:38 +00:00
|
|
|
|
|
|
|
// Use this helper to figure out what content the completion item will insert
|
|
|
|
// into the document, as it could live in either |textEdit|, |insertText|, or
|
|
|
|
// |label|.
|
|
|
|
const std::string& InsertedContent() const;
|
2017-03-26 06:47:59 +00:00
|
|
|
};
|
|
|
|
MAKE_REFLECT_STRUCT(lsCompletionItem,
|
2017-09-22 01:14:57 +00:00
|
|
|
label,
|
|
|
|
kind,
|
|
|
|
detail,
|
|
|
|
documentation,
|
|
|
|
sortText,
|
|
|
|
insertText,
|
|
|
|
insertTextFormat,
|
|
|
|
textEdit);
|
2017-03-26 06:47:59 +00:00
|
|
|
|
|
|
|
struct lsTextDocumentItem {
|
|
|
|
// The text document's URI.
|
|
|
|
lsDocumentUri uri;
|
|
|
|
|
|
|
|
// The text document's language identifier.
|
|
|
|
std::string languageId;
|
|
|
|
|
|
|
|
// The version number of this document (it will strictly increase after each
|
|
|
|
// change, including undo/redo).
|
|
|
|
int version;
|
|
|
|
|
|
|
|
// The content of the opened text document.
|
|
|
|
std::string text;
|
|
|
|
};
|
|
|
|
MAKE_REFLECT_STRUCT(lsTextDocumentItem, uri, languageId, version, text);
|
|
|
|
|
|
|
|
struct lsTextDocumentEdit {
|
|
|
|
// The text document to change.
|
|
|
|
lsVersionedTextDocumentIdentifier textDocument;
|
|
|
|
|
|
|
|
// The edits to be applied.
|
|
|
|
std::vector<lsTextEdit> edits;
|
|
|
|
};
|
|
|
|
MAKE_REFLECT_STRUCT(lsTextDocumentEdit, textDocument, edits);
|
|
|
|
|
2017-04-14 08:21:03 +00:00
|
|
|
struct lsWorkspaceEdit {
|
|
|
|
// Holds changes to existing resources.
|
|
|
|
// changes ? : { [uri:string]: TextEdit[]; };
|
2017-09-22 01:14:57 +00:00
|
|
|
// std::unordered_map<lsDocumentUri, std::vector<lsTextEdit>> changes;
|
2017-04-14 08:21:03 +00:00
|
|
|
|
|
|
|
// An array of `TextDocumentEdit`s to express changes to specific a specific
|
|
|
|
// version of a text document. Whether a client supports versioned document
|
|
|
|
// edits is expressed via `WorkspaceClientCapabilites.versionedWorkspaceEdit`.
|
|
|
|
std::vector<lsTextDocumentEdit> documentChanges;
|
|
|
|
};
|
|
|
|
MAKE_REFLECT_STRUCT(lsWorkspaceEdit, documentChanges);
|
|
|
|
|
2017-04-14 06:43:50 +00:00
|
|
|
// A document highlight kind.
|
|
|
|
enum class lsDocumentHighlightKind {
|
|
|
|
// A textual occurrence.
|
|
|
|
Text = 1,
|
|
|
|
// Read-access of a symbol, like reading a variable.
|
|
|
|
Read = 2,
|
|
|
|
// Write-access of a symbol, like writing to a variable.
|
|
|
|
Write = 3
|
|
|
|
};
|
|
|
|
MAKE_REFLECT_TYPE_PROXY(lsDocumentHighlightKind, int);
|
|
|
|
|
|
|
|
// A document highlight is a range inside a text document which deserves
|
|
|
|
// special attention. Usually a document highlight is visualized by changing
|
|
|
|
// the background color of its range.
|
|
|
|
struct lsDocumentHighlight {
|
2017-09-22 01:14:57 +00:00
|
|
|
// The range this highlight applies to.
|
|
|
|
lsRange range;
|
2017-04-14 06:43:50 +00:00
|
|
|
|
2017-09-22 01:14:57 +00:00
|
|
|
// The highlight kind, default is DocumentHighlightKind.Text.
|
2017-04-14 06:43:50 +00:00
|
|
|
lsDocumentHighlightKind kind = lsDocumentHighlightKind::Text;
|
|
|
|
};
|
|
|
|
MAKE_REFLECT_STRUCT(lsDocumentHighlight, range, kind);
|
|
|
|
|
2017-05-10 06:13:13 +00:00
|
|
|
enum class lsDiagnosticSeverity {
|
|
|
|
// Reports an error.
|
|
|
|
Error = 1,
|
|
|
|
// Reports a warning.
|
|
|
|
Warning = 2,
|
|
|
|
// Reports an information.
|
|
|
|
Information = 3,
|
|
|
|
// Reports a hint.
|
|
|
|
Hint = 4
|
|
|
|
};
|
|
|
|
MAKE_REFLECT_TYPE_PROXY(lsDiagnosticSeverity, int);
|
|
|
|
|
|
|
|
struct lsDiagnostic {
|
|
|
|
// The range at which the message applies.
|
|
|
|
lsRange range;
|
|
|
|
|
|
|
|
// The diagnostic's severity. Can be omitted. If omitted it is up to the
|
|
|
|
// client to interpret diagnostics as error, warning, info or hint.
|
|
|
|
optional<lsDiagnosticSeverity> severity;
|
|
|
|
|
|
|
|
// The diagnostic's code. Can be omitted.
|
|
|
|
int code = 0;
|
|
|
|
|
|
|
|
// A human-readable string describing the source of this
|
|
|
|
// diagnostic, e.g. 'typescript' or 'super lint'.
|
|
|
|
std::string source = "cquery";
|
|
|
|
|
|
|
|
// The diagnostic's message.
|
|
|
|
std::string message;
|
2017-05-20 19:31:07 +00:00
|
|
|
|
|
|
|
// Non-serialized set of fixits.
|
|
|
|
NonElidedVector<lsTextEdit> fixits_;
|
2017-05-10 06:13:13 +00:00
|
|
|
};
|
|
|
|
MAKE_REFLECT_STRUCT(lsDiagnostic, range, severity, source, message);
|
|
|
|
|
2017-03-26 06:47:59 +00:00
|
|
|
// TODO: DocumentFilter
|
|
|
|
// TODO: DocumentSelector
|
2017-03-05 02:16:23 +00:00
|
|
|
|
2017-03-10 07:06:01 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
////////////////////////////// INITIALIZATION ///////////////////////////////
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
2017-03-05 02:16:23 +00:00
|
|
|
|
2017-03-10 07:06:01 +00:00
|
|
|
// Workspace specific client capabilities.
|
|
|
|
struct lsWorkspaceClientCapabilites {
|
|
|
|
// The client supports applying batch edits to the workspace.
|
|
|
|
optional<bool> applyEdit;
|
2017-03-05 02:16:23 +00:00
|
|
|
|
2017-03-10 07:06:01 +00:00
|
|
|
struct lsWorkspaceEdit {
|
|
|
|
// The client supports versioned document changes in `WorkspaceEdit`s
|
|
|
|
optional<bool> documentChanges;
|
2017-03-05 02:16:23 +00:00
|
|
|
};
|
|
|
|
|
2017-03-10 07:06:01 +00:00
|
|
|
// Capabilities specific to `WorkspaceEdit`s
|
|
|
|
optional<lsWorkspaceEdit> workspaceEdit;
|
2017-03-05 02:16:23 +00:00
|
|
|
|
2017-03-10 07:06:01 +00:00
|
|
|
struct lsGenericDynamicReg {
|
|
|
|
// Did foo notification supports dynamic registration.
|
|
|
|
optional<bool> dynamicRegistration;
|
|
|
|
};
|
2017-03-05 02:16:23 +00:00
|
|
|
|
2017-09-22 01:14:57 +00:00
|
|
|
// Capabilities specific to the `workspace/didChangeConfiguration`
|
|
|
|
// notification.
|
2017-03-10 07:06:01 +00:00
|
|
|
optional<lsGenericDynamicReg> didChangeConfiguration;
|
2017-03-05 02:16:23 +00:00
|
|
|
|
2017-09-22 01:14:57 +00:00
|
|
|
// Capabilities specific to the `workspace/didChangeWatchedFiles`
|
|
|
|
// notification.
|
2017-03-10 07:06:01 +00:00
|
|
|
optional<lsGenericDynamicReg> didChangeWatchedFiles;
|
2017-03-05 02:16:23 +00:00
|
|
|
|
2017-03-10 07:06:01 +00:00
|
|
|
// Capabilities specific to the `workspace/symbol` request.
|
|
|
|
optional<lsGenericDynamicReg> symbol;
|
2017-03-05 02:16:23 +00:00
|
|
|
|
2017-03-10 07:06:01 +00:00
|
|
|
// Capabilities specific to the `workspace/executeCommand` request.
|
|
|
|
optional<lsGenericDynamicReg> executeCommand;
|
|
|
|
};
|
2017-03-05 02:16:23 +00:00
|
|
|
|
2017-09-22 01:14:57 +00:00
|
|
|
MAKE_REFLECT_STRUCT(lsWorkspaceClientCapabilites::lsWorkspaceEdit,
|
|
|
|
documentChanges);
|
|
|
|
MAKE_REFLECT_STRUCT(lsWorkspaceClientCapabilites::lsGenericDynamicReg,
|
|
|
|
dynamicRegistration);
|
2017-03-25 23:58:11 +00:00
|
|
|
MAKE_REFLECT_STRUCT(lsWorkspaceClientCapabilites,
|
2017-09-22 01:14:57 +00:00
|
|
|
applyEdit,
|
|
|
|
workspaceEdit,
|
|
|
|
didChangeConfiguration,
|
|
|
|
didChangeWatchedFiles,
|
|
|
|
symbol,
|
|
|
|
executeCommand);
|
2017-03-05 02:16:23 +00:00
|
|
|
|
2017-03-10 07:06:01 +00:00
|
|
|
// Text document specific client capabilities.
|
|
|
|
struct lsTextDocumentClientCapabilities {
|
|
|
|
struct lsSynchronization {
|
|
|
|
// Whether text document synchronization supports dynamic registration.
|
|
|
|
optional<bool> dynamicRegistration;
|
2017-03-05 02:16:23 +00:00
|
|
|
|
2017-03-10 07:06:01 +00:00
|
|
|
// The client supports sending will save notifications.
|
|
|
|
optional<bool> willSave;
|
2017-03-05 02:16:23 +00:00
|
|
|
|
2017-03-10 07:06:01 +00:00
|
|
|
// The client supports sending a will save request and
|
|
|
|
// waits for a response providing text edits which will
|
|
|
|
// be applied to the document before it is saved.
|
|
|
|
optional<bool> willSaveWaitUntil;
|
2017-03-05 02:16:23 +00:00
|
|
|
|
2017-03-10 07:06:01 +00:00
|
|
|
// The client supports did save notifications.
|
|
|
|
optional<bool> didSave;
|
|
|
|
};
|
2017-03-05 02:16:23 +00:00
|
|
|
|
2017-03-10 07:06:01 +00:00
|
|
|
lsSynchronization synchronization;
|
2017-03-05 02:16:23 +00:00
|
|
|
|
2017-03-10 07:06:01 +00:00
|
|
|
struct lsCompletion {
|
|
|
|
// Whether completion supports dynamic registration.
|
|
|
|
optional<bool> dynamicRegistration;
|
2017-03-05 02:16:23 +00:00
|
|
|
|
2017-03-10 07:06:01 +00:00
|
|
|
struct lsCompletionItem {
|
|
|
|
// Client supports snippets as insert text.
|
|
|
|
//
|
|
|
|
// A snippet can define tab stops and placeholders with `$1`, `$2`
|
|
|
|
// and `${3:foo}`. `$0` defines the final tab stop, it defaults to
|
|
|
|
// the end of the snippet. Placeholders with equal identifiers are linked,
|
|
|
|
// that is typing in one will update others too.
|
|
|
|
optional<bool> snippetSupport;
|
|
|
|
};
|
2017-03-05 02:16:23 +00:00
|
|
|
|
2017-03-10 07:06:01 +00:00
|
|
|
// The client supports the following `CompletionItem` specific
|
|
|
|
// capabilities.
|
|
|
|
optional<lsCompletionItem> completionItem;
|
|
|
|
};
|
|
|
|
// Capabilities specific to the `textDocument/completion`
|
|
|
|
optional<lsCompletion> completion;
|
2017-03-05 02:16:23 +00:00
|
|
|
|
2017-03-10 07:06:01 +00:00
|
|
|
struct lsGenericDynamicReg {
|
|
|
|
// Whether foo supports dynamic registration.
|
|
|
|
optional<bool> dynamicRegistration;
|
|
|
|
};
|
2017-03-05 02:16:23 +00:00
|
|
|
|
2017-03-10 07:06:01 +00:00
|
|
|
// Capabilities specific to the `textDocument/hover`
|
|
|
|
optional<lsGenericDynamicReg> hover;
|
2017-03-05 02:16:23 +00:00
|
|
|
|
2017-03-10 07:06:01 +00:00
|
|
|
// Capabilities specific to the `textDocument/signatureHelp`
|
|
|
|
optional<lsGenericDynamicReg> signatureHelp;
|
2017-03-05 02:16:23 +00:00
|
|
|
|
2017-03-10 07:06:01 +00:00
|
|
|
// Capabilities specific to the `textDocument/references`
|
|
|
|
optional<lsGenericDynamicReg> references;
|
2017-03-05 02:16:23 +00:00
|
|
|
|
2017-03-10 07:06:01 +00:00
|
|
|
// Capabilities specific to the `textDocument/documentHighlight`
|
|
|
|
optional<lsGenericDynamicReg> documentHighlight;
|
2017-03-05 02:16:23 +00:00
|
|
|
|
2017-03-10 07:06:01 +00:00
|
|
|
// Capabilities specific to the `textDocument/documentSymbol`
|
|
|
|
optional<lsGenericDynamicReg> documentSymbol;
|
2017-03-05 02:16:23 +00:00
|
|
|
|
2017-03-10 07:06:01 +00:00
|
|
|
// Capabilities specific to the `textDocument/formatting`
|
|
|
|
optional<lsGenericDynamicReg> formatting;
|
2017-03-05 02:16:23 +00:00
|
|
|
|
2017-03-10 07:06:01 +00:00
|
|
|
// Capabilities specific to the `textDocument/rangeFormatting`
|
|
|
|
optional<lsGenericDynamicReg> rangeFormatting;
|
2017-03-05 02:16:23 +00:00
|
|
|
|
2017-03-10 07:06:01 +00:00
|
|
|
// Capabilities specific to the `textDocument/onTypeFormatting`
|
|
|
|
optional<lsGenericDynamicReg> onTypeFormatting;
|
2017-03-05 02:16:23 +00:00
|
|
|
|
2017-03-10 07:06:01 +00:00
|
|
|
// Capabilities specific to the `textDocument/definition`
|
|
|
|
optional<lsGenericDynamicReg> definition;
|
2017-03-05 02:16:23 +00:00
|
|
|
|
2017-03-10 07:06:01 +00:00
|
|
|
// Capabilities specific to the `textDocument/codeAction`
|
|
|
|
optional<lsGenericDynamicReg> codeAction;
|
2017-03-05 02:16:23 +00:00
|
|
|
|
2017-03-15 07:14:44 +00:00
|
|
|
struct CodeLensRegistrationOptions : public lsGenericDynamicReg {
|
|
|
|
// Code lens has a resolve provider as well.
|
|
|
|
bool resolveProvider;
|
|
|
|
};
|
|
|
|
|
2017-03-10 07:06:01 +00:00
|
|
|
// Capabilities specific to the `textDocument/codeLens`
|
2017-03-15 07:14:44 +00:00
|
|
|
optional<CodeLensRegistrationOptions> codeLens;
|
2017-03-05 02:16:23 +00:00
|
|
|
|
2017-03-10 07:06:01 +00:00
|
|
|
// Capabilities specific to the `textDocument/documentLink`
|
|
|
|
optional<lsGenericDynamicReg> documentLink;
|
2017-03-05 02:16:23 +00:00
|
|
|
|
2017-03-10 07:06:01 +00:00
|
|
|
// Capabilities specific to the `textDocument/rename`
|
|
|
|
optional<lsGenericDynamicReg> rename;
|
|
|
|
};
|
2017-03-05 02:16:23 +00:00
|
|
|
|
2017-09-22 01:14:57 +00:00
|
|
|
MAKE_REFLECT_STRUCT(lsTextDocumentClientCapabilities::lsSynchronization,
|
|
|
|
dynamicRegistration,
|
|
|
|
willSave,
|
|
|
|
willSaveWaitUntil,
|
|
|
|
didSave);
|
|
|
|
MAKE_REFLECT_STRUCT(lsTextDocumentClientCapabilities::lsCompletion,
|
|
|
|
dynamicRegistration,
|
|
|
|
completionItem);
|
|
|
|
MAKE_REFLECT_STRUCT(
|
|
|
|
lsTextDocumentClientCapabilities::lsCompletion::lsCompletionItem,
|
|
|
|
snippetSupport);
|
|
|
|
MAKE_REFLECT_STRUCT(lsTextDocumentClientCapabilities::lsGenericDynamicReg,
|
|
|
|
dynamicRegistration);
|
|
|
|
MAKE_REFLECT_STRUCT(
|
|
|
|
lsTextDocumentClientCapabilities::CodeLensRegistrationOptions,
|
|
|
|
dynamicRegistration,
|
|
|
|
resolveProvider);
|
2017-03-25 23:58:11 +00:00
|
|
|
MAKE_REFLECT_STRUCT(lsTextDocumentClientCapabilities,
|
2017-09-22 01:14:57 +00:00
|
|
|
synchronization,
|
|
|
|
completion,
|
|
|
|
hover,
|
|
|
|
signatureHelp,
|
|
|
|
references,
|
|
|
|
documentHighlight,
|
|
|
|
documentSymbol,
|
|
|
|
formatting,
|
|
|
|
rangeFormatting,
|
|
|
|
onTypeFormatting,
|
|
|
|
definition,
|
|
|
|
codeAction,
|
|
|
|
codeLens,
|
|
|
|
documentLink,
|
|
|
|
rename);
|
2017-03-05 02:16:23 +00:00
|
|
|
|
2017-03-10 07:06:01 +00:00
|
|
|
struct lsClientCapabilities {
|
|
|
|
// Workspace specific client capabilities.
|
|
|
|
optional<lsWorkspaceClientCapabilites> workspace;
|
2017-03-05 02:16:23 +00:00
|
|
|
|
2017-03-10 07:06:01 +00:00
|
|
|
// Text document specific client capabilities.
|
|
|
|
optional<lsTextDocumentClientCapabilities> textDocument;
|
2017-03-05 02:16:23 +00:00
|
|
|
|
2017-03-10 07:06:01 +00:00
|
|
|
/**
|
2017-09-22 01:14:57 +00:00
|
|
|
* Experimental client capabilities.
|
|
|
|
*/
|
2017-03-10 07:06:01 +00:00
|
|
|
// experimental?: any; // TODO
|
|
|
|
};
|
2017-03-25 23:58:11 +00:00
|
|
|
MAKE_REFLECT_STRUCT(lsClientCapabilities, workspace, textDocument);
|
2017-03-05 02:16:23 +00:00
|
|
|
|
2017-03-10 07:06:01 +00:00
|
|
|
struct lsInitializeParams {
|
|
|
|
// The process Id of the parent process that started
|
|
|
|
// the server. Is null if the process has not been started by another process.
|
2017-09-22 01:14:57 +00:00
|
|
|
// If the parent process is not alive then the server should exit (see exit
|
|
|
|
// notification) its process.
|
2017-03-10 07:06:01 +00:00
|
|
|
optional<int> processId;
|
|
|
|
|
|
|
|
// The rootPath of the workspace. Is null
|
|
|
|
// if no folder is open.
|
|
|
|
//
|
|
|
|
// @deprecated in favour of rootUri.
|
|
|
|
optional<std::string> rootPath;
|
|
|
|
|
|
|
|
// The rootUri of the workspace. Is null if no
|
|
|
|
// folder is open. If both `rootPath` and `rootUri` are set
|
|
|
|
// `rootUri` wins.
|
|
|
|
optional<lsDocumentUri> rootUri;
|
|
|
|
|
|
|
|
// User provided initialization options.
|
2017-05-21 19:51:15 +00:00
|
|
|
optional<Config> initializationOptions;
|
2017-03-10 07:06:01 +00:00
|
|
|
|
|
|
|
// The capabilities provided by the client (editor or tool)
|
|
|
|
lsClientCapabilities capabilities;
|
|
|
|
|
|
|
|
enum class lsTrace {
|
|
|
|
// NOTE: serialized as a string, one of 'off' | 'messages' | 'verbose';
|
2017-09-22 01:14:57 +00:00
|
|
|
Off, // off
|
|
|
|
Messages, // messages
|
|
|
|
Verbose // verbose
|
2017-03-05 02:16:23 +00:00
|
|
|
};
|
|
|
|
|
2017-03-10 07:06:01 +00:00
|
|
|
// The initial trace setting. If omitted trace is disabled ('off').
|
|
|
|
lsTrace trace = lsTrace::Off;
|
|
|
|
};
|
2017-03-25 22:13:19 +00:00
|
|
|
void Reflect(Reader& reader, lsInitializeParams::lsTrace& value);
|
|
|
|
void Reflect(Writer& writer, lsInitializeParams::lsTrace& value);
|
2017-09-22 01:14:57 +00:00
|
|
|
MAKE_REFLECT_STRUCT(lsInitializeParams,
|
|
|
|
processId,
|
|
|
|
rootPath,
|
|
|
|
rootUri,
|
|
|
|
initializationOptions,
|
|
|
|
capabilities,
|
|
|
|
trace);
|
2017-03-05 02:16:23 +00:00
|
|
|
|
2017-03-10 07:06:01 +00:00
|
|
|
struct lsInitializeError {
|
|
|
|
// Indicates whether the client should retry to send the
|
|
|
|
// initilize request after showing the message provided
|
|
|
|
// in the ResponseError.
|
|
|
|
bool retry;
|
|
|
|
};
|
2017-03-25 23:58:11 +00:00
|
|
|
MAKE_REFLECT_STRUCT(lsInitializeError, retry);
|
2017-03-05 02:16:23 +00:00
|
|
|
|
2017-09-22 01:14:57 +00:00
|
|
|
// Defines how the host (editor) should sync document changes to the language
|
|
|
|
// server.
|
2017-03-10 07:06:01 +00:00
|
|
|
enum class lsTextDocumentSyncKind {
|
|
|
|
// Documents should not be synced at all.
|
|
|
|
None = 0,
|
2017-03-05 02:16:23 +00:00
|
|
|
|
2017-03-10 07:06:01 +00:00
|
|
|
// Documents are synced by always sending the full content
|
|
|
|
// of the document.
|
|
|
|
Full = 1,
|
2017-03-05 02:16:23 +00:00
|
|
|
|
2017-03-10 07:06:01 +00:00
|
|
|
// Documents are synced by sending the full content on open.
|
|
|
|
// After that only incremental updates to the document are
|
|
|
|
// send.
|
|
|
|
Incremental = 2
|
|
|
|
};
|
2017-03-25 22:13:19 +00:00
|
|
|
MAKE_REFLECT_TYPE_PROXY(lsTextDocumentSyncKind, int)
|
2017-03-05 02:16:23 +00:00
|
|
|
|
2017-03-10 07:06:01 +00:00
|
|
|
// Completion options.
|
|
|
|
struct lsCompletionOptions {
|
|
|
|
// The server provides support to resolve additional
|
|
|
|
// information for a completion item.
|
|
|
|
bool resolveProvider = false;
|
|
|
|
|
|
|
|
// The characters that trigger completion automatically.
|
2017-03-26 06:47:59 +00:00
|
|
|
std::vector<std::string> triggerCharacters;
|
2017-03-10 07:06:01 +00:00
|
|
|
};
|
2017-03-25 23:58:11 +00:00
|
|
|
MAKE_REFLECT_STRUCT(lsCompletionOptions, resolveProvider, triggerCharacters);
|
2017-03-05 02:16:23 +00:00
|
|
|
|
2017-03-10 07:06:01 +00:00
|
|
|
// Signature help options.
|
|
|
|
struct lsSignatureHelpOptions {
|
|
|
|
// The characters that trigger signature help automatically.
|
2017-05-15 07:28:53 +00:00
|
|
|
std::vector<std::string> triggerCharacters;
|
2017-03-10 07:06:01 +00:00
|
|
|
};
|
2017-03-25 23:58:11 +00:00
|
|
|
MAKE_REFLECT_STRUCT(lsSignatureHelpOptions, triggerCharacters);
|
2017-03-05 02:16:23 +00:00
|
|
|
|
2017-03-10 07:06:01 +00:00
|
|
|
// Code Lens options.
|
|
|
|
struct lsCodeLensOptions {
|
|
|
|
// Code lens has a resolve provider as well.
|
|
|
|
bool resolveProvider = false;
|
|
|
|
};
|
2017-03-25 23:58:11 +00:00
|
|
|
MAKE_REFLECT_STRUCT(lsCodeLensOptions, resolveProvider);
|
2017-03-05 02:16:23 +00:00
|
|
|
|
2017-03-10 07:06:01 +00:00
|
|
|
// Format document on type options
|
|
|
|
struct lsDocumentOnTypeFormattingOptions {
|
|
|
|
// A character on which formatting should be triggered, like `}`.
|
|
|
|
std::string firstTriggerCharacter;
|
|
|
|
|
|
|
|
// More trigger characters.
|
2017-03-26 00:22:06 +00:00
|
|
|
NonElidedVector<std::string> moreTriggerCharacter;
|
2017-03-10 07:06:01 +00:00
|
|
|
};
|
2017-09-22 01:14:57 +00:00
|
|
|
MAKE_REFLECT_STRUCT(lsDocumentOnTypeFormattingOptions,
|
|
|
|
firstTriggerCharacter,
|
|
|
|
moreTriggerCharacter);
|
2017-03-05 02:16:23 +00:00
|
|
|
|
2017-03-10 07:06:01 +00:00
|
|
|
// Document link options
|
|
|
|
struct lsDocumentLinkOptions {
|
|
|
|
// Document links have a resolve provider as well.
|
|
|
|
bool resolveProvider = false;
|
|
|
|
};
|
2017-03-25 23:58:11 +00:00
|
|
|
MAKE_REFLECT_STRUCT(lsDocumentLinkOptions, resolveProvider);
|
2017-03-05 02:16:23 +00:00
|
|
|
|
2017-03-10 07:06:01 +00:00
|
|
|
// Execute command options.
|
|
|
|
struct lsExecuteCommandOptions {
|
|
|
|
// The commands to be executed on the server
|
2017-03-26 00:22:06 +00:00
|
|
|
NonElidedVector<std::string> commands;
|
2017-03-10 07:06:01 +00:00
|
|
|
};
|
2017-03-25 23:58:11 +00:00
|
|
|
MAKE_REFLECT_STRUCT(lsExecuteCommandOptions, commands);
|
2017-03-05 02:16:23 +00:00
|
|
|
|
2017-03-10 07:06:01 +00:00
|
|
|
// Save options.
|
|
|
|
struct lsSaveOptions {
|
|
|
|
// The client is supposed to include the content on save.
|
|
|
|
bool includeText = false;
|
|
|
|
};
|
2017-03-25 23:58:11 +00:00
|
|
|
MAKE_REFLECT_STRUCT(lsSaveOptions, includeText);
|
2017-03-05 02:16:23 +00:00
|
|
|
|
2017-03-10 07:06:01 +00:00
|
|
|
struct lsTextDocumentSyncOptions {
|
|
|
|
// Open and close notifications are sent to the server.
|
|
|
|
bool openClose = false;
|
2017-09-22 01:14:57 +00:00
|
|
|
// Change notificatins are sent to the server. See TextDocumentSyncKind.None,
|
|
|
|
// TextDocumentSyncKind.Full and TextDocumentSyncKindIncremental.
|
2017-03-26 06:47:59 +00:00
|
|
|
lsTextDocumentSyncKind change = lsTextDocumentSyncKind::Incremental;
|
2017-03-10 07:06:01 +00:00
|
|
|
// Will save notifications are sent to the server.
|
2017-03-26 06:47:59 +00:00
|
|
|
optional<bool> willSave;
|
2017-03-10 07:06:01 +00:00
|
|
|
// Will save wait until requests are sent to the server.
|
2017-03-26 06:47:59 +00:00
|
|
|
optional<bool> willSaveWaitUntil;
|
2017-03-10 07:06:01 +00:00
|
|
|
// Save notifications are sent to the server.
|
|
|
|
optional<lsSaveOptions> save;
|
|
|
|
};
|
2017-09-22 01:14:57 +00:00
|
|
|
MAKE_REFLECT_STRUCT(lsTextDocumentSyncOptions,
|
|
|
|
openClose,
|
|
|
|
change,
|
|
|
|
willSave,
|
|
|
|
willSaveWaitUntil,
|
|
|
|
save);
|
2017-03-05 02:16:23 +00:00
|
|
|
|
2017-03-10 07:06:01 +00:00
|
|
|
struct lsServerCapabilities {
|
2017-09-22 01:14:57 +00:00
|
|
|
// Defines how text documents are synced. Is either a detailed structure
|
|
|
|
// defining each notification or for backwards compatibility the
|
|
|
|
// TextDocumentSyncKind number.
|
2017-03-26 06:47:59 +00:00
|
|
|
// TODO: It seems like the new API is broken and doesn't work.
|
|
|
|
// optional<lsTextDocumentSyncOptions> textDocumentSync;
|
|
|
|
lsTextDocumentSyncKind textDocumentSync;
|
|
|
|
|
2017-03-10 07:06:01 +00:00
|
|
|
// The server provides hover support.
|
|
|
|
bool hoverProvider = false;
|
|
|
|
// The server provides completion support.
|
|
|
|
optional<lsCompletionOptions> completionProvider;
|
|
|
|
// The server provides signature help support.
|
|
|
|
optional<lsSignatureHelpOptions> signatureHelpProvider;
|
|
|
|
// The server provides goto definition support.
|
|
|
|
bool definitionProvider = false;
|
|
|
|
// The server provides find references support.
|
|
|
|
bool referencesProvider = false;
|
|
|
|
// The server provides document highlight support.
|
|
|
|
bool documentHighlightProvider = false;
|
|
|
|
// The server provides document symbol support.
|
|
|
|
bool documentSymbolProvider = false;
|
|
|
|
// The server provides workspace symbol support.
|
|
|
|
bool workspaceSymbolProvider = false;
|
|
|
|
// The server provides code actions.
|
|
|
|
bool codeActionProvider = false;
|
|
|
|
// The server provides code lens.
|
|
|
|
optional<lsCodeLensOptions> codeLensProvider;
|
|
|
|
// The server provides document formatting.
|
|
|
|
bool documentFormattingProvider = false;
|
|
|
|
// The server provides document range formatting.
|
|
|
|
bool documentRangeFormattingProvider = false;
|
|
|
|
// The server provides document formatting on typing.
|
|
|
|
optional<lsDocumentOnTypeFormattingOptions> documentOnTypeFormattingProvider;
|
|
|
|
// The server provides rename support.
|
|
|
|
bool renameProvider = false;
|
|
|
|
// The server provides document link support.
|
|
|
|
optional<lsDocumentLinkOptions> documentLinkProvider;
|
|
|
|
// The server provides execute command support.
|
|
|
|
optional<lsExecuteCommandOptions> executeCommandProvider;
|
|
|
|
};
|
2017-03-25 23:58:11 +00:00
|
|
|
MAKE_REFLECT_STRUCT(lsServerCapabilities,
|
2017-09-22 01:14:57 +00:00
|
|
|
textDocumentSync,
|
|
|
|
hoverProvider,
|
|
|
|
completionProvider,
|
|
|
|
signatureHelpProvider,
|
|
|
|
definitionProvider,
|
|
|
|
referencesProvider,
|
|
|
|
documentHighlightProvider,
|
|
|
|
documentSymbolProvider,
|
|
|
|
workspaceSymbolProvider,
|
|
|
|
codeActionProvider,
|
|
|
|
codeLensProvider,
|
|
|
|
documentFormattingProvider,
|
|
|
|
documentRangeFormattingProvider,
|
|
|
|
documentOnTypeFormattingProvider,
|
|
|
|
renameProvider,
|
|
|
|
documentLinkProvider,
|
|
|
|
executeCommandProvider);
|
2017-03-05 02:16:23 +00:00
|
|
|
|
2017-03-25 21:57:06 +00:00
|
|
|
struct Ipc_InitializeRequest : public IpcMessage<Ipc_InitializeRequest> {
|
|
|
|
const static IpcId kIpcId = IpcId::Initialize;
|
2017-03-25 19:18:25 +00:00
|
|
|
|
2017-03-25 22:13:19 +00:00
|
|
|
lsRequestId id;
|
2017-03-10 07:06:01 +00:00
|
|
|
lsInitializeParams params;
|
|
|
|
};
|
2017-03-25 23:58:11 +00:00
|
|
|
MAKE_REFLECT_STRUCT(Ipc_InitializeRequest, id, params);
|
2017-03-25 01:27:41 +00:00
|
|
|
|
2017-03-25 21:45:49 +00:00
|
|
|
struct Out_InitializeResponse : public lsOutMessage<Out_InitializeResponse> {
|
2017-03-26 06:47:59 +00:00
|
|
|
struct InitializeResult {
|
|
|
|
lsServerCapabilities capabilities;
|
|
|
|
};
|
2017-03-25 22:13:19 +00:00
|
|
|
lsRequestId id;
|
2017-03-26 06:47:59 +00:00
|
|
|
InitializeResult result;
|
2017-03-10 07:06:01 +00:00
|
|
|
};
|
2017-03-26 06:47:59 +00:00
|
|
|
MAKE_REFLECT_STRUCT(Out_InitializeResponse::InitializeResult, capabilities);
|
2017-03-25 23:58:11 +00:00
|
|
|
MAKE_REFLECT_STRUCT(Out_InitializeResponse, jsonrpc, id, result);
|
2017-03-05 02:16:23 +00:00
|
|
|
|
2017-09-22 01:14:57 +00:00
|
|
|
struct Ipc_InitializedNotification
|
|
|
|
: public IpcMessage<Ipc_InitializedNotification> {
|
2017-03-25 21:57:06 +00:00
|
|
|
const static IpcId kIpcId = IpcId::Initialized;
|
2017-03-25 20:40:04 +00:00
|
|
|
|
2017-03-25 22:13:19 +00:00
|
|
|
lsRequestId id;
|
2017-03-10 07:06:01 +00:00
|
|
|
};
|
2017-03-25 23:58:11 +00:00
|
|
|
MAKE_REFLECT_STRUCT(Ipc_InitializedNotification, id);
|
2017-03-05 02:16:23 +00:00
|
|
|
|
2017-05-03 06:45:10 +00:00
|
|
|
struct Ipc_Exit : public IpcMessage<Ipc_Exit> {
|
|
|
|
static const IpcId kIpcId = IpcId::Exit;
|
|
|
|
};
|
|
|
|
MAKE_REFLECT_EMPTY_STRUCT(Ipc_Exit);
|
2017-03-05 02:16:23 +00:00
|
|
|
|
2017-05-27 07:10:21 +00:00
|
|
|
enum class lsErrorCodes {
|
|
|
|
// Defined by JSON RPC
|
|
|
|
ParseError = -32700,
|
|
|
|
InvalidRequest = -32600,
|
|
|
|
MethodNotFound = -32601,
|
|
|
|
InvalidParams = -32602,
|
|
|
|
InternalError = -32603,
|
|
|
|
serverErrorStart = -32099,
|
|
|
|
serverErrorEnd = -32000,
|
|
|
|
ServerNotInitialized = -32002,
|
|
|
|
UnknownErrorCode = -32001,
|
|
|
|
|
|
|
|
// Defined by the protocol.
|
|
|
|
RequestCancelled = -32800,
|
|
|
|
};
|
|
|
|
MAKE_REFLECT_TYPE_PROXY(lsErrorCodes, int);
|
|
|
|
struct Out_Error : public lsOutMessage<Out_Error> {
|
|
|
|
struct lsResponseError {
|
|
|
|
// A number indicating the error type that occurred.
|
|
|
|
lsErrorCodes code;
|
|
|
|
|
|
|
|
// A string providing a short description of the error.
|
|
|
|
std::string message;
|
|
|
|
|
|
|
|
// A Primitive or Structured value that contains additional
|
|
|
|
// information about the error. Can be omitted.
|
|
|
|
// optional<D> data;
|
|
|
|
};
|
2017-03-05 02:16:23 +00:00
|
|
|
|
2017-05-27 07:10:21 +00:00
|
|
|
lsRequestId id;
|
2017-03-05 02:16:23 +00:00
|
|
|
|
2017-05-27 07:10:21 +00:00
|
|
|
// The error object in case a request fails.
|
|
|
|
lsResponseError error;
|
|
|
|
};
|
|
|
|
MAKE_REFLECT_STRUCT(Out_Error::lsResponseError, code, message);
|
|
|
|
MAKE_REFLECT_STRUCT(Out_Error, jsonrpc, id, error);
|
2017-03-05 02:16:23 +00:00
|
|
|
|
2017-03-25 21:45:49 +00:00
|
|
|
// Cancel an existing request.
|
2017-03-25 21:02:45 +00:00
|
|
|
struct Ipc_CancelRequest : public IpcMessage<Ipc_CancelRequest> {
|
2017-03-25 21:57:06 +00:00
|
|
|
static const IpcId kIpcId = IpcId::CancelRequest;
|
2017-03-25 22:13:19 +00:00
|
|
|
lsRequestId id;
|
2017-03-25 21:02:45 +00:00
|
|
|
};
|
2017-03-25 23:58:11 +00:00
|
|
|
MAKE_REFLECT_STRUCT(Ipc_CancelRequest, id);
|
2017-03-05 02:16:23 +00:00
|
|
|
|
2017-12-03 22:35:22 +00:00
|
|
|
// Open, view, change, close file
|
2017-03-26 06:47:59 +00:00
|
|
|
struct Ipc_TextDocumentDidOpen : public IpcMessage<Ipc_TextDocumentDidOpen> {
|
|
|
|
struct Params {
|
|
|
|
lsTextDocumentItem textDocument;
|
|
|
|
};
|
|
|
|
|
|
|
|
const static IpcId kIpcId = IpcId::TextDocumentDidOpen;
|
|
|
|
Params params;
|
|
|
|
};
|
|
|
|
MAKE_REFLECT_STRUCT(Ipc_TextDocumentDidOpen::Params, textDocument);
|
|
|
|
MAKE_REFLECT_STRUCT(Ipc_TextDocumentDidOpen, params);
|
2017-12-03 22:35:22 +00:00
|
|
|
struct Ipc_CqueryTextDocumentDidView
|
|
|
|
: public IpcMessage<Ipc_CqueryTextDocumentDidView> {
|
|
|
|
struct Params {
|
|
|
|
lsDocumentUri textDocumentUri;
|
|
|
|
};
|
|
|
|
|
|
|
|
const static IpcId kIpcId = IpcId::CqueryTextDocumentDidView;
|
|
|
|
Params params;
|
|
|
|
};
|
|
|
|
MAKE_REFLECT_STRUCT(Ipc_CqueryTextDocumentDidView::Params, textDocumentUri);
|
|
|
|
MAKE_REFLECT_STRUCT(Ipc_CqueryTextDocumentDidView, params);
|
2017-09-22 01:14:57 +00:00
|
|
|
struct Ipc_TextDocumentDidChange
|
|
|
|
: public IpcMessage<Ipc_TextDocumentDidChange> {
|
2017-03-26 06:47:59 +00:00
|
|
|
struct lsTextDocumentContentChangeEvent {
|
|
|
|
// The range of the document that changed.
|
|
|
|
lsRange range;
|
|
|
|
// The length of the range that got replaced.
|
2017-03-26 21:40:34 +00:00
|
|
|
int rangeLength = -1;
|
2017-03-26 06:47:59 +00:00
|
|
|
// The new text of the range/document.
|
|
|
|
std::string text;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Params {
|
|
|
|
lsVersionedTextDocumentIdentifier textDocument;
|
|
|
|
std::vector<lsTextDocumentContentChangeEvent> contentChanges;
|
|
|
|
};
|
|
|
|
|
|
|
|
const static IpcId kIpcId = IpcId::TextDocumentDidChange;
|
|
|
|
Params params;
|
|
|
|
};
|
2017-09-22 01:14:57 +00:00
|
|
|
MAKE_REFLECT_STRUCT(Ipc_TextDocumentDidChange::lsTextDocumentContentChangeEvent,
|
|
|
|
range,
|
|
|
|
rangeLength,
|
|
|
|
text);
|
|
|
|
MAKE_REFLECT_STRUCT(Ipc_TextDocumentDidChange::Params,
|
|
|
|
textDocument,
|
|
|
|
contentChanges);
|
2017-03-26 06:47:59 +00:00
|
|
|
MAKE_REFLECT_STRUCT(Ipc_TextDocumentDidChange, params);
|
|
|
|
struct Ipc_TextDocumentDidClose : public IpcMessage<Ipc_TextDocumentDidClose> {
|
|
|
|
struct Params {
|
|
|
|
lsTextDocumentItem textDocument;
|
|
|
|
};
|
|
|
|
|
|
|
|
const static IpcId kIpcId = IpcId::TextDocumentDidClose;
|
|
|
|
Params params;
|
|
|
|
};
|
|
|
|
MAKE_REFLECT_STRUCT(Ipc_TextDocumentDidClose::Params, textDocument);
|
|
|
|
MAKE_REFLECT_STRUCT(Ipc_TextDocumentDidClose, params);
|
|
|
|
|
2017-04-10 00:08:54 +00:00
|
|
|
struct Ipc_TextDocumentDidSave : public IpcMessage<Ipc_TextDocumentDidSave> {
|
|
|
|
struct Params {
|
|
|
|
// The document that was saved.
|
|
|
|
lsTextDocumentIdentifier textDocument;
|
2017-04-16 08:55:14 +00:00
|
|
|
|
2017-04-10 00:08:54 +00:00
|
|
|
// Optional the content when saved. Depends on the includeText value
|
|
|
|
// when the save notifcation was requested.
|
|
|
|
// std::string text;
|
|
|
|
};
|
2017-03-26 06:47:59 +00:00
|
|
|
|
2017-04-10 00:08:54 +00:00
|
|
|
const static IpcId kIpcId = IpcId::TextDocumentDidSave;
|
|
|
|
Params params;
|
|
|
|
};
|
|
|
|
MAKE_REFLECT_STRUCT(Ipc_TextDocumentDidSave::Params, textDocument);
|
|
|
|
MAKE_REFLECT_STRUCT(Ipc_TextDocumentDidSave, params);
|
2017-03-26 06:47:59 +00:00
|
|
|
|
2017-05-10 06:13:13 +00:00
|
|
|
// Diagnostics
|
2017-09-22 01:14:57 +00:00
|
|
|
struct Out_TextDocumentPublishDiagnostics
|
|
|
|
: public lsOutMessage<Out_TextDocumentPublishDiagnostics> {
|
2017-05-10 06:13:13 +00:00
|
|
|
struct Params {
|
|
|
|
// The URI for which diagnostic information is reported.
|
|
|
|
lsDocumentUri uri;
|
|
|
|
|
|
|
|
// An array of diagnostic information items.
|
|
|
|
NonElidedVector<lsDiagnostic> diagnostics;
|
|
|
|
};
|
|
|
|
|
|
|
|
Params params;
|
|
|
|
};
|
2017-09-22 01:14:57 +00:00
|
|
|
template <typename TVisitor>
|
2017-05-10 06:13:13 +00:00
|
|
|
void Reflect(TVisitor& visitor, Out_TextDocumentPublishDiagnostics& value) {
|
|
|
|
std::string method = "textDocument/publishDiagnostics";
|
|
|
|
REFLECT_MEMBER_START();
|
|
|
|
REFLECT_MEMBER(jsonrpc);
|
|
|
|
REFLECT_MEMBER2("method", method);
|
|
|
|
REFLECT_MEMBER(params);
|
|
|
|
REFLECT_MEMBER_END();
|
|
|
|
}
|
2017-09-22 01:14:57 +00:00
|
|
|
MAKE_REFLECT_STRUCT(Out_TextDocumentPublishDiagnostics::Params,
|
|
|
|
uri,
|
|
|
|
diagnostics);
|
2017-05-10 06:13:13 +00:00
|
|
|
|
2017-04-14 08:21:03 +00:00
|
|
|
// Rename
|
|
|
|
struct Ipc_TextDocumentRename : public IpcMessage<Ipc_TextDocumentRename> {
|
|
|
|
struct Params {
|
|
|
|
// The document to format.
|
|
|
|
lsTextDocumentIdentifier textDocument;
|
|
|
|
|
|
|
|
// The position at which this request was sent.
|
|
|
|
lsPosition position;
|
|
|
|
|
|
|
|
// The new name of the symbol. If the given name is not valid the
|
|
|
|
// request must return a [ResponseError](#ResponseError) with an
|
|
|
|
// appropriate message set.
|
|
|
|
std::string newName;
|
|
|
|
};
|
|
|
|
const static IpcId kIpcId = IpcId::TextDocumentRename;
|
|
|
|
|
|
|
|
lsRequestId id;
|
|
|
|
Params params;
|
|
|
|
};
|
2017-09-22 01:14:57 +00:00
|
|
|
MAKE_REFLECT_STRUCT(Ipc_TextDocumentRename::Params,
|
|
|
|
textDocument,
|
|
|
|
position,
|
|
|
|
newName);
|
2017-04-14 08:21:03 +00:00
|
|
|
MAKE_REFLECT_STRUCT(Ipc_TextDocumentRename, id, params);
|
|
|
|
struct Out_TextDocumentRename : public lsOutMessage<Out_TextDocumentRename> {
|
|
|
|
lsRequestId id;
|
|
|
|
lsWorkspaceEdit result;
|
|
|
|
};
|
|
|
|
MAKE_REFLECT_STRUCT(Out_TextDocumentRename, jsonrpc, id, result);
|
|
|
|
|
2017-03-26 06:47:59 +00:00
|
|
|
// Code completion
|
|
|
|
struct Ipc_TextDocumentComplete : public IpcMessage<Ipc_TextDocumentComplete> {
|
|
|
|
const static IpcId kIpcId = IpcId::TextDocumentCompletion;
|
|
|
|
|
|
|
|
lsRequestId id;
|
|
|
|
lsTextDocumentPositionParams params;
|
|
|
|
};
|
|
|
|
MAKE_REFLECT_STRUCT(Ipc_TextDocumentComplete, id, params);
|
|
|
|
struct lsTextDocumentCompleteResult {
|
|
|
|
// This list it not complete. Further typing should result in recomputing
|
|
|
|
// this list.
|
|
|
|
bool isIncomplete = false;
|
|
|
|
// The completion items.
|
|
|
|
NonElidedVector<lsCompletionItem> items;
|
|
|
|
};
|
|
|
|
MAKE_REFLECT_STRUCT(lsTextDocumentCompleteResult, isIncomplete, items);
|
2017-09-22 01:14:57 +00:00
|
|
|
struct Out_TextDocumentComplete
|
|
|
|
: public lsOutMessage<Out_TextDocumentComplete> {
|
2017-03-26 06:47:59 +00:00
|
|
|
lsRequestId id;
|
|
|
|
lsTextDocumentCompleteResult result;
|
|
|
|
};
|
|
|
|
MAKE_REFLECT_STRUCT(Out_TextDocumentComplete, jsonrpc, id, result);
|
|
|
|
|
2017-05-15 07:28:53 +00:00
|
|
|
// Signature help.
|
2017-09-22 01:14:57 +00:00
|
|
|
struct Ipc_TextDocumentSignatureHelp
|
|
|
|
: public IpcMessage<Ipc_TextDocumentSignatureHelp> {
|
2017-05-15 07:28:53 +00:00
|
|
|
const static IpcId kIpcId = IpcId::TextDocumentSignatureHelp;
|
|
|
|
|
|
|
|
lsRequestId id;
|
|
|
|
lsTextDocumentPositionParams params;
|
|
|
|
};
|
|
|
|
MAKE_REFLECT_STRUCT(Ipc_TextDocumentSignatureHelp, id, params);
|
|
|
|
// Represents a parameter of a callable-signature. A parameter can
|
|
|
|
// have a label and a doc-comment.
|
|
|
|
struct lsParameterInformation {
|
|
|
|
// The label of this parameter. Will be shown in
|
|
|
|
// the UI.
|
|
|
|
std::string label;
|
|
|
|
|
|
|
|
// The human-readable doc-comment of this parameter. Will be shown
|
|
|
|
// in the UI but can be omitted.
|
|
|
|
optional<std::string> documentation;
|
|
|
|
};
|
|
|
|
MAKE_REFLECT_STRUCT(lsParameterInformation, label, documentation);
|
|
|
|
// Represents the signature of something callable. A signature
|
|
|
|
// can have a label, like a function-name, a doc-comment, and
|
|
|
|
// a set of parameters.
|
|
|
|
struct lsSignatureInformation {
|
|
|
|
// The label of this signature. Will be shown in
|
|
|
|
// the UI.
|
|
|
|
std::string label;
|
|
|
|
|
|
|
|
// The human-readable doc-comment of this signature. Will be shown
|
|
|
|
// in the UI but can be omitted.
|
|
|
|
optional<std::string> documentation;
|
|
|
|
|
|
|
|
// The parameters of this signature.
|
|
|
|
std::vector<lsParameterInformation> parameters;
|
|
|
|
};
|
|
|
|
MAKE_REFLECT_STRUCT(lsSignatureInformation, label, documentation, parameters);
|
|
|
|
// Signature help represents the signature of something
|
|
|
|
// callable. There can be multiple signature but only one
|
|
|
|
// active and only one active parameter.
|
|
|
|
struct lsSignatureHelp {
|
|
|
|
// One or more signatures.
|
|
|
|
NonElidedVector<lsSignatureInformation> signatures;
|
|
|
|
|
|
|
|
// The active signature. If omitted or the value lies outside the
|
|
|
|
// range of `signatures` the value defaults to zero or is ignored if
|
2017-05-20 19:31:07 +00:00
|
|
|
// `signatures.length === 0`. Whenever possible implementors should
|
|
|
|
// make an active decision about the active signature and shouldn't
|
2017-05-15 07:28:53 +00:00
|
|
|
// rely on a default value.
|
|
|
|
// In future version of the protocol this property might become
|
|
|
|
// mandantory to better express this.
|
|
|
|
optional<int> activeSignature;
|
|
|
|
|
|
|
|
// The active parameter of the active signature. If omitted or the value
|
2017-05-20 19:31:07 +00:00
|
|
|
// lies outside the range of `signatures[activeSignature].parameters`
|
|
|
|
// defaults to 0 if the active signature has parameters. If
|
|
|
|
// the active signature has no parameters it is ignored.
|
2017-05-15 07:28:53 +00:00
|
|
|
// In future version of the protocol this property might become
|
|
|
|
// mandantory to better express the active parameter if the
|
|
|
|
// active signature does have any.
|
|
|
|
optional<int> activeParameter;
|
|
|
|
};
|
2017-09-22 01:14:57 +00:00
|
|
|
MAKE_REFLECT_STRUCT(lsSignatureHelp,
|
|
|
|
signatures,
|
|
|
|
activeSignature,
|
|
|
|
activeParameter);
|
2017-11-30 03:47:29 +00:00
|
|
|
|
2017-12-01 17:50:39 +00:00
|
|
|
// MarkedString can be used to render human readable text. It is either a
|
|
|
|
// markdown string or a code-block that provides a language and a code snippet.
|
|
|
|
// The language identifier is sematically equal to the optional language
|
|
|
|
// identifier in fenced code blocks in GitHub issues. See
|
|
|
|
// https://help.github.com/articles/creating-and-highlighting-code-blocks/#syntax-highlighting
|
2017-11-30 03:47:29 +00:00
|
|
|
//
|
|
|
|
// The pair of a language and a value is an equivalent to markdown:
|
|
|
|
// ```${language}
|
|
|
|
// ${value}
|
|
|
|
// ```
|
|
|
|
//
|
2017-12-01 17:50:39 +00:00
|
|
|
// Note that markdown strings will be sanitized - that means html will be
|
|
|
|
// escaped.
|
2017-11-30 03:47:29 +00:00
|
|
|
struct lsMarkedString {
|
|
|
|
std::string language;
|
|
|
|
std::string value;
|
|
|
|
};
|
|
|
|
MAKE_REFLECT_STRUCT(lsMarkedString, language, value);
|
|
|
|
|
2017-09-22 01:14:57 +00:00
|
|
|
struct Out_TextDocumentSignatureHelp
|
|
|
|
: public lsOutMessage<Out_TextDocumentSignatureHelp> {
|
2017-05-15 07:28:53 +00:00
|
|
|
lsRequestId id;
|
|
|
|
lsSignatureHelp result;
|
|
|
|
};
|
|
|
|
MAKE_REFLECT_STRUCT(Out_TextDocumentSignatureHelp, jsonrpc, id, result);
|
|
|
|
|
2017-04-03 02:21:21 +00:00
|
|
|
// Goto definition
|
2017-09-22 01:14:57 +00:00
|
|
|
struct Ipc_TextDocumentDefinition
|
|
|
|
: public IpcMessage<Ipc_TextDocumentDefinition> {
|
2017-04-03 02:21:21 +00:00
|
|
|
const static IpcId kIpcId = IpcId::TextDocumentDefinition;
|
|
|
|
|
|
|
|
lsRequestId id;
|
|
|
|
lsTextDocumentPositionParams params;
|
|
|
|
};
|
|
|
|
MAKE_REFLECT_STRUCT(Ipc_TextDocumentDefinition, id, params);
|
2017-09-22 01:14:57 +00:00
|
|
|
struct Out_TextDocumentDefinition
|
|
|
|
: public lsOutMessage<Out_TextDocumentDefinition> {
|
2017-04-03 02:21:21 +00:00
|
|
|
lsRequestId id;
|
|
|
|
NonElidedVector<lsLocation> result;
|
|
|
|
};
|
|
|
|
MAKE_REFLECT_STRUCT(Out_TextDocumentDefinition, jsonrpc, id, result);
|
2017-04-14 06:43:50 +00:00
|
|
|
|
|
|
|
// Document highlight
|
2017-09-22 01:14:57 +00:00
|
|
|
struct Ipc_TextDocumentDocumentHighlight
|
|
|
|
: public IpcMessage<Ipc_TextDocumentDocumentHighlight> {
|
2017-04-14 06:43:50 +00:00
|
|
|
const static IpcId kIpcId = IpcId::TextDocumentDocumentHighlight;
|
|
|
|
|
|
|
|
lsRequestId id;
|
|
|
|
lsTextDocumentPositionParams params;
|
|
|
|
};
|
|
|
|
MAKE_REFLECT_STRUCT(Ipc_TextDocumentDocumentHighlight, id, params);
|
2017-09-22 01:14:57 +00:00
|
|
|
struct Out_TextDocumentDocumentHighlight
|
|
|
|
: public lsOutMessage<Out_TextDocumentDocumentHighlight> {
|
2017-04-14 06:43:50 +00:00
|
|
|
lsRequestId id;
|
|
|
|
NonElidedVector<lsDocumentHighlight> result;
|
|
|
|
};
|
|
|
|
MAKE_REFLECT_STRUCT(Out_TextDocumentDocumentHighlight, jsonrpc, id, result);
|
2017-03-26 06:47:59 +00:00
|
|
|
|
2017-04-14 05:18:02 +00:00
|
|
|
// Hover
|
|
|
|
struct Ipc_TextDocumentHover : public IpcMessage<Ipc_TextDocumentHover> {
|
|
|
|
const static IpcId kIpcId = IpcId::TextDocumentHover;
|
|
|
|
|
|
|
|
lsRequestId id;
|
|
|
|
lsTextDocumentPositionParams params;
|
|
|
|
};
|
|
|
|
MAKE_REFLECT_STRUCT(Ipc_TextDocumentHover, id, params);
|
|
|
|
struct Out_TextDocumentHover : public lsOutMessage<Out_TextDocumentHover> {
|
|
|
|
struct Result {
|
2017-11-30 03:47:29 +00:00
|
|
|
lsMarkedString contents;
|
2017-04-14 05:18:02 +00:00
|
|
|
optional<lsRange> range;
|
|
|
|
};
|
|
|
|
|
|
|
|
lsRequestId id;
|
|
|
|
Result result;
|
|
|
|
};
|
|
|
|
MAKE_REFLECT_STRUCT(Out_TextDocumentHover::Result, contents, range);
|
|
|
|
MAKE_REFLECT_STRUCT(Out_TextDocumentHover, jsonrpc, id, result);
|
|
|
|
|
2017-04-10 05:34:06 +00:00
|
|
|
// References
|
2017-09-22 01:14:57 +00:00
|
|
|
struct Ipc_TextDocumentReferences
|
|
|
|
: public IpcMessage<Ipc_TextDocumentReferences> {
|
2017-04-10 05:34:06 +00:00
|
|
|
struct lsReferenceContext {
|
|
|
|
// Include the declaration of the current symbol.
|
|
|
|
bool includeDeclaration;
|
|
|
|
};
|
|
|
|
struct lsReferenceParams : public lsTextDocumentPositionParams {
|
|
|
|
lsTextDocumentIdentifier textDocument;
|
|
|
|
lsPosition position;
|
|
|
|
lsReferenceContext context;
|
|
|
|
};
|
|
|
|
|
|
|
|
const static IpcId kIpcId = IpcId::TextDocumentReferences;
|
|
|
|
|
|
|
|
lsRequestId id;
|
|
|
|
lsReferenceParams params;
|
|
|
|
};
|
2017-09-22 01:14:57 +00:00
|
|
|
MAKE_REFLECT_STRUCT(Ipc_TextDocumentReferences::lsReferenceContext,
|
|
|
|
includeDeclaration);
|
|
|
|
MAKE_REFLECT_STRUCT(Ipc_TextDocumentReferences::lsReferenceParams,
|
|
|
|
textDocument,
|
|
|
|
position,
|
|
|
|
context);
|
2017-04-10 05:34:06 +00:00
|
|
|
MAKE_REFLECT_STRUCT(Ipc_TextDocumentReferences, id, params);
|
2017-09-22 01:14:57 +00:00
|
|
|
struct Out_TextDocumentReferences
|
|
|
|
: public lsOutMessage<Out_TextDocumentReferences> {
|
2017-04-10 05:34:06 +00:00
|
|
|
lsRequestId id;
|
|
|
|
NonElidedVector<lsLocation> result;
|
|
|
|
};
|
|
|
|
MAKE_REFLECT_STRUCT(Out_TextDocumentReferences, jsonrpc, id, result);
|
|
|
|
|
2017-05-20 19:31:07 +00:00
|
|
|
// Code action
|
2017-09-22 01:14:57 +00:00
|
|
|
struct Ipc_TextDocumentCodeAction
|
|
|
|
: public IpcMessage<Ipc_TextDocumentCodeAction> {
|
2017-05-20 19:31:07 +00:00
|
|
|
const static IpcId kIpcId = IpcId::TextDocumentCodeAction;
|
|
|
|
// Contains additional diagnostic information about the context in which
|
|
|
|
// a code action is run.
|
|
|
|
struct lsCodeActionContext {
|
2017-09-22 01:14:57 +00:00
|
|
|
// An array of diagnostics.
|
|
|
|
NonElidedVector<lsDiagnostic> diagnostics;
|
2017-05-20 19:31:07 +00:00
|
|
|
};
|
|
|
|
// Params for the CodeActionRequest
|
|
|
|
struct lsCodeActionParams {
|
2017-09-22 01:14:57 +00:00
|
|
|
// The document in which the command was invoked.
|
|
|
|
lsTextDocumentIdentifier textDocument;
|
|
|
|
// The range for which the command was invoked.
|
2017-05-20 19:31:07 +00:00
|
|
|
lsRange range;
|
2017-09-22 01:14:57 +00:00
|
|
|
// Context carrying additional information.
|
2017-05-20 19:31:07 +00:00
|
|
|
lsCodeActionContext context;
|
|
|
|
};
|
|
|
|
|
|
|
|
lsRequestId id;
|
|
|
|
lsCodeActionParams params;
|
|
|
|
};
|
2017-09-22 01:14:57 +00:00
|
|
|
MAKE_REFLECT_STRUCT(Ipc_TextDocumentCodeAction::lsCodeActionContext,
|
|
|
|
diagnostics);
|
|
|
|
MAKE_REFLECT_STRUCT(Ipc_TextDocumentCodeAction::lsCodeActionParams,
|
|
|
|
textDocument,
|
|
|
|
range,
|
|
|
|
context);
|
2017-05-20 19:31:07 +00:00
|
|
|
MAKE_REFLECT_STRUCT(Ipc_TextDocumentCodeAction, id, params);
|
2017-09-22 01:14:57 +00:00
|
|
|
struct Out_TextDocumentCodeAction
|
|
|
|
: public lsOutMessage<Out_TextDocumentCodeAction> {
|
2017-05-20 19:31:07 +00:00
|
|
|
struct CommandArgs {
|
|
|
|
lsDocumentUri textDocumentUri;
|
|
|
|
NonElidedVector<lsTextEdit> edits;
|
|
|
|
};
|
|
|
|
using Command = lsCommand<CommandArgs>;
|
|
|
|
|
|
|
|
lsRequestId id;
|
|
|
|
NonElidedVector<Command> result;
|
|
|
|
};
|
2017-09-22 01:14:57 +00:00
|
|
|
MAKE_REFLECT_STRUCT_WRITER_AS_ARRAY(Out_TextDocumentCodeAction::CommandArgs,
|
|
|
|
textDocumentUri,
|
|
|
|
edits);
|
2017-05-20 19:31:07 +00:00
|
|
|
MAKE_REFLECT_STRUCT(Out_TextDocumentCodeAction, jsonrpc, id, result);
|
|
|
|
|
2017-03-25 21:45:49 +00:00
|
|
|
// List symbols in a document.
|
2017-03-10 07:06:01 +00:00
|
|
|
struct lsDocumentSymbolParams {
|
|
|
|
lsTextDocumentIdentifier textDocument;
|
|
|
|
};
|
2017-03-25 23:58:11 +00:00
|
|
|
MAKE_REFLECT_STRUCT(lsDocumentSymbolParams, textDocument);
|
2017-09-22 01:14:57 +00:00
|
|
|
struct Ipc_TextDocumentDocumentSymbol
|
|
|
|
: public IpcMessage<Ipc_TextDocumentDocumentSymbol> {
|
2017-03-25 21:57:06 +00:00
|
|
|
const static IpcId kIpcId = IpcId::TextDocumentDocumentSymbol;
|
2017-03-05 02:16:23 +00:00
|
|
|
|
2017-03-25 22:13:19 +00:00
|
|
|
lsRequestId id;
|
2017-03-10 07:06:01 +00:00
|
|
|
lsDocumentSymbolParams params;
|
|
|
|
};
|
2017-03-25 23:58:11 +00:00
|
|
|
MAKE_REFLECT_STRUCT(Ipc_TextDocumentDocumentSymbol, id, params);
|
2017-09-22 01:14:57 +00:00
|
|
|
struct Out_TextDocumentDocumentSymbol
|
|
|
|
: public lsOutMessage<Out_TextDocumentDocumentSymbol> {
|
2017-03-25 22:13:19 +00:00
|
|
|
lsRequestId id;
|
2017-03-26 00:22:06 +00:00
|
|
|
NonElidedVector<lsSymbolInformation> result;
|
2017-03-10 07:06:01 +00:00
|
|
|
};
|
2017-03-25 23:58:11 +00:00
|
|
|
MAKE_REFLECT_STRUCT(Out_TextDocumentDocumentSymbol, jsonrpc, id, result);
|
2017-03-05 02:16:23 +00:00
|
|
|
|
2017-05-21 04:30:59 +00:00
|
|
|
// List links a document
|
2017-09-22 01:14:57 +00:00
|
|
|
struct Ipc_TextDocumentDocumentLink
|
|
|
|
: public IpcMessage<Ipc_TextDocumentDocumentLink> {
|
2017-05-21 04:30:59 +00:00
|
|
|
const static IpcId kIpcId = IpcId::TextDocumentDocumentLink;
|
|
|
|
|
|
|
|
struct DocumentLinkParams {
|
|
|
|
// The document to provide document links for.
|
|
|
|
lsTextDocumentIdentifier textDocument;
|
|
|
|
};
|
|
|
|
|
|
|
|
lsRequestId id;
|
|
|
|
DocumentLinkParams params;
|
|
|
|
};
|
2017-09-22 01:14:57 +00:00
|
|
|
MAKE_REFLECT_STRUCT(Ipc_TextDocumentDocumentLink::DocumentLinkParams,
|
|
|
|
textDocument);
|
2017-05-21 04:30:59 +00:00
|
|
|
MAKE_REFLECT_STRUCT(Ipc_TextDocumentDocumentLink, id, params);
|
2017-09-22 01:14:57 +00:00
|
|
|
// A document link is a range in a text document that links to an internal or
|
|
|
|
// external resource, like another text document or a web site.
|
2017-05-21 04:30:59 +00:00
|
|
|
struct lsDocumentLink {
|
2017-09-22 01:14:57 +00:00
|
|
|
// The range this link applies to.
|
|
|
|
lsRange range;
|
|
|
|
// The uri this link points to. If missing a resolve request is sent later.
|
|
|
|
optional<lsDocumentUri> target;
|
2017-05-21 04:30:59 +00:00
|
|
|
};
|
|
|
|
MAKE_REFLECT_STRUCT(lsDocumentLink, range, target);
|
2017-09-22 01:14:57 +00:00
|
|
|
struct Out_TextDocumentDocumentLink
|
|
|
|
: public lsOutMessage<Out_TextDocumentDocumentLink> {
|
2017-05-21 04:30:59 +00:00
|
|
|
lsRequestId id;
|
|
|
|
NonElidedVector<lsDocumentLink> result;
|
|
|
|
};
|
|
|
|
MAKE_REFLECT_STRUCT(Out_TextDocumentDocumentLink, jsonrpc, id, result);
|
|
|
|
|
2017-03-25 21:45:49 +00:00
|
|
|
// List code lens in a document.
|
2017-03-15 07:14:44 +00:00
|
|
|
struct lsDocumentCodeLensParams {
|
|
|
|
lsTextDocumentIdentifier textDocument;
|
|
|
|
};
|
2017-03-25 23:58:11 +00:00
|
|
|
MAKE_REFLECT_STRUCT(lsDocumentCodeLensParams, textDocument);
|
2017-03-15 07:14:44 +00:00
|
|
|
struct lsCodeLensUserData {};
|
2017-03-25 23:58:11 +00:00
|
|
|
MAKE_REFLECT_EMPTY_STRUCT(lsCodeLensUserData);
|
2017-03-15 07:14:44 +00:00
|
|
|
struct lsCodeLensCommandArguments {
|
|
|
|
lsDocumentUri uri;
|
|
|
|
lsPosition position;
|
2017-03-26 00:22:06 +00:00
|
|
|
NonElidedVector<lsLocation> locations;
|
2017-03-15 07:14:44 +00:00
|
|
|
};
|
2017-03-25 22:13:19 +00:00
|
|
|
void Reflect(Writer& visitor, lsCodeLensCommandArguments& value);
|
|
|
|
void Reflect(Reader& visitor, lsCodeLensCommandArguments& value);
|
2017-03-15 07:14:44 +00:00
|
|
|
using TCodeLens = lsCodeLens<lsCodeLensUserData, lsCodeLensCommandArguments>;
|
2017-03-25 21:57:06 +00:00
|
|
|
struct Ipc_TextDocumentCodeLens : public IpcMessage<Ipc_TextDocumentCodeLens> {
|
|
|
|
const static IpcId kIpcId = IpcId::TextDocumentCodeLens;
|
2017-03-25 22:13:19 +00:00
|
|
|
lsRequestId id;
|
2017-03-15 07:14:44 +00:00
|
|
|
lsDocumentCodeLensParams params;
|
|
|
|
};
|
2017-03-25 23:58:11 +00:00
|
|
|
MAKE_REFLECT_STRUCT(Ipc_TextDocumentCodeLens, id, params);
|
2017-09-22 01:14:57 +00:00
|
|
|
struct Out_TextDocumentCodeLens
|
|
|
|
: public lsOutMessage<Out_TextDocumentCodeLens> {
|
2017-03-25 22:13:19 +00:00
|
|
|
lsRequestId id;
|
2017-09-22 01:14:57 +00:00
|
|
|
NonElidedVector<lsCodeLens<lsCodeLensUserData, lsCodeLensCommandArguments>>
|
|
|
|
result;
|
2017-03-15 07:14:44 +00:00
|
|
|
};
|
2017-03-25 23:58:11 +00:00
|
|
|
MAKE_REFLECT_STRUCT(Out_TextDocumentCodeLens, jsonrpc, id, result);
|
2017-03-25 21:57:06 +00:00
|
|
|
struct Ipc_CodeLensResolve : public IpcMessage<Ipc_CodeLensResolve> {
|
|
|
|
const static IpcId kIpcId = IpcId::CodeLensResolve;
|
2017-03-15 07:14:44 +00:00
|
|
|
|
2017-03-25 22:13:19 +00:00
|
|
|
lsRequestId id;
|
2017-03-15 07:14:44 +00:00
|
|
|
TCodeLens params;
|
|
|
|
};
|
2017-03-25 23:58:11 +00:00
|
|
|
MAKE_REFLECT_STRUCT(Ipc_CodeLensResolve, id, params);
|
2017-03-25 21:45:49 +00:00
|
|
|
struct Out_CodeLensResolve : public lsOutMessage<Out_CodeLensResolve> {
|
2017-03-25 22:13:19 +00:00
|
|
|
lsRequestId id;
|
2017-03-15 07:14:44 +00:00
|
|
|
TCodeLens result;
|
|
|
|
};
|
2017-03-25 23:58:11 +00:00
|
|
|
MAKE_REFLECT_STRUCT(Out_CodeLensResolve, jsonrpc, id, result);
|
2017-03-15 07:14:44 +00:00
|
|
|
|
2017-03-25 21:45:49 +00:00
|
|
|
// Search for symbols in the workspace.
|
2017-03-10 07:06:01 +00:00
|
|
|
struct lsWorkspaceSymbolParams {
|
|
|
|
std::string query;
|
|
|
|
};
|
2017-03-25 23:58:11 +00:00
|
|
|
MAKE_REFLECT_STRUCT(lsWorkspaceSymbolParams, query);
|
2017-04-21 04:50:31 +00:00
|
|
|
struct Ipc_WorkspaceSymbol : public IpcMessage<Ipc_WorkspaceSymbol> {
|
2017-03-25 21:57:06 +00:00
|
|
|
const static IpcId kIpcId = IpcId::WorkspaceSymbol;
|
2017-03-25 22:13:19 +00:00
|
|
|
lsRequestId id;
|
2017-03-10 07:06:01 +00:00
|
|
|
lsWorkspaceSymbolParams params;
|
|
|
|
};
|
2017-03-25 23:58:11 +00:00
|
|
|
MAKE_REFLECT_STRUCT(Ipc_WorkspaceSymbol, id, params);
|
2017-03-25 21:45:49 +00:00
|
|
|
struct Out_WorkspaceSymbol : public lsOutMessage<Out_WorkspaceSymbol> {
|
2017-03-25 22:13:19 +00:00
|
|
|
lsRequestId id;
|
2017-03-26 00:22:06 +00:00
|
|
|
NonElidedVector<lsSymbolInformation> result;
|
2017-03-10 07:06:01 +00:00
|
|
|
};
|
2017-03-25 23:58:11 +00:00
|
|
|
MAKE_REFLECT_STRUCT(Out_WorkspaceSymbol, jsonrpc, id, result);
|
2017-03-06 08:48:51 +00:00
|
|
|
|
2017-03-25 21:45:49 +00:00
|
|
|
// Show a message to the user.
|
2017-09-22 01:14:57 +00:00
|
|
|
enum class lsMessageType : int { Error = 1, Warning = 2, Info = 3, Log = 4 };
|
2017-03-25 22:13:19 +00:00
|
|
|
MAKE_REFLECT_TYPE_PROXY(lsMessageType, int)
|
2017-03-25 21:45:49 +00:00
|
|
|
struct Out_ShowLogMessageParams {
|
2017-03-10 07:06:01 +00:00
|
|
|
lsMessageType type = lsMessageType::Error;
|
|
|
|
std::string message;
|
|
|
|
};
|
2017-03-25 23:58:11 +00:00
|
|
|
MAKE_REFLECT_STRUCT(Out_ShowLogMessageParams, type, message);
|
2017-03-25 21:45:49 +00:00
|
|
|
struct Out_ShowLogMessage : public lsOutMessage<Out_ShowLogMessage> {
|
2017-09-22 01:14:57 +00:00
|
|
|
enum class DisplayType { Show, Log };
|
2017-03-25 21:45:49 +00:00
|
|
|
DisplayType display_type = DisplayType::Show;
|
2017-03-25 23:58:11 +00:00
|
|
|
|
2017-03-25 22:13:19 +00:00
|
|
|
std::string method();
|
2017-03-25 21:45:49 +00:00
|
|
|
Out_ShowLogMessageParams params;
|
2017-03-10 07:06:01 +00:00
|
|
|
};
|
2017-09-22 01:14:57 +00:00
|
|
|
template <typename TVisitor>
|
2017-03-25 21:45:49 +00:00
|
|
|
void Reflect(TVisitor& visitor, Out_ShowLogMessage& value) {
|
|
|
|
REFLECT_MEMBER_START();
|
|
|
|
REFLECT_MEMBER(jsonrpc);
|
2017-05-21 07:43:10 +00:00
|
|
|
std::string method = value.method();
|
|
|
|
REFLECT_MEMBER2("method", method);
|
2017-03-25 21:45:49 +00:00
|
|
|
REFLECT_MEMBER(params);
|
|
|
|
REFLECT_MEMBER_END();
|
2017-04-21 04:50:31 +00:00
|
|
|
}
|
|
|
|
|
2017-10-25 07:12:11 +00:00
|
|
|
struct Out_Progress : public lsOutMessage<Out_Progress> {
|
|
|
|
struct Params {
|
|
|
|
int indexRequestCount = 0;
|
|
|
|
int doIdMapCount = 0;
|
|
|
|
int loadPreviousIndexCount = 0;
|
|
|
|
int onIdMappedCount = 0;
|
|
|
|
int onIndexedCount = 0;
|
|
|
|
};
|
|
|
|
std::string method = "$cquery/progress";
|
|
|
|
Params params;
|
|
|
|
};
|
|
|
|
MAKE_REFLECT_STRUCT(Out_Progress::Params,
|
|
|
|
indexRequestCount,
|
|
|
|
doIdMapCount,
|
|
|
|
loadPreviousIndexCount,
|
|
|
|
onIdMappedCount,
|
|
|
|
onIndexedCount);
|
|
|
|
MAKE_REFLECT_STRUCT(Out_Progress, jsonrpc, method, params);
|
|
|
|
|
2017-09-22 01:14:57 +00:00
|
|
|
struct Out_CquerySetInactiveRegion
|
|
|
|
: public lsOutMessage<Out_CquerySetInactiveRegion> {
|
2017-05-20 21:45:46 +00:00
|
|
|
struct Params {
|
|
|
|
lsDocumentUri uri;
|
|
|
|
NonElidedVector<lsRange> inactiveRegions;
|
|
|
|
};
|
|
|
|
std::string method = "$cquery/setInactiveRegions";
|
|
|
|
Params params;
|
|
|
|
};
|
|
|
|
MAKE_REFLECT_STRUCT(Out_CquerySetInactiveRegion::Params, uri, inactiveRegions);
|
|
|
|
MAKE_REFLECT_STRUCT(Out_CquerySetInactiveRegion, jsonrpc, method, params);
|
|
|
|
|
2017-11-09 07:06:32 +00:00
|
|
|
struct Out_CqueryPublishSemanticHighlighting
|
|
|
|
: public lsOutMessage<Out_CqueryPublishSemanticHighlighting> {
|
|
|
|
enum class SymbolType { Type = 0, Function, Variable };
|
|
|
|
struct Symbol {
|
2017-12-04 06:49:50 +00:00
|
|
|
int stableId = 0;
|
2017-11-11 19:18:55 +00:00
|
|
|
SymbolType type = SymbolType::Type;
|
2017-12-04 02:23:14 +00:00
|
|
|
bool isTypeMember = false;
|
2017-11-09 07:06:32 +00:00
|
|
|
NonElidedVector<lsRange> ranges;
|
|
|
|
};
|
|
|
|
struct Params {
|
|
|
|
lsDocumentUri uri;
|
|
|
|
NonElidedVector<Symbol> symbols;
|
|
|
|
};
|
|
|
|
std::string method = "$cquery/publishSemanticHighlighting";
|
|
|
|
Params params;
|
|
|
|
};
|
|
|
|
MAKE_REFLECT_TYPE_PROXY(Out_CqueryPublishSemanticHighlighting::SymbolType, int);
|
|
|
|
MAKE_REFLECT_STRUCT(Out_CqueryPublishSemanticHighlighting::Symbol,
|
|
|
|
type,
|
2017-12-04 02:23:14 +00:00
|
|
|
isTypeMember,
|
|
|
|
stableId,
|
2017-11-09 07:06:32 +00:00
|
|
|
ranges);
|
|
|
|
MAKE_REFLECT_STRUCT(Out_CqueryPublishSemanticHighlighting::Params,
|
|
|
|
uri,
|
|
|
|
symbols);
|
|
|
|
MAKE_REFLECT_STRUCT(Out_CqueryPublishSemanticHighlighting,
|
|
|
|
jsonrpc,
|
|
|
|
method,
|
|
|
|
params);
|
|
|
|
|
2017-04-21 04:50:31 +00:00
|
|
|
struct Ipc_CqueryFreshenIndex : public IpcMessage<Ipc_CqueryFreshenIndex> {
|
|
|
|
const static IpcId kIpcId = IpcId::CqueryFreshenIndex;
|
|
|
|
lsRequestId id;
|
|
|
|
};
|
2017-05-07 06:56:04 +00:00
|
|
|
MAKE_REFLECT_STRUCT(Ipc_CqueryFreshenIndex, id);
|
|
|
|
|
2017-05-24 07:17:29 +00:00
|
|
|
// Type Hierarchy Tree
|
2017-09-22 01:14:57 +00:00
|
|
|
struct Ipc_CqueryTypeHierarchyTree
|
|
|
|
: public IpcMessage<Ipc_CqueryTypeHierarchyTree> {
|
2017-05-24 07:17:29 +00:00
|
|
|
const static IpcId kIpcId = IpcId::CqueryTypeHierarchyTree;
|
|
|
|
lsRequestId id;
|
|
|
|
lsTextDocumentPositionParams params;
|
|
|
|
};
|
|
|
|
MAKE_REFLECT_STRUCT(Ipc_CqueryTypeHierarchyTree, id, params);
|
2017-09-22 01:14:57 +00:00
|
|
|
struct Out_CqueryTypeHierarchyTree
|
|
|
|
: public lsOutMessage<Out_CqueryTypeHierarchyTree> {
|
2017-05-24 07:17:29 +00:00
|
|
|
struct TypeEntry {
|
|
|
|
std::string name;
|
|
|
|
optional<lsLocation> location;
|
|
|
|
NonElidedVector<TypeEntry> children;
|
|
|
|
};
|
|
|
|
lsRequestId id;
|
|
|
|
optional<TypeEntry> result;
|
|
|
|
};
|
2017-09-22 01:14:57 +00:00
|
|
|
MAKE_REFLECT_STRUCT(Out_CqueryTypeHierarchyTree::TypeEntry,
|
|
|
|
name,
|
|
|
|
location,
|
|
|
|
children);
|
2017-05-24 07:17:29 +00:00
|
|
|
MAKE_REFLECT_STRUCT(Out_CqueryTypeHierarchyTree, jsonrpc, id, result);
|
|
|
|
|
|
|
|
// Call Tree
|
2017-09-22 01:14:57 +00:00
|
|
|
struct Ipc_CqueryCallTreeInitial
|
|
|
|
: public IpcMessage<Ipc_CqueryCallTreeInitial> {
|
2017-05-24 07:17:29 +00:00
|
|
|
const static IpcId kIpcId = IpcId::CqueryCallTreeInitial;
|
|
|
|
lsRequestId id;
|
|
|
|
lsTextDocumentPositionParams params;
|
|
|
|
};
|
|
|
|
MAKE_REFLECT_STRUCT(Ipc_CqueryCallTreeInitial, id, params);
|
|
|
|
struct Ipc_CqueryCallTreeExpand : public IpcMessage<Ipc_CqueryCallTreeExpand> {
|
|
|
|
struct Params {
|
|
|
|
std::string usr;
|
|
|
|
};
|
|
|
|
const static IpcId kIpcId = IpcId::CqueryCallTreeExpand;
|
|
|
|
lsRequestId id;
|
|
|
|
Params params;
|
|
|
|
};
|
|
|
|
MAKE_REFLECT_STRUCT(Ipc_CqueryCallTreeExpand::Params, usr);
|
|
|
|
MAKE_REFLECT_STRUCT(Ipc_CqueryCallTreeExpand, id, params);
|
|
|
|
struct Out_CqueryCallTree : public lsOutMessage<Out_CqueryCallTree> {
|
2017-09-22 01:14:57 +00:00
|
|
|
enum class CallType { Direct = 0, Base = 1, Derived = 2 };
|
2017-05-24 07:17:29 +00:00
|
|
|
struct CallEntry {
|
|
|
|
std::string name;
|
|
|
|
std::string usr;
|
|
|
|
lsLocation location;
|
|
|
|
bool hasCallers = true;
|
2017-07-21 06:16:27 +00:00
|
|
|
CallType callType = CallType::Direct;
|
2017-05-24 07:17:29 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
lsRequestId id;
|
|
|
|
NonElidedVector<CallEntry> result;
|
|
|
|
};
|
2017-07-21 06:16:27 +00:00
|
|
|
MAKE_REFLECT_TYPE_PROXY(Out_CqueryCallTree::CallType, int);
|
2017-09-22 01:14:57 +00:00
|
|
|
MAKE_REFLECT_STRUCT(Out_CqueryCallTree::CallEntry,
|
|
|
|
name,
|
|
|
|
usr,
|
|
|
|
location,
|
|
|
|
hasCallers,
|
|
|
|
callType);
|
2017-05-24 07:17:29 +00:00
|
|
|
MAKE_REFLECT_STRUCT(Out_CqueryCallTree, jsonrpc, id, result);
|
2017-05-07 06:56:04 +00:00
|
|
|
|
|
|
|
// Vars, Callers, Derived, GotoParent
|
|
|
|
struct Ipc_CqueryVars : public IpcMessage<Ipc_CqueryVars> {
|
|
|
|
const static IpcId kIpcId = IpcId::CqueryVars;
|
|
|
|
lsRequestId id;
|
|
|
|
lsTextDocumentPositionParams params;
|
|
|
|
};
|
|
|
|
MAKE_REFLECT_STRUCT(Ipc_CqueryVars, id, params);
|
|
|
|
struct Ipc_CqueryCallers : public IpcMessage<Ipc_CqueryCallers> {
|
|
|
|
const static IpcId kIpcId = IpcId::CqueryCallers;
|
|
|
|
lsRequestId id;
|
|
|
|
lsTextDocumentPositionParams params;
|
|
|
|
};
|
|
|
|
struct Ipc_CqueryBase : public IpcMessage<Ipc_CqueryBase> {
|
|
|
|
const static IpcId kIpcId = IpcId::CqueryBase;
|
|
|
|
lsRequestId id;
|
|
|
|
lsTextDocumentPositionParams params;
|
|
|
|
};
|
|
|
|
MAKE_REFLECT_STRUCT(Ipc_CqueryBase, id, params);
|
|
|
|
MAKE_REFLECT_STRUCT(Ipc_CqueryCallers, id, params);
|
|
|
|
struct Ipc_CqueryDerived : public IpcMessage<Ipc_CqueryDerived> {
|
|
|
|
const static IpcId kIpcId = IpcId::CqueryDerived;
|
|
|
|
lsRequestId id;
|
|
|
|
lsTextDocumentPositionParams params;
|
|
|
|
};
|
|
|
|
MAKE_REFLECT_STRUCT(Ipc_CqueryDerived, id, params);
|
|
|
|
struct Out_LocationList : public lsOutMessage<Out_LocationList> {
|
|
|
|
lsRequestId id;
|
|
|
|
NonElidedVector<lsLocation> result;
|
|
|
|
};
|
2017-05-21 07:43:10 +00:00
|
|
|
MAKE_REFLECT_STRUCT(Out_LocationList, jsonrpc, id, result);
|