blob: 694527933bf97edc590b35d39acfafaa8062732b (
plain)
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
|
// Copyright (C) Filippo Cucchetto <filippocucchetto@gmail.com>
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
#pragma once
#include <utils/fileutils.h>
#include <QObject>
#include <unordered_map>
namespace Core { class IEditor; }
namespace Nim {
namespace Suggest {
class NimSuggest;
class NimSuggestCache : public QObject
{
Q_OBJECT
public:
static NimSuggestCache &instance();
NimSuggest *get(const Utils::FilePath &filename);
QString executablePath() const;
void setExecutablePath(const QString &path);
private:
NimSuggestCache();
~NimSuggestCache();
void onEditorOpened(Core::IEditor *editor);
void onEditorClosed(Core::IEditor *editor);
std::unordered_map<Utils::FilePath, std::unique_ptr<Suggest::NimSuggest>> m_nimSuggestInstances;
QString m_executablePath;
};
} // namespace Suggest
} // namespace Nim
|