forked from alpha0010/ClangLib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
clangplugin.h
69 lines (58 loc) · 2.76 KB
/
clangplugin.h
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
#ifndef CLANGPLUGIN_H
#define CLANGPLUGIN_H
#include <cbplugin.h>
#include <wx/imaglist.h>
#include <wx/timer.h>
#include "clangproxy.h"
#include "tokendatabase.h"
class ClangPlugin : public cbCodeCompletionPlugin
{
public:
ClangPlugin();
virtual ~ClangPlugin();
// Does this plugin handle code completion for the editor ed?
virtual CCProviderStatus GetProviderStatusFor(cbEditor* ed);
// Supply content for the autocompletion list.
virtual std::vector<CCToken> GetAutocompList(bool isAuto, cbEditor* ed, int& tknStart, int& tknEnd);
// Supply html formatted documentation for the passed token.
virtual wxString GetDocumentation(const CCToken& token);
// Supply content for the calltip at the specified location.
virtual std::vector<CCCallTip> GetCallTips(int pos, int style, cbEditor* ed, int& argsPos);
// Supply the definition of the token at the specified location.
virtual std::vector<CCToken> GetTokenAt(int pos, cbEditor* ed, bool& allowCallTip);
// Handle documentation link event.
virtual wxString OnDocumentationLink(wxHtmlLinkEvent& event, bool& dismissPopup);
// Callback for inserting the selected autocomplete entry into the editor.
virtual void DoAutocomplete(const CCToken& token, cbEditor* ed);
virtual void BuildMenu(wxMenuBar* menuBar);
virtual void BuildModuleMenu(const ModuleType type, wxMenu* menu, const FileTreeData* data = nullptr);
protected:
virtual void OnAttach();
virtual void OnRelease(bool appShutDown);
private:
wxString GetCompilerInclDirs(const wxString& compId);
wxString GetSourceOf(cbEditor* ed);
wxFileName FindSourceIn(const wxArrayString& candidateFilesArray, const wxFileName& activeFile, bool& isCandidate);
bool IsSourceOf(const wxFileName& candidateFile, const wxFileName& activeFile, bool& isCandidate);
void OnEditorOpen(CodeBlocksEvent& event);
void OnEditorActivate(CodeBlocksEvent& event);
void OnTimer(wxTimerEvent& event);
void OnEditorHook(cbEditor* ed, wxScintillaEvent& event);
void OnGotoDeclaration(wxCommandEvent& event);
enum DiagnosticLevel { dlMinimal, dlFull };
void DiagnoseEd(cbEditor* ed, DiagnosticLevel diagLv);
TokenDatabase m_Database;
wxStringVec m_CppKeywords;
ClangProxy m_Proxy;
wxImageList m_ImageList;
wxTimer m_EdOpenTimer;
wxTimer m_ReparseTimer;
wxTimer m_DiagnosticTimer;
std::map<wxString, wxString> m_compInclDirs;
cbEditor* m_pLastEditor;
int m_TranslUnitId;
int m_EditorHookId;
int m_LastCallTipPos;
std::vector<wxStringVec> m_LastCallTips;
};
#endif // CLANGPLUGIN_H