mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-22 15:45:08 +00:00
Filter out inside-out syntax and array types for variable hover
This commit is contained in:
parent
bf9150f58a
commit
dd84a85b75
@ -437,6 +437,15 @@ void SetVarDetail(IndexVar* var,
|
||||
} else {
|
||||
def.detailed_name = std::move(type_name);
|
||||
ConcatTypeAndName(def.detailed_name, qualified_name);
|
||||
// The following check is used to skip inside-out syntax and array types
|
||||
// which we can't display well.
|
||||
// For other types, append the textual initializer, bit field, constructor
|
||||
// or whatever.
|
||||
CXType deref = cx_type, next;
|
||||
while ((next = clang_getPointeeType(deref)).kind != CXType_Invalid)
|
||||
deref = next;
|
||||
if (clang_getResultType(deref).kind == CXType_Invalid &&
|
||||
clang_getElementType(deref).kind == CXType_Invalid) {
|
||||
const FileContents& fc = param->file_contents[db->path];
|
||||
optional<int> spell_end = fc.ToOffset(cursor.get_spelling_range().end);
|
||||
optional<int> extent_end = fc.ToOffset(cursor.get_extent().end);
|
||||
@ -444,6 +453,7 @@ void SetVarDetail(IndexVar* var,
|
||||
def.hover = def.detailed_name +
|
||||
fc.content.substr(*spell_end, *extent_end - *spell_end);
|
||||
}
|
||||
}
|
||||
|
||||
if (is_first_seen) {
|
||||
optional<IndexTypeId> var_type = ResolveToDeclarationType(db, cursor);
|
||||
|
Loading…
Reference in New Issue
Block a user