forked from qt-creator/qt-creator
Removed unused code.
This commit is contained in:
@@ -90,18 +90,6 @@ int QmlCodeCompletion::startCompletion(TextEditor::ITextEditable *editor)
|
|||||||
m_startPosition = pos;
|
m_startPosition = pos;
|
||||||
m_completions.clear();
|
m_completions.clear();
|
||||||
|
|
||||||
// foreach (const QString &word, edit->keywords()) {
|
|
||||||
// TextEditor::CompletionItem item(this);
|
|
||||||
// item.m_text = word;
|
|
||||||
// m_completions.append(item);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// foreach (const QString &word, edit->words()) {
|
|
||||||
// TextEditor::CompletionItem item(this);
|
|
||||||
// item.m_text = word;
|
|
||||||
// m_completions.append(item);
|
|
||||||
// }
|
|
||||||
|
|
||||||
QmlDocument::Ptr qmlDocument = edit->qmlDocument();
|
QmlDocument::Ptr qmlDocument = edit->qmlDocument();
|
||||||
// qDebug() << "*** document:" << qmlDocument;
|
// qDebug() << "*** document:" << qmlDocument;
|
||||||
if (qmlDocument.isNull())
|
if (qmlDocument.isNull())
|
||||||
|
@@ -77,101 +77,6 @@ using namespace SharedTools;
|
|||||||
namespace QmlEditor {
|
namespace QmlEditor {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class FindWords: protected Visitor
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
QStringList operator()(AST::Node *node)
|
|
||||||
{
|
|
||||||
_words.clear();
|
|
||||||
accept(node);
|
|
||||||
return QStringList(_words.toList());
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
|
||||||
void accept(AST::Node *node)
|
|
||||||
{ AST::Node::acceptChild(node, this); }
|
|
||||||
|
|
||||||
using Visitor::visit;
|
|
||||||
using Visitor::endVisit;
|
|
||||||
|
|
||||||
void addWords(AST::UiQualifiedId *id)
|
|
||||||
{
|
|
||||||
for (; id; id = id->next) {
|
|
||||||
if (id->name)
|
|
||||||
_words.insert(id->name->asString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual bool visit(AST::UiPublicMember *node)
|
|
||||||
{
|
|
||||||
if (node->name)
|
|
||||||
_words.insert(node->name->asString());
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual bool visit(AST::UiQualifiedId *node)
|
|
||||||
{
|
|
||||||
if (node->name)
|
|
||||||
_words.insert(node->name->asString());
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual bool visit(AST::IdentifierExpression *node)
|
|
||||||
{
|
|
||||||
if (node->name)
|
|
||||||
_words.insert(node->name->asString());
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual bool visit(AST::FieldMemberExpression *node)
|
|
||||||
{
|
|
||||||
if (node->name)
|
|
||||||
_words.insert(node->name->asString());
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual bool visit(AST::FunctionExpression *node)
|
|
||||||
{
|
|
||||||
if (node->name)
|
|
||||||
_words.insert(node->name->asString());
|
|
||||||
|
|
||||||
for (AST::FormalParameterList *it = node->formals; it; it = it->next) {
|
|
||||||
if (it->name)
|
|
||||||
_words.insert(it->name->asString());
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual bool visit(AST::FunctionDeclaration *node)
|
|
||||||
{
|
|
||||||
if (node->name)
|
|
||||||
_words.insert(node->name->asString());
|
|
||||||
|
|
||||||
for (AST::FormalParameterList *it = node->formals; it; it = it->next) {
|
|
||||||
if (it->name)
|
|
||||||
_words.insert(it->name->asString());
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual bool visit(AST::VariableDeclaration *node)
|
|
||||||
{
|
|
||||||
if (node->name)
|
|
||||||
_words.insert(node->name->asString());
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
QSet<QString> _words;
|
|
||||||
};
|
|
||||||
|
|
||||||
class FindIdDeclarations: protected Visitor
|
class FindIdDeclarations: protected Visitor
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -415,9 +320,6 @@ ScriptEditor::~ScriptEditor()
|
|||||||
QList<Declaration> ScriptEditor::declarations() const
|
QList<Declaration> ScriptEditor::declarations() const
|
||||||
{ return m_declarations; }
|
{ return m_declarations; }
|
||||||
|
|
||||||
QStringList ScriptEditor::words() const
|
|
||||||
{ return m_words; }
|
|
||||||
|
|
||||||
Core::IEditor *ScriptEditorEditable::duplicate(QWidget *parent)
|
Core::IEditor *ScriptEditorEditable::duplicate(QWidget *parent)
|
||||||
{
|
{
|
||||||
ScriptEditor *newEditor = new ScriptEditor(parent);
|
ScriptEditor *newEditor = new ScriptEditor(parent);
|
||||||
@@ -466,9 +368,6 @@ void ScriptEditor::onDocumentUpdated(QmlEditor::QmlDocument::Ptr doc)
|
|||||||
FindDeclarations findDeclarations;
|
FindDeclarations findDeclarations;
|
||||||
m_declarations = findDeclarations(doc->program());
|
m_declarations = findDeclarations(doc->program());
|
||||||
|
|
||||||
FindWords findWords;
|
|
||||||
m_words = findWords(doc->program());
|
|
||||||
|
|
||||||
QStringList items;
|
QStringList items;
|
||||||
items.append(tr("<Select Symbol>"));
|
items.append(tr("<Select Symbol>"));
|
||||||
|
|
||||||
|
@@ -101,7 +101,6 @@ public:
|
|||||||
~ScriptEditor();
|
~ScriptEditor();
|
||||||
|
|
||||||
QList<Declaration> declarations() const;
|
QList<Declaration> declarations() const;
|
||||||
QStringList words() const;
|
|
||||||
QStringList keywords() const;
|
QStringList keywords() const;
|
||||||
|
|
||||||
QList<QmlJS::DiagnosticMessage> diagnosticMessages() const
|
QList<QmlJS::DiagnosticMessage> diagnosticMessages() const
|
||||||
@@ -145,7 +144,6 @@ private:
|
|||||||
QTimer *m_updateDocumentTimer;
|
QTimer *m_updateDocumentTimer;
|
||||||
QComboBox *m_methodCombo;
|
QComboBox *m_methodCombo;
|
||||||
QList<Declaration> m_declarations;
|
QList<Declaration> m_declarations;
|
||||||
QStringList m_words;
|
|
||||||
QMap<QString, QList<QmlJS::AST::SourceLocation> > m_ids; // ### use QMultiMap
|
QMap<QString, QList<QmlJS::AST::SourceLocation> > m_ids; // ### use QMultiMap
|
||||||
QList<QmlJS::DiagnosticMessage> m_diagnosticMessages;
|
QList<QmlJS::DiagnosticMessage> m_diagnosticMessages;
|
||||||
QmlDocument::Ptr m_document;
|
QmlDocument::Ptr m_document;
|
||||||
|
Reference in New Issue
Block a user