forked from qt-creator/qt-creator
Nim: Add support for goto field under cursor
Change-Id: Ic0cce41d2c3d8dc9bcc9ccd07c3943fd0b2659f9 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -5,6 +5,7 @@ add_qtc_plugin(Nim
|
|||||||
editor/nimeditorfactory.cpp editor/nimeditorfactory.h
|
editor/nimeditorfactory.cpp editor/nimeditorfactory.h
|
||||||
editor/nimhighlighter.cpp editor/nimhighlighter.h
|
editor/nimhighlighter.cpp editor/nimhighlighter.h
|
||||||
editor/nimindenter.cpp editor/nimindenter.h
|
editor/nimindenter.cpp editor/nimindenter.h
|
||||||
|
editor/nimtexteditorwidget.cpp editor/nimtexteditorwidget.h
|
||||||
nim.qrc
|
nim.qrc
|
||||||
nimconstants.h
|
nimconstants.h
|
||||||
nimplugin.cpp nimplugin.h
|
nimplugin.cpp nimplugin.h
|
||||||
|
|||||||
@@ -119,12 +119,12 @@ private:
|
|||||||
std::unique_ptr<QTemporaryFile> dirtyFile = writeDirtyFile(interface);
|
std::unique_ptr<QTemporaryFile> dirtyFile = writeDirtyFile(interface);
|
||||||
QTC_ASSERT(dirtyFile, return);
|
QTC_ASSERT(dirtyFile, return);
|
||||||
|
|
||||||
std::shared_ptr<Suggest::SugRequest> request = sendRequest(interface,
|
std::shared_ptr<Suggest::NimSuggestClientRequest> request = sendRequest(interface,
|
||||||
suggest,
|
suggest,
|
||||||
dirtyFile->fileName(),
|
dirtyFile->fileName(),
|
||||||
pos);
|
pos);
|
||||||
QTC_ASSERT(request, return);
|
QTC_ASSERT(request, return);
|
||||||
connect(request.get(), &Suggest::SugRequest::finished, this,
|
connect(request.get(), &Suggest::NimSuggestClientRequest::finished, this,
|
||||||
&NimCompletionAssistProcessor::onRequestFinished);
|
&NimCompletionAssistProcessor::onRequestFinished);
|
||||||
|
|
||||||
m_pos = pos;
|
m_pos = pos;
|
||||||
@@ -162,10 +162,10 @@ private:
|
|||||||
return Nim::Suggest::NimSuggestCache::instance().get(filename);
|
return Nim::Suggest::NimSuggestCache::instance().get(filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::shared_ptr<Suggest::SugRequest> sendRequest(const AssistInterface *interface,
|
static std::shared_ptr<Suggest::NimSuggestClientRequest> sendRequest(const AssistInterface *interface,
|
||||||
Suggest::NimSuggest *suggest,
|
Suggest::NimSuggest *suggest,
|
||||||
QString dirtyFile,
|
QString dirtyFile,
|
||||||
int pos)
|
int pos)
|
||||||
{
|
{
|
||||||
int line = 0, column = 0;
|
int line = 0, column = 0;
|
||||||
Utils::Text::convertPosition(interface->textDocument(), pos, &line, &column);
|
Utils::Text::convertPosition(interface->textDocument(), pos, &line, &column);
|
||||||
@@ -256,7 +256,7 @@ private:
|
|||||||
bool m_running = false;
|
bool m_running = false;
|
||||||
int m_pos = -1;
|
int m_pos = -1;
|
||||||
std::weak_ptr<Suggest::NimSuggest> m_suggest;
|
std::weak_ptr<Suggest::NimSuggest> m_suggest;
|
||||||
std::shared_ptr<Suggest::SugRequest> m_request;
|
std::shared_ptr<Suggest::NimSuggestClientRequest> m_request;
|
||||||
std::unique_ptr<QTemporaryFile> m_dirtyFile;
|
std::unique_ptr<QTemporaryFile> m_dirtyFile;
|
||||||
const TextEditor::AssistInterface *m_interface = nullptr;
|
const TextEditor::AssistInterface *m_interface = nullptr;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -30,6 +30,7 @@
|
|||||||
|
|
||||||
#include "../nimconstants.h"
|
#include "../nimconstants.h"
|
||||||
#include "../nimplugin.h"
|
#include "../nimplugin.h"
|
||||||
|
#include "nimtexteditorwidget.h"
|
||||||
|
|
||||||
#include <texteditor/texteditoractionhandler.h>
|
#include <texteditor/texteditoractionhandler.h>
|
||||||
#include <texteditor/texteditorconstants.h>
|
#include <texteditor/texteditorconstants.h>
|
||||||
@@ -50,12 +51,10 @@ NimEditorFactory::NimEditorFactory()
|
|||||||
|
|
||||||
setEditorActionHandlers(TextEditorActionHandler::Format
|
setEditorActionHandlers(TextEditorActionHandler::Format
|
||||||
| TextEditorActionHandler::UnCommentSelection
|
| TextEditorActionHandler::UnCommentSelection
|
||||||
| TextEditorActionHandler::UnCollapseAll);
|
| TextEditorActionHandler::UnCollapseAll
|
||||||
|
| TextEditorActionHandler::FollowSymbolUnderCursor);
|
||||||
setEditorWidgetCreator([]{
|
setEditorWidgetCreator([]{
|
||||||
auto result = new TextEditorWidget();
|
return new NimTextEditorWidget();
|
||||||
result->setLanguageSettingsId(Nim::Constants::C_NIMLANGUAGE_ID);
|
|
||||||
return result;
|
|
||||||
});
|
});
|
||||||
setDocumentCreator([]() {
|
setDocumentCreator([]() {
|
||||||
return new TextDocument(Constants::C_NIMEDITOR_ID);
|
return new TextDocument(Constants::C_NIMEDITOR_ID);
|
||||||
|
|||||||
109
src/plugins/nim/editor/nimtexteditorwidget.cpp
Normal file
109
src/plugins/nim/editor/nimtexteditorwidget.cpp
Normal file
@@ -0,0 +1,109 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
**
|
||||||
|
** Copyright (C) Filippo Cucchetto <filippocucchetto@gmail.com>
|
||||||
|
** Contact: http://www.qt.io/licensing
|
||||||
|
**
|
||||||
|
** This file is part of Qt Creator.
|
||||||
|
**
|
||||||
|
** Commercial License Usage
|
||||||
|
** Licensees holding valid commercial Qt licenses may use this file in
|
||||||
|
** accordance with the commercial license agreement provided with the
|
||||||
|
** Software or, alternatively, in accordance with the terms contained in
|
||||||
|
** a written agreement between you and The Qt Company. For licensing terms
|
||||||
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||||
|
** information use the contact form at https://www.qt.io/contact-us.
|
||||||
|
**
|
||||||
|
** GNU General Public License Usage
|
||||||
|
** Alternatively, this file may be used under the terms of the GNU
|
||||||
|
** General Public License version 3 as published by the Free Software
|
||||||
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
||||||
|
** included in the packaging of this file. Please review the following
|
||||||
|
** information to ensure the GNU General Public License requirements will
|
||||||
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||||
|
**
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include "nimtexteditorwidget.h"
|
||||||
|
#include "nimconstants.h"
|
||||||
|
#include "suggest/nimsuggestcache.h"
|
||||||
|
#include "suggest/nimsuggest.h"
|
||||||
|
|
||||||
|
#include <texteditor/textdocument.h>
|
||||||
|
#include <texteditor/codeassist/assistinterface.h>
|
||||||
|
#include <utils/qtcassert.h>
|
||||||
|
#include <utils/textutils.h>
|
||||||
|
|
||||||
|
#include <QTextStream>
|
||||||
|
#include <QTemporaryFile>
|
||||||
|
#include <QTextDocument>
|
||||||
|
|
||||||
|
using namespace Nim;
|
||||||
|
using namespace Suggest;
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
std::unique_ptr<QTemporaryFile> writeDirtyFile(const TextEditor::TextDocument *doc)
|
||||||
|
{
|
||||||
|
auto result = std::make_unique<QTemporaryFile>("qtcnim.XXXXXX.nim");
|
||||||
|
QTC_ASSERT(result->open(), return nullptr);
|
||||||
|
QTextStream stream(result.get());
|
||||||
|
stream << doc->plainText();
|
||||||
|
result->close();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
NimTextEditorWidget::NimTextEditorWidget(QWidget *parent)
|
||||||
|
: TextEditorWidget(parent)
|
||||||
|
{
|
||||||
|
setLanguageSettingsId(Nim::Constants::C_NIMLANGUAGE_ID);
|
||||||
|
}
|
||||||
|
|
||||||
|
void NimTextEditorWidget::findLinkAt(const QTextCursor &c, Utils::ProcessLinkCallback &&processLinkCallback, bool /*resolveTarget*/, bool /*inNextSplit*/)
|
||||||
|
{
|
||||||
|
const Utils::FilePath &path = textDocument()->filePath();
|
||||||
|
|
||||||
|
NimSuggest *suggest = NimSuggestCache::instance().get(path);
|
||||||
|
if (!suggest)
|
||||||
|
return processLinkCallback(Utils::Link());
|
||||||
|
|
||||||
|
std::unique_ptr<QTemporaryFile> dirtyFile = writeDirtyFile(textDocument());
|
||||||
|
|
||||||
|
int line = 0, column = 0;
|
||||||
|
Utils::Text::convertPosition(document(), c.position(), &line, &column);
|
||||||
|
|
||||||
|
std::shared_ptr<NimSuggestClientRequest> request = suggest->def(path.toString(),
|
||||||
|
line,
|
||||||
|
column - 1,
|
||||||
|
dirtyFile->fileName());
|
||||||
|
|
||||||
|
if (!request)
|
||||||
|
return processLinkCallback(Utils::Link());
|
||||||
|
|
||||||
|
if (m_request) {
|
||||||
|
QObject::disconnect(m_request.get());
|
||||||
|
m_request = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_callback)
|
||||||
|
m_callback(Utils::Link());
|
||||||
|
|
||||||
|
m_dirtyFile = std::move(dirtyFile);
|
||||||
|
m_callback = std::move(processLinkCallback);
|
||||||
|
m_request = std::move(request);
|
||||||
|
|
||||||
|
QObject::connect(m_request.get(), &NimSuggestClientRequest::finished, this, &NimTextEditorWidget::onFindLinkFinished);
|
||||||
|
}
|
||||||
|
|
||||||
|
void NimTextEditorWidget::onFindLinkFinished()
|
||||||
|
{
|
||||||
|
QTC_ASSERT(m_request.get() == this->sender(), return);
|
||||||
|
if (m_request->lines().empty()) {
|
||||||
|
m_callback(Utils::Link());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const Line &line = m_request->lines().front();
|
||||||
|
m_callback(Utils::Link{line.abs_path, line.row, line.column});
|
||||||
|
}
|
||||||
49
src/plugins/nim/editor/nimtexteditorwidget.h
Normal file
49
src/plugins/nim/editor/nimtexteditorwidget.h
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
**
|
||||||
|
** Copyright (C) Filippo Cucchetto <filippocucchetto@gmail.com>
|
||||||
|
** Contact: http://www.qt.io/licensing
|
||||||
|
**
|
||||||
|
** This file is part of Qt Creator.
|
||||||
|
**
|
||||||
|
** Commercial License Usage
|
||||||
|
** Licensees holding valid commercial Qt licenses may use this file in
|
||||||
|
** accordance with the commercial license agreement provided with the
|
||||||
|
** Software or, alternatively, in accordance with the terms contained in
|
||||||
|
** a written agreement between you and The Qt Company. For licensing terms
|
||||||
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||||
|
** information use the contact form at https://www.qt.io/contact-us.
|
||||||
|
**
|
||||||
|
** GNU General Public License Usage
|
||||||
|
** Alternatively, this file may be used under the terms of the GNU
|
||||||
|
** General Public License version 3 as published by the Free Software
|
||||||
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
||||||
|
** included in the packaging of this file. Please review the following
|
||||||
|
** information to ensure the GNU General Public License requirements will
|
||||||
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||||
|
**
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <texteditor/texteditor.h>
|
||||||
|
|
||||||
|
namespace Nim {
|
||||||
|
namespace Suggest { class NimSuggestClientRequest; }
|
||||||
|
|
||||||
|
class NimTextEditorWidget : public TextEditor::TextEditorWidget
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
NimTextEditorWidget(QWidget* parent = nullptr);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void findLinkAt(const QTextCursor &, Utils::ProcessLinkCallback &&processLinkCallback, bool resolveTarget, bool inNextSplit);
|
||||||
|
|
||||||
|
private:
|
||||||
|
void onFindLinkFinished();
|
||||||
|
|
||||||
|
std::shared_ptr<Nim::Suggest::NimSuggestClientRequest> m_request;
|
||||||
|
Utils::ProcessLinkCallback m_callback;
|
||||||
|
std::unique_ptr<QTemporaryFile> m_dirtyFile;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
@@ -14,6 +14,7 @@ HEADERS += \
|
|||||||
editor/nimcompletionassistprovider.h \
|
editor/nimcompletionassistprovider.h \
|
||||||
editor/nimhighlighter.h \
|
editor/nimhighlighter.h \
|
||||||
editor/nimindenter.h \
|
editor/nimindenter.h \
|
||||||
|
editor/nimtexteditorwidget.h \
|
||||||
project/nimblebuildconfiguration.h \
|
project/nimblebuildconfiguration.h \
|
||||||
project/nimblebuildstep.h \
|
project/nimblebuildstep.h \
|
||||||
project/nimblebuildstepwidget.h \
|
project/nimblebuildstepwidget.h \
|
||||||
@@ -53,6 +54,7 @@ SOURCES += \
|
|||||||
editor/nimcompletionassistprovider.cpp \
|
editor/nimcompletionassistprovider.cpp \
|
||||||
editor/nimhighlighter.cpp \
|
editor/nimhighlighter.cpp \
|
||||||
editor/nimindenter.cpp \
|
editor/nimindenter.cpp \
|
||||||
|
editor/nimtexteditorwidget.cpp \
|
||||||
project/nimblebuildconfiguration.cpp \
|
project/nimblebuildconfiguration.cpp \
|
||||||
project/nimblebuildstep.cpp \
|
project/nimblebuildstep.cpp \
|
||||||
project/nimbletaskstep.cpp \
|
project/nimbletaskstep.cpp \
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ QtcPlugin {
|
|||||||
"nimeditorfactory.h", "nimeditorfactory.cpp",
|
"nimeditorfactory.h", "nimeditorfactory.cpp",
|
||||||
"nimhighlighter.h", "nimhighlighter.cpp",
|
"nimhighlighter.h", "nimhighlighter.cpp",
|
||||||
"nimindenter.h", "nimindenter.cpp",
|
"nimindenter.h", "nimindenter.cpp",
|
||||||
|
"nimtexteditorwidget.h", "nimtexteditorwidget.cpp",
|
||||||
"nimcompletionassistprovider.h", "nimcompletionassistprovider.cpp"
|
"nimcompletionassistprovider.h", "nimcompletionassistprovider.cpp"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,22 +53,38 @@ bool NimSuggestClient::disconnectFromServer()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<SugRequest> NimSuggestClient::sug(const QString &nimFile,
|
std::shared_ptr<NimSuggestClientRequest> NimSuggestClient::sug(const QString &nimFile,
|
||||||
int line, int column,
|
int line, int column,
|
||||||
const QString &dirtyFile)
|
const QString &dirtyFile)
|
||||||
|
{
|
||||||
|
return sendRequest(QLatin1String("sug"), nimFile, line, column, dirtyFile);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::shared_ptr<NimSuggestClientRequest> NimSuggestClient::def(const QString &nimFile,
|
||||||
|
int line, int column,
|
||||||
|
const QString &dirtyFile)
|
||||||
|
{
|
||||||
|
return sendRequest(QLatin1String("def"), nimFile, line, column, dirtyFile);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::shared_ptr<NimSuggestClientRequest> NimSuggestClient::sendRequest(const QString& type,
|
||||||
|
const QString &nimFile,
|
||||||
|
int line, int column,
|
||||||
|
const QString &dirtyFile)
|
||||||
{
|
{
|
||||||
if (!m_socket.isOpen())
|
if (!m_socket.isOpen())
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
auto result = std::make_shared<SugRequest>(m_lastMessageId++);
|
auto result = std::make_shared<NimSuggestClientRequest>(m_lastMessageId++);
|
||||||
m_requests.emplace(result->id(), result);
|
m_requests.emplace(result->id(), result);
|
||||||
|
|
||||||
QByteArray body = QString(R"((call %1 sug ("%2" %3 %4 "%5"))\n)")
|
QByteArray body = QString(R"((call %1 %2 ("%3" %4 %5 "%6"))\n)")
|
||||||
.arg(result->id())
|
.arg(result->id())
|
||||||
.arg(nimFile)
|
.arg(type)
|
||||||
.arg(line).arg(column)
|
.arg(nimFile)
|
||||||
.arg(dirtyFile)
|
.arg(line).arg(column)
|
||||||
.toUtf8();
|
.arg(dirtyFile)
|
||||||
|
.toUtf8();
|
||||||
|
|
||||||
QByteArray length = QString::number(body.size(), 16).rightJustified(6, '0').toUtf8();
|
QByteArray length = QString::number(body.size(), 16).rightJustified(6, '0').toUtf8();
|
||||||
QByteArray message = length + body;
|
QByteArray message = length + body;
|
||||||
@@ -135,7 +151,7 @@ void NimSuggestClient::parsePayload(const char *payload, std::size_t size)
|
|||||||
if (it == m_requests.end())
|
if (it == m_requests.end())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto req = std::dynamic_pointer_cast<SugRequest>((*it).second.lock());
|
auto req = std::dynamic_pointer_cast<NimSuggestClientRequest>((*it).second.lock());
|
||||||
if (!req)
|
if (!req)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|||||||
@@ -49,15 +49,24 @@ public:
|
|||||||
|
|
||||||
bool disconnectFromServer();
|
bool disconnectFromServer();
|
||||||
|
|
||||||
std::shared_ptr<SugRequest> sug(const QString &nimFile,
|
std::shared_ptr<NimSuggestClientRequest> sug(const QString &nimFile,
|
||||||
int line, int column,
|
int line, int column,
|
||||||
const QString &dirtyFile);
|
const QString &dirtyFile);
|
||||||
|
|
||||||
|
std::shared_ptr<NimSuggestClientRequest> def(const QString &nimFile,
|
||||||
|
int line, int column,
|
||||||
|
const QString &dirtyFile);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void connected();
|
void connected();
|
||||||
void disconnected();
|
void disconnected();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
std::shared_ptr<NimSuggestClientRequest> sendRequest(const QString &type,
|
||||||
|
const QString &nimFile,
|
||||||
|
int line, int column,
|
||||||
|
const QString &dirtyFile);
|
||||||
|
|
||||||
void clear();
|
void clear();
|
||||||
void onDisconnectedFromServer();
|
void onDisconnectedFromServer();
|
||||||
void onReadyRead();
|
void onReadyRead();
|
||||||
@@ -65,7 +74,7 @@ private:
|
|||||||
|
|
||||||
QTcpSocket m_socket;
|
QTcpSocket m_socket;
|
||||||
quint16 m_port;
|
quint16 m_port;
|
||||||
std::unordered_map<quint64, std::weak_ptr<BaseNimSuggestClientRequest>> m_requests;
|
std::unordered_map<quint64, std::weak_ptr<NimSuggestClientRequest>> m_requests;
|
||||||
std::vector<QString> m_lines;
|
std::vector<QString> m_lines;
|
||||||
std::vector<char> m_readBuffer;
|
std::vector<char> m_readBuffer;
|
||||||
quint64 m_lastMessageId = 0;
|
quint64 m_lastMessageId = 0;
|
||||||
|
|||||||
@@ -47,14 +47,10 @@ bool Line::fromString(Line::SymbolKind &type, const std::string &str)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
BaseNimSuggestClientRequest::BaseNimSuggestClientRequest(quint64 id)
|
NimSuggestClientRequest::NimSuggestClientRequest(quint64 id)
|
||||||
: m_id(id)
|
: m_id(id)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
quint64 BaseNimSuggestClientRequest::id() const
|
|
||||||
{
|
|
||||||
return m_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace Suggest
|
} // namespace Suggest
|
||||||
} // namespace Nim
|
} // namespace Nim
|
||||||
|
|||||||
@@ -93,26 +93,17 @@ public:
|
|||||||
QString doc;
|
QString doc;
|
||||||
};
|
};
|
||||||
|
|
||||||
class BaseNimSuggestClientRequest : public QObject
|
class NimSuggestClientRequest : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
BaseNimSuggestClientRequest(quint64 id);
|
NimSuggestClientRequest(quint64 id);
|
||||||
|
|
||||||
quint64 id() const;
|
quint64 id() const
|
||||||
|
{
|
||||||
signals:
|
return m_id;
|
||||||
void finished();
|
}
|
||||||
|
|
||||||
private:
|
|
||||||
const quint64 m_id;
|
|
||||||
};
|
|
||||||
|
|
||||||
class SugRequest : public BaseNimSuggestClientRequest
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
using BaseNimSuggestClientRequest::BaseNimSuggestClientRequest;
|
|
||||||
|
|
||||||
std::vector<Line> &lines()
|
std::vector<Line> &lines()
|
||||||
{
|
{
|
||||||
@@ -124,14 +115,19 @@ public:
|
|||||||
return m_lines;
|
return m_lines;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void finished();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class NimSuggestClient;
|
friend class NimSuggestClient;
|
||||||
|
|
||||||
void setFinished(std::vector<Line> lines)
|
void setFinished(std::vector<Line> lines)
|
||||||
{
|
{
|
||||||
m_lines = std::move(lines);
|
m_lines = std::move(lines);
|
||||||
emit finished();
|
emit finished();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const quint64 m_id;
|
||||||
std::vector<Line> m_lines;
|
std::vector<Line> m_lines;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -76,12 +76,17 @@ bool NimSuggest::isReady() const
|
|||||||
return m_ready;
|
return m_ready;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<SugRequest> NimSuggest::sug(const QString &filename, int line, int column,
|
std::shared_ptr<NimSuggestClientRequest> NimSuggest::sug(const QString &filename, int line, int column,
|
||||||
const QString &dirtyFilename)
|
const QString &dirtyFilename)
|
||||||
{
|
{
|
||||||
return m_ready ? m_client.sug(filename, line, column, dirtyFilename) : nullptr;
|
return m_ready ? m_client.sug(filename, line, column, dirtyFilename) : nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::shared_ptr<NimSuggestClientRequest> NimSuggest::def(const QString &filename, int line, int column, const QString &dirtyFilename)
|
||||||
|
{
|
||||||
|
return m_ready ? m_client.def(filename, line, column, dirtyFilename) : nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
void NimSuggest::restart()
|
void NimSuggest::restart()
|
||||||
{
|
{
|
||||||
disconnectClient();
|
disconnectClient();
|
||||||
|
|||||||
@@ -46,8 +46,11 @@ public:
|
|||||||
|
|
||||||
bool isReady() const;
|
bool isReady() const;
|
||||||
|
|
||||||
std::shared_ptr<SugRequest> sug(const QString &filename, int line, int column,
|
std::shared_ptr<NimSuggestClientRequest> sug(const QString &filename, int line, int column,
|
||||||
const QString &dirtyFilename);
|
const QString &dirtyFilename);
|
||||||
|
|
||||||
|
std::shared_ptr<NimSuggestClientRequest> def(const QString &filename, int line, int column,
|
||||||
|
const QString &dirtyFilename);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void readyChanged(bool ready);
|
void readyChanged(bool ready);
|
||||||
|
|||||||
Reference in New Issue
Block a user