-
Notifications
You must be signed in to change notification settings - Fork 71
Expand file tree
/
Copy pathDefinition.h
More file actions
107 lines (80 loc) · 2.41 KB
/
Definition.h
File metadata and controls
107 lines (80 loc) · 2.41 KB
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
#pragma once
#include <vector>
#include <cstdint>
#include "AST/SourceCode.h"
#include "llvm/ADT/StringRef.h"
namespace clice {
struct CompilationParams;
namespace config {
struct DefinitionOption {
/// Insert placeholder for keywords? function call parameters? template arguments?
bool enable_keyword_snippet = false;
/// Also apply for lambda ...
bool enable_function_arguments_snippet = false;
bool enable_template_arguments_snippet = false;
bool insert_paren_in_function_call = false;
/// TODO: Add more detailed option, see
/// https://github.com/llvm/llvm-project/issues/63565
bool bundle_overloads = true;
/// The limits of code completion, 0 is non limit.
std::uint32_t limit = 0;
};
}; // namespace config
namespace feature {
enum class CompletionItemKind {
None = 0,
Text,
Method,
Function,
Constructor,
Field,
Variable,
Class,
Interface,
Module,
Property,
Unit,
Value,
Enum,
Keyword,
Snippet,
Color,
File,
Reference,
Folder,
EnumMember,
Constant,
Struct,
Event,
Operator,
TypeParameter
};
/// Represents a single code completion item to be presented to the user.
struct CompletionItem {
/// The primary label displayed in the completion list.
std::string label;
/// Additional details, like a function signature, shown next to the label.
std::string detail;
/// A short description of the item, typically its type or namespace.
std::string description;
/// Full documentation for the item, shown on selection or hover.
std::string document;
/// The kind of item (function, class, etc.), used for an icon.
CompletionItemKind kind;
/// A score for ranking this item against others. Higher is better.
float score;
/// Whether this item is deprecated (often rendered with a strikethrough).
bool deprecated;
/// The text edit to be applied when this item is accepted.
struct Edit {
/// The new text to insert, which may be a snippet.
std::string text;
/// The source range to be replaced by the new text.
LocalSourceRange range;
} edit;
};
using CodeCompletionResult = std::vector<CompletionItem>;
std::vector<CompletionItem> definition(CompilationParams& params,
const config::DefinitionOption& option);
} // namespace feature
} // namespace clice