1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151
|
#pragma once
#include "lsRange.h"
#include "lsTextEdit.h"
#include "lsDocumentUri.h"
#include "lsResponseError.h"
#include "location_type.h"
#include "LibLsp/JsonRpc/RequestInMessage.h"
#include "LibLsp/JsonRpc/lsResponseMessage.h"
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);
/**
* The diagnostic tags.
*
* @since 3.15.0
*/
enum class DiagnosticTag :uint8_t {
/**
* Unused or unnecessary code.
*
* Clients are allowed to render diagnostics with this tag faded out instead of having
* an error squiggle.
*/
Unnecessary=(1),
/**
* Deprecated or obsolete code.
*
* Clients are allowed to rendered diagnostics with this tag strike through.
*/
Deprecated=(2),
};
MAKE_REFLECT_TYPE_PROXY(DiagnosticTag);
/**
* Represents a related message and source code location for a diagnostic. This should be
* used to point to code locations that cause or related to a diagnostics, e.g when duplicating
* a symbol in a scope.
*
* Since 3.7.0
*/
struct DiagnosticRelatedInformation {
/**
* The location of this related diagnostic information.
*/
lsLocation location;
/**
* The message of this related diagnostic information.
*/
std::string message;
MAKE_SWAP_METHOD(DiagnosticRelatedInformation, location, message)
};
MAKE_REFLECT_STRUCT(DiagnosticRelatedInformation, location, message)
/**
* Structure to capture a description for an error code.
*
* @since 3.16.0
*/
struct DiagnosticCodeDescription {
/**
* An URI to open with more information about the diagnostic error.
*/
std::string href;
MAKE_SWAP_METHOD(DiagnosticCodeDescription, href)
};
MAKE_REFLECT_STRUCT(DiagnosticCodeDescription, href)
//Represents a diagnostic, such as a compiler error or warning.Diagnostic objects are only valid in the scope of a resource.
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.
boost::optional<lsDiagnosticSeverity> severity;
// The diagnostic's code. Can be omitted.
boost::optional< std::pair<boost::optional<std::string>, boost::optional<int>> > code;
boost::optional<DiagnosticCodeDescription> codeDescription;
// A human-readable string describing the source of this
// diagnostic, e.g. 'typescript' or 'super lint'.
boost::optional < std::string >source ;
// The diagnostic's message.
std::string message;
// Non-serialized set of fixits.
std::vector<lsTextEdit> fixits_;
/**
* Additional metadata about the diagnostic.
*
* @since 3.15.0
*/
boost::optional<std::vector<DiagnosticTag>> tags;
/**
* An array of related diagnostic information, e.g. when symbol-names within a scope collide
* all definitions can be marked via this property.
*
* Since 3.7.0
*/
boost::optional<std::vector<DiagnosticRelatedInformation>> relatedInformation;
/**
* A data entry field that is preserved between a
* `textDocument/publishDiagnostics` notification and
* `textDocument/codeAction` request.
*
* @since 3.16.0
*/
boost::optional<lsp::Any> data;
bool operator==(const lsDiagnostic& rhs) const;
bool operator!=(const lsDiagnostic& rhs) const;
MAKE_SWAP_METHOD(lsDiagnostic, range, severity, code, codeDescription, source, message, tags, data)
};
MAKE_REFLECT_STRUCT(lsDiagnostic, range, severity, code, codeDescription, source, message, tags, data)
struct Rsp_Error : ResponseError<lsResponseError, Rsp_Error> {
MAKE_SWAP_METHOD(Rsp_Error, jsonrpc, id, error)
};
MAKE_REFLECT_STRUCT(Rsp_Error, jsonrpc, id, error)
|