mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-30 11:27:07 +00:00
70 lines
1.8 KiB
C++
70 lines
1.8 KiB
C++
// Copyright 2017-2018 ccls Authors
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
#pragma once
|
|
|
|
#include "lsp.h"
|
|
#include "serializer.h"
|
|
|
|
// 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);
|
|
|
|
enum class Role : uint16_t {
|
|
None = 0,
|
|
Declaration = 1 << 0,
|
|
Definition = 1 << 1,
|
|
Reference = 1 << 2,
|
|
Read = 1 << 3,
|
|
Write = 1 << 4,
|
|
Call = 1 << 5,
|
|
Dynamic = 1 << 6,
|
|
Address = 1 << 7,
|
|
Implicit = 1 << 8,
|
|
All = (1 << 9) - 1,
|
|
};
|
|
MAKE_REFLECT_TYPE_PROXY(Role);
|
|
|
|
inline uint16_t operator&(Role lhs, Role rhs) {
|
|
return uint16_t(lhs) & uint16_t(rhs);
|
|
}
|
|
|
|
inline Role operator|(Role lhs, Role rhs) {
|
|
return Role(uint16_t(lhs) | uint16_t(rhs));
|
|
}
|
|
|
|
// 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;
|
|
|
|
// ccls extension
|
|
Role role = Role::None;
|
|
};
|
|
MAKE_REFLECT_STRUCT(lsDocumentHighlight, range, kind, role);
|
|
|
|
struct lsSymbolInformation {
|
|
std::string_view name;
|
|
lsSymbolKind kind;
|
|
lsLocation location;
|
|
std::string_view containerName;
|
|
};
|
|
MAKE_REFLECT_STRUCT(lsSymbolInformation, name, kind, location, containerName);
|