2018-01-17 01:48:22 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "serializer.h"
|
|
|
|
|
2018-02-13 01:15:19 +00:00
|
|
|
// The order matters. In FindSymbolsAtLocation, we want Var/Func ordered in
|
|
|
|
// front of others.
|
|
|
|
enum class SymbolKind : uint8_t { Invalid, File, Type, Func, Var };
|
|
|
|
MAKE_REFLECT_TYPE_PROXY(SymbolKind);
|
|
|
|
MAKE_ENUM_HASHABLE(SymbolKind);
|
2018-01-17 01:48:22 +00:00
|
|
|
|
2018-01-26 17:28:29 +00:00
|
|
|
// clang/Basic/Specifiers.h clang::StorageClass
|
2018-01-28 04:25:14 +00:00
|
|
|
enum class StorageClass : uint8_t {
|
2018-01-26 17:28:29 +00:00
|
|
|
// In |CX_StorageClass| but not in |clang::StorageClass|
|
2018-01-28 04:25:14 +00:00
|
|
|
// e.g. non-type template parameters
|
|
|
|
Invalid,
|
2018-01-26 17:28:29 +00:00
|
|
|
|
|
|
|
// These are legal on both functions and variables.
|
2018-01-28 04:25:14 +00:00
|
|
|
// e.g. global functions/variables, local variables
|
|
|
|
None,
|
|
|
|
Extern,
|
|
|
|
Static,
|
|
|
|
// e.g. |__private_extern__ int a;|
|
|
|
|
PrivateExtern,
|
2018-01-26 17:28:29 +00:00
|
|
|
|
|
|
|
// These are only legal on variables.
|
2018-01-28 04:25:14 +00:00
|
|
|
// e.g. explicit |auto int a;|
|
|
|
|
Auto,
|
|
|
|
Register
|
2018-01-26 17:28:29 +00:00
|
|
|
};
|
2018-01-30 00:35:01 +00:00
|
|
|
MAKE_REFLECT_TYPE_PROXY(StorageClass);
|
2018-01-29 04:39:41 +00:00
|
|
|
|
2018-02-12 18:15:43 +00:00
|
|
|
enum class Role : uint16_t {
|
2018-02-08 02:29:34 +00:00
|
|
|
None = 0,
|
2018-01-29 04:39:41 +00:00
|
|
|
Declaration = 1 << 0,
|
|
|
|
Definition = 1 << 1,
|
|
|
|
Reference = 1 << 2,
|
2018-02-12 18:15:43 +00:00
|
|
|
Read = 1 << 3,
|
|
|
|
Write = 1 << 4,
|
|
|
|
Call = 1 << 5,
|
|
|
|
Dynamic = 1 << 6,
|
|
|
|
Address = 1 << 7,
|
|
|
|
Implicit = 1 << 8,
|
2018-02-22 21:50:46 +00:00
|
|
|
All = (1 << 9) - 1,
|
2018-01-29 04:39:41 +00:00
|
|
|
};
|
2018-02-11 04:01:10 +00:00
|
|
|
MAKE_REFLECT_TYPE_PROXY(Role);
|
|
|
|
MAKE_ENUM_HASHABLE(Role);
|
2018-01-29 04:39:41 +00:00
|
|
|
|
2018-02-12 18:15:43 +00:00
|
|
|
inline uint16_t operator&(Role lhs, Role rhs) {
|
|
|
|
return uint16_t(lhs) & uint16_t(rhs);
|
2018-01-29 04:39:41 +00:00
|
|
|
}
|
|
|
|
|
2018-02-11 04:01:10 +00:00
|
|
|
inline Role operator|(Role lhs, Role rhs) {
|
2018-02-12 18:15:43 +00:00
|
|
|
return Role(uint16_t(lhs) | uint16_t(rhs));
|
2018-01-29 04:39:41 +00:00
|
|
|
}
|
2018-02-13 01:15:19 +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);
|
|
|
|
|
|
|
|
// 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 {
|
|
|
|
// The range this highlight applies to.
|
|
|
|
lsRange range;
|
|
|
|
|
|
|
|
// The highlight kind, default is DocumentHighlightKind.Text.
|
|
|
|
lsDocumentHighlightKind kind = lsDocumentHighlightKind::Text;
|
|
|
|
|
|
|
|
// cquery extension
|
|
|
|
Role role = Role::None;
|
|
|
|
};
|
|
|
|
MAKE_REFLECT_STRUCT(lsDocumentHighlight, range, kind, role);
|
|
|
|
|
2018-02-18 19:29:38 +00:00
|
|
|
enum class lsSymbolKind : uint8_t {
|
|
|
|
Unknown = 0,
|
|
|
|
|
2018-02-13 01:15:19 +00:00
|
|
|
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,
|
2018-02-13 19:12:08 +00:00
|
|
|
Array = 18,
|
|
|
|
Object = 19,
|
|
|
|
Key = 20,
|
|
|
|
Null = 21,
|
|
|
|
EnumMember = 22,
|
|
|
|
Struct = 23,
|
|
|
|
Event = 24,
|
|
|
|
Operator = 25,
|
|
|
|
TypeParameter = 26,
|
2018-02-18 19:29:38 +00:00
|
|
|
|
|
|
|
// cquery extensions
|
2018-02-22 07:34:32 +00:00
|
|
|
// See also https://github.com/Microsoft/language-server-protocol/issues/344
|
|
|
|
// for new SymbolKind clang/Index/IndexSymbol.h clang::index::SymbolKind
|
2018-02-18 19:29:38 +00:00
|
|
|
Parameter = 13,
|
2018-02-19 03:01:22 +00:00
|
|
|
StaticMethod = 254,
|
2018-02-18 19:29:38 +00:00
|
|
|
Macro = 255,
|
2018-02-13 01:15:19 +00:00
|
|
|
};
|
|
|
|
MAKE_REFLECT_TYPE_PROXY(lsSymbolKind);
|
|
|
|
|
|
|
|
struct lsSymbolInformation {
|
|
|
|
std::string_view name;
|
|
|
|
lsSymbolKind kind;
|
|
|
|
lsLocation location;
|
|
|
|
std::string_view containerName;
|
|
|
|
};
|
|
|
|
MAKE_REFLECT_STRUCT(lsSymbolInformation, name, kind, location, containerName);
|