forked from neikeq/gd-autocomplete-service
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathcode_completion_service.h
More file actions
52 lines (40 loc) · 1.1 KB
/
Copy pathcode_completion_service.h
File metadata and controls
52 lines (40 loc) · 1.1 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
/* code_completion_service.h */
#ifndef CODE_COMPLETION_SERVICE_H
#define CODE_COMPLETION_SERVICE_H
#include "scene/main/node.h"
class CodeCompletionService : public Node {
GDCLASS(CodeCompletionService, Node);
public:
struct Request {
String script_path;
bool has_script_text;
String script_text;
int row;
int column;
Request() {
has_script_text = false;
row = 0;
column = 0;
}
};
struct Result {
bool valid;
String prefix;
String hint;
Vector<String> suggestions;
Result(bool p_valid=false) {
valid = p_valid;
}
};
Result obtain_suggestions(const Request& p_request);
CodeCompletionService();
~CodeCompletionService();
private:
Set<String> completion_prefixes;
List<StringName> type_keywords;
List<String> language_keywords;
Node* _find_node_for_script(Node* p_base, Node* p_current, const Ref<Script>& p_script);
String _get_text_for_completion(const Request& p_request, String& r_text);
String _filter_completion_candidates(int p_col, const String& p_line, const List<String>& p_options, Vector<String> &r_suggestions);
};
#endif // CODE_COMPLETION_SERVICE_H