summaryrefslogtreecommitdiff
path: root/src/plugins/coreplugin/locator/filesystemfilter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/coreplugin/locator/filesystemfilter.cpp')
-rw-r--r--src/plugins/coreplugin/locator/filesystemfilter.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/plugins/coreplugin/locator/filesystemfilter.cpp b/src/plugins/coreplugin/locator/filesystemfilter.cpp
index 118ebb2532..47c9be47c6 100644
--- a/src/plugins/coreplugin/locator/filesystemfilter.cpp
+++ b/src/plugins/coreplugin/locator/filesystemfilter.cpp
@@ -36,6 +36,7 @@
#include <coreplugin/vcsmanager.h>
#include <utils/checkablemessagebox.h>
#include <utils/fileutils.h>
+#include <utils/link.h>
#include <QDir>
#include <QJsonObject>
@@ -66,6 +67,9 @@ FileSystemFilter::FileSystemFilter()
{
setId("Files in file system");
setDisplayName(tr("Files in File System"));
+ setDescription(tr("Opens a file given by a relative path to the current document, or absolute "
+ "path. \"~\" refers to your home directory. You have the option to create a "
+ "file if it does not exist yet."));
setDefaultShortcutString("f");
setDefaultIncludedByDefault(false);
}
@@ -125,11 +129,11 @@ QList<LocatorFilterEntry> FileSystemFilter::matchesFor(QFutureInterface<LocatorF
}
}
// file names can match with +linenumber or :linenumber
- const EditorManager::FilePathInfo fp = EditorManager::splitLineAndColumnNumber(entryFileName);
- regExp = createRegExp(fp.filePath, caseSensitivity_);
+ QString postfix;
+ Link link = Link::fromString(entryFileName, true, &postfix);
+ regExp = createRegExp(link.targetFilePath.toString(), caseSensitivity_);
if (!regExp.isValid())
return {};
- const QString fileName = QFileInfo(fp.filePath).fileName();
for (const QString &file : files) {
if (future.isCanceled())
break;
@@ -138,7 +142,7 @@ QList<LocatorFilterEntry> FileSystemFilter::matchesFor(QFutureInterface<LocatorF
if (match.hasMatch()) {
const MatchLevel level = matchLevelFor(match, file);
const QString fullPath = dirInfo.filePath(file);
- LocatorFilterEntry filterEntry(this, file, QString(fullPath + fp.postfix));
+ LocatorFilterEntry filterEntry(this, file, QString(fullPath + postfix));
filterEntry.fileName = fullPath;
filterEntry.highlightInfo = highlightInfo(match);
@@ -147,7 +151,7 @@ QList<LocatorFilterEntry> FileSystemFilter::matchesFor(QFutureInterface<LocatorF
}
// "create and open" functionality
- const QString fullFilePath = dirInfo.filePath(fileName);
+ const QString fullFilePath = dirInfo.filePath(link.targetFilePath.fileName());
const bool containsWildcard = entry.contains('?') || entry.contains('*');
if (!containsWildcard && !QFileInfo::exists(fullFilePath) && dirInfo.exists()) {
LocatorFilterEntry createAndOpen(this, tr("Create and Open \"%1\"").arg(entry), fullFilePath);