TODO plugin: Add file patterns to exclude from parsing

Additional list of regular expressions added to TODO plugin settings
to allow set patterns to be excluded from file list to parse by this plugin.

Change-Id: I718f111ac7592557a6aa86865283468c53d58078
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
This commit is contained in:
Denis Kormalev
2015-05-18 22:47:20 +03:00
parent 4f5a02d596
commit a429ef3d50
19 changed files with 455 additions and 95 deletions

View File

@@ -44,19 +44,22 @@ QmlJsTodoItemsScanner::QmlJsTodoItemsScanner(const KeywordList &keywordList, QOb
QmlJS::ModelManagerInterface *model = QmlJS::ModelManagerInterface::instance();
connect(model, &QmlJS::ModelManagerInterface::documentUpdated,
this, &QmlJsTodoItemsScanner::documentUpdated, Qt::DirectConnection);
setParams(keywordList);
}
bool QmlJsTodoItemsScanner::shouldProcessFile(const QString &fileName)
{
QmlJS::ModelManagerInterface *modelManager = QmlJS::ModelManagerInterface::instance();
foreach (const QmlJS::ModelManagerInterface::ProjectInfo &info, modelManager->projectInfos())
foreach (const QmlJS::ModelManagerInterface::ProjectInfo &info, modelManager->projectInfos()) {
if (info.sourceFiles.contains(fileName))
return true;
}
return false;
}
void QmlJsTodoItemsScanner::keywordListChanged()
void QmlJsTodoItemsScanner::scannerParamsChanged()
{
// We need to rescan everything known to the code model
// TODO: It would be nice to only tokenize the source files, not update the code model entirely.
@@ -81,7 +84,6 @@ void QmlJsTodoItemsScanner::processDocument(QmlJS::Document::Ptr doc)
QList<TodoItem> itemList;
foreach (const QmlJS::AST::SourceLocation &sourceLocation, doc->engine()->comments()) {
QString source = doc->source().mid(sourceLocation.begin(), sourceLocation.length).trimmed();
// Process every line