forked from qt-creator/qt-creator
TextEditor: more FileName -> FilePath renaming
Change-Id: Ia61868806db47561e7bf7ae9b3cfb1e62a085a7a Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -140,7 +140,7 @@ Client::~Client()
|
||||
for (const DocumentUri &uri : m_diagnostics.keys())
|
||||
removeDiagnostics(uri);
|
||||
for (const DocumentUri &uri : m_highlights.keys()) {
|
||||
if (TextDocument *doc = TextDocument::textDocumentForFileName(uri.toFilePath())) {
|
||||
if (TextDocument *doc = TextDocument::textDocumentForFilePath(uri.toFilePath())) {
|
||||
if (TextEditor::SyntaxHighlighter *highlighter = doc->syntaxHighlighter())
|
||||
highlighter->clearAllExtraFormats();
|
||||
}
|
||||
@@ -620,7 +620,7 @@ void Client::cursorPositionChanged(TextEditor::TextEditorWidget *widget)
|
||||
void Client::requestCodeActions(const DocumentUri &uri, const QList<Diagnostic> &diagnostics)
|
||||
{
|
||||
const Utils::FilePath fileName = uri.toFilePath();
|
||||
TextEditor::TextDocument *doc = TextEditor::TextDocument::textDocumentForFileName(fileName);
|
||||
TextEditor::TextDocument *doc = TextEditor::TextDocument::textDocumentForFilePath(fileName);
|
||||
if (!doc)
|
||||
return;
|
||||
|
||||
@@ -918,7 +918,7 @@ void Client::showMessageBox(const ShowMessageRequestParams &message, const Messa
|
||||
void Client::showDiagnostics(const DocumentUri &uri)
|
||||
{
|
||||
if (TextEditor::TextDocument *doc
|
||||
= TextEditor::TextDocument::textDocumentForFileName(uri.toFilePath())) {
|
||||
= TextEditor::TextDocument::textDocumentForFilePath(uri.toFilePath())) {
|
||||
for (TextMark *mark : m_diagnostics.value(uri))
|
||||
doc->addMark(mark);
|
||||
}
|
||||
@@ -927,7 +927,7 @@ void Client::showDiagnostics(const DocumentUri &uri)
|
||||
void Client::removeDiagnostics(const DocumentUri &uri)
|
||||
{
|
||||
TextEditor::TextDocument *doc
|
||||
= TextEditor::TextDocument::textDocumentForFileName(uri.toFilePath());
|
||||
= TextEditor::TextDocument::textDocumentForFilePath(uri.toFilePath());
|
||||
|
||||
for (TextMark *mark : m_diagnostics.take(uri)) {
|
||||
if (doc)
|
||||
@@ -1052,7 +1052,7 @@ void Client::handleDiagnostics(const PublishDiagnosticsParams ¶ms)
|
||||
// TextMarks are already added in the TextEditor::TextMark constructor
|
||||
// so hide them if we are not the active client for this document
|
||||
if (LanguageClientManager::clientForUri(uri) != this)
|
||||
hideDiagnostics(TextEditor::TextDocument::textDocumentForFileName(uri.toFilePath()));
|
||||
hideDiagnostics(TextEditor::TextDocument::textDocumentForFilePath(uri.toFilePath()));
|
||||
else
|
||||
requestCodeActions(uri, diagnostics);
|
||||
}
|
||||
@@ -1062,7 +1062,7 @@ void Client::handleSemanticHighlight(const SemanticHighlightingParams ¶ms)
|
||||
const DocumentUri &uri = params.textDocument().uri();
|
||||
m_highlights[uri].clear();
|
||||
const LanguageClientValue<int> &version = params.textDocument().version();
|
||||
TextEditor::TextDocument *doc = TextEditor::TextDocument::textDocumentForFileName(
|
||||
TextEditor::TextDocument *doc = TextEditor::TextDocument::textDocumentForFilePath(
|
||||
uri.toFilePath());
|
||||
|
||||
if (!doc || LanguageClientManager::clientForDocument(doc) != this
|
||||
@@ -1082,7 +1082,7 @@ void Client::rehighlight()
|
||||
{
|
||||
using namespace TextEditor;
|
||||
for (auto it = m_highlights.begin(), end = m_highlights.end(); it != end; ++it) {
|
||||
if (TextDocument *doc = TextDocument::textDocumentForFileName(it.key().toFilePath())) {
|
||||
if (TextDocument *doc = TextDocument::textDocumentForFilePath(it.key().toFilePath())) {
|
||||
if (LanguageClientManager::clientForDocument(doc) == this)
|
||||
SemanticHighligtingSupport::applyHighlight(doc, it.value(), capabilities());
|
||||
}
|
||||
|
@@ -316,7 +316,7 @@ Client *LanguageClientManager::clientForDocument(TextEditor::TextDocument *docum
|
||||
|
||||
Client *LanguageClientManager::clientForFilePath(const Utils::FilePath &filePath)
|
||||
{
|
||||
return clientForDocument(TextEditor::TextDocument::textDocumentForFileName(filePath));
|
||||
return clientForDocument(TextEditor::TextDocument::textDocumentForFilePath(filePath));
|
||||
}
|
||||
|
||||
Client *LanguageClientManager::clientForUri(const DocumentUri &uri)
|
||||
|
@@ -80,7 +80,7 @@ bool applyTextDocumentEdit(const TextDocumentEdit &edit)
|
||||
if (edits.isEmpty())
|
||||
return true;
|
||||
const DocumentUri &uri = edit.id().uri();
|
||||
if (TextDocument* doc = TextDocument::textDocumentForFileName(uri.toFilePath())) {
|
||||
if (TextDocument* doc = TextDocument::textDocumentForFilePath(uri.toFilePath())) {
|
||||
LanguageClientValue<int> version = edit.id().version();
|
||||
if (!version.isNull() && version.value(0) < doc->document()->revision())
|
||||
return false;
|
||||
@@ -137,7 +137,7 @@ void updateCodeActionRefactoringMarker(Client *client,
|
||||
const CodeAction &action,
|
||||
const DocumentUri &uri)
|
||||
{
|
||||
TextDocument* doc = TextDocument::textDocumentForFileName(uri.toFilePath());
|
||||
TextDocument* doc = TextDocument::textDocumentForFilePath(uri.toFilePath());
|
||||
if (!doc)
|
||||
return;
|
||||
const QVector<BaseTextEditor *> editors = BaseTextEditor::textEditorsForDocument(doc);
|
||||
|
@@ -300,9 +300,9 @@ TextDocument *TextDocument::currentTextDocument()
|
||||
return qobject_cast<TextDocument *>(EditorManager::currentDocument());
|
||||
}
|
||||
|
||||
TextDocument *TextDocument::textDocumentForFileName(const Utils::FilePath &fileName)
|
||||
TextDocument *TextDocument::textDocumentForFilePath(const Utils::FilePath &filePath)
|
||||
{
|
||||
return qobject_cast<TextDocument *>(DocumentModel::documentForFilePath(fileName.toString()));
|
||||
return qobject_cast<TextDocument *>(DocumentModel::documentForFilePath(filePath.toString()));
|
||||
}
|
||||
|
||||
QString TextDocument::plainText() const
|
||||
|
@@ -70,7 +70,7 @@ public:
|
||||
static QMap<QString, QString> openedTextDocumentContents();
|
||||
static QMap<QString, QTextCodec *> openedTextDocumentEncodings();
|
||||
static TextDocument *currentTextDocument();
|
||||
static TextDocument *textDocumentForFileName(const Utils::FilePath &fileName);
|
||||
static TextDocument *textDocumentForFilePath(const Utils::FilePath &filePath);
|
||||
|
||||
virtual QString plainText() const;
|
||||
virtual QString textAt(int pos, int length) const;
|
||||
|
@@ -364,7 +364,7 @@ TextMarkRegistry::TextMarkRegistry(QObject *parent)
|
||||
void TextMarkRegistry::add(TextMark *mark)
|
||||
{
|
||||
instance()->m_marks[mark->fileName()].insert(mark);
|
||||
if (TextDocument *document = TextDocument::textDocumentForFileName(mark->fileName()))
|
||||
if (TextDocument *document = TextDocument::textDocumentForFilePath(mark->fileName()))
|
||||
document->addMark(mark);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user