forked from qt-creator/qt-creator
Merge remote-tracking branch 'origin/qds/dev'
Change-Id: Id242ab4ca485527defdcc1555d204e12e50ddb7a
This commit is contained in:
@@ -136,6 +136,18 @@ Document::Ptr QmlJSRefactoringFile::qmljsDocument() const
|
||||
return m_qmljsDocument;
|
||||
}
|
||||
|
||||
QString QmlJSRefactoringFile::qmlImports() const
|
||||
{
|
||||
QString imports;
|
||||
QmlJS::AST::UiProgram *prog = qmljsDocument()->qmlProgram();
|
||||
if (prog && prog->headers) {
|
||||
const unsigned int start = startOf(prog->headers->firstSourceLocation());
|
||||
const unsigned int end = startOf(prog->members->member->firstSourceLocation());
|
||||
imports = textOf(start, end);
|
||||
}
|
||||
return imports;
|
||||
}
|
||||
|
||||
unsigned QmlJSRefactoringFile::startOf(const SourceLocation &loc) const
|
||||
{
|
||||
return position(loc.startLine, loc.startColumn);
|
||||
|
||||
@@ -22,6 +22,7 @@ class QMLJSTOOLS_EXPORT QmlJSRefactoringFile: public TextEditor::RefactoringFile
|
||||
{
|
||||
public:
|
||||
QmlJS::Document::Ptr qmljsDocument() const;
|
||||
QString qmlImports() const;
|
||||
|
||||
/*!
|
||||
Returns the offset in the document for the start position of the given
|
||||
|
||||
Reference in New Issue
Block a user