blob: aa41e6af5af57c11902023b7ee838377ee857948 (
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
|
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
#include "textmodifier.h"
#include <qmljs/qmljsmodelmanagerinterface.h>
#include <utils/textutils.h>
using namespace QmlDesigner;
TextModifier::~TextModifier() = default;
int TextModifier::getLineInDocument(QTextDocument *document, int offset)
{
int line = -1;
int column = -1;
Utils::Text::convertPosition(document, offset, &line, &column);
return line;
}
QmlJS::Snapshot TextModifier::qmljsSnapshot()
{
QmlJS::ModelManagerInterface *modelManager = QmlJS::ModelManagerInterface::instance();
if (modelManager)
return modelManager->snapshot();
else
return QmlJS::Snapshot();
}
|