forked from qt-creator/qt-creator
TextEditor: use Utils::FilePath as file member in AssistInterface
Change-Id: I3bf9b013b9350411f918efdb9d1a36a2c22bf972 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -33,7 +33,7 @@ namespace Internal {
|
||||
ClangCompletionAssistInterface::ClangCompletionAssistInterface(BackendCommunicator &communicator, CompletionType type,
|
||||
const TextEditor::TextEditorWidget *textEditorWidget,
|
||||
int position,
|
||||
const QString &fileName,
|
||||
const Utils::FilePath &fileName,
|
||||
TextEditor::AssistReason reason,
|
||||
const ProjectExplorer::HeaderPaths &headerPaths,
|
||||
const CPlusPlus::LanguageFeatures &features)
|
||||
|
@@ -42,7 +42,7 @@ public:
|
||||
CompletionType type,
|
||||
const TextEditor::TextEditorWidget *textEditorWidget,
|
||||
int position,
|
||||
const QString &fileName,
|
||||
const Utils::FilePath &fileName,
|
||||
TextEditor::AssistReason reason,
|
||||
const ProjectExplorer::HeaderPaths &headerPaths,
|
||||
const CPlusPlus::LanguageFeatures &features);
|
||||
|
@@ -135,7 +135,7 @@ QList<AssistProposalItemInterface *> ClangCompletionAssistProcessor::toAssistPro
|
||||
return c.completionKind == CodeCompletion::SignalCompletionKind;
|
||||
})) {
|
||||
considerOnlySignals = CppTools::CppModelManager::instance()
|
||||
->positionRequiresSignal(m_interface->fileName(), m_content, m_position);
|
||||
->positionRequiresSignal(m_interface->filePath().toString(), m_content, m_position);
|
||||
}
|
||||
|
||||
for (const CodeCompletion &codeCompletion : completions) {
|
||||
@@ -492,7 +492,7 @@ bool ClangCompletionAssistProcessor::completeInclude(const QTextCursor &cursor)
|
||||
|
||||
// Make completion for all relevant includes
|
||||
ProjectExplorer::HeaderPaths headerPaths = m_interface->headerPaths();
|
||||
const ProjectExplorer::HeaderPath currentFilePath(QFileInfo(m_interface->fileName()).path(),
|
||||
const ProjectExplorer::HeaderPath currentFilePath(m_interface->filePath().toFileInfo().path(),
|
||||
ProjectExplorer::HeaderPathType::User);
|
||||
if (!headerPaths.contains(currentFilePath))
|
||||
headerPaths.append(currentFilePath);
|
||||
@@ -608,7 +608,7 @@ void ClangCompletionAssistProcessor::sendFileContent(const QByteArray &customFil
|
||||
const UnsavedFileContentInfo info = unsavedFileContent(customFileContent);
|
||||
|
||||
BackendCommunicator &communicator = m_interface->communicator();
|
||||
communicator.documentsChanged({{m_interface->fileName(),
|
||||
communicator.documentsChanged({{m_interface->filePath().toString(),
|
||||
Utf8String::fromByteArray(info.unsavedContent),
|
||||
info.isDocumentModified,
|
||||
uint(m_interface->textDocument()->revision())}});
|
||||
@@ -677,7 +677,7 @@ bool ClangCompletionAssistProcessor::sendCompletionRequest(int position,
|
||||
const QByteArray &customFileContent,
|
||||
int functionNameStartPosition)
|
||||
{
|
||||
const QString filePath = m_interface->fileName();
|
||||
const QString filePath = m_interface->filePath().toString();
|
||||
|
||||
auto &communicator = m_interface->communicator();
|
||||
|
||||
|
@@ -60,13 +60,14 @@ TextEditor::IAssistProcessor *ClangCompletionAssistProvider::createProcessor() c
|
||||
}
|
||||
|
||||
TextEditor::AssistInterface *ClangCompletionAssistProvider::createAssistInterface(
|
||||
const QString &filePath,
|
||||
const Utils::FilePath &filePath,
|
||||
const TextEditor::TextEditorWidget *textEditorWidget,
|
||||
const CPlusPlus::LanguageFeatures &/*languageFeatures*/,
|
||||
const CPlusPlus::LanguageFeatures & /*languageFeatures*/,
|
||||
int position,
|
||||
TextEditor::AssistReason reason) const
|
||||
{
|
||||
const CppTools::ProjectPart::Ptr projectPart = projectPartForFileBasedOnProcessor(filePath);
|
||||
const CppTools::ProjectPart::Ptr projectPart = projectPartForFileBasedOnProcessor(
|
||||
filePath.toString());
|
||||
if (projectPart) {
|
||||
return new ClangCompletionAssistInterface(m_communicator,
|
||||
m_type,
|
||||
|
@@ -46,7 +46,7 @@ public:
|
||||
|
||||
TextEditor::IAssistProcessor *createProcessor() const override;
|
||||
TextEditor::AssistInterface *createAssistInterface(
|
||||
const QString &filePath,
|
||||
const Utils::FilePath &filePath,
|
||||
const TextEditor::TextEditorWidget *textEditorWidget,
|
||||
const CPlusPlus::LanguageFeatures &languageFeatures,
|
||||
int position,
|
||||
|
@@ -292,7 +292,7 @@ TextEditor::QuickFixOperations ClangEditorDocumentProcessor::extraRefactoringOpe
|
||||
{
|
||||
ClangFixItOperationsExtractor extractor(m_diagnosticManager.diagnosticsWithFixIts());
|
||||
|
||||
return extractor.extract(assistInterface.fileName(), currentLine(assistInterface));
|
||||
return extractor.extract(assistInterface.filePath().toString(), currentLine(assistInterface));
|
||||
}
|
||||
|
||||
void ClangEditorDocumentProcessor::editorDocumentTimerRestarted()
|
||||
|
@@ -346,7 +346,7 @@ static TextEditor::AssistInterface createAssistInterface(TextEditor::TextEditorW
|
||||
{
|
||||
return TextEditor::AssistInterface(widget->document(),
|
||||
lineToPosition(widget->document(), lineNumber),
|
||||
widget->textDocument()->filePath().toString(),
|
||||
widget->textDocument()->filePath(),
|
||||
TextEditor::IdleEditor);
|
||||
}
|
||||
|
||||
|
@@ -59,9 +59,9 @@ CMakeFileCompletionAssist::CMakeFileCompletionAssist() :
|
||||
IAssistProposal *CMakeFileCompletionAssist::perform(const AssistInterface *interface)
|
||||
{
|
||||
Keywords kw;
|
||||
QString fileName = interface->fileName();
|
||||
if (!fileName.isEmpty() && QFileInfo(fileName).isFile()) {
|
||||
Project *p = SessionManager::projectForFile(Utils::FilePath::fromString(fileName));
|
||||
const Utils::FilePath &filePath = interface->filePath();
|
||||
if (!filePath.isEmpty() && filePath.toFileInfo().isFile()) {
|
||||
Project *p = SessionManager::projectForFile(filePath);
|
||||
if (p && p->activeTarget()) {
|
||||
CMakeTool *cmake = CMakeKitAspect::cmakeTool(p->activeTarget()->kit());
|
||||
if (cmake && cmake->isValid())
|
||||
|
@@ -1026,7 +1026,7 @@ AssistInterface *CppEditorWidget::createAssistInterface(AssistKind kind, AssistR
|
||||
if (Document::Ptr doc = d->m_lastSemanticInfo.doc)
|
||||
features = doc->languageFeatures();
|
||||
features.objCEnabled |= cppEditorDocument()->isObjCEnabled();
|
||||
return cap->createAssistInterface(textDocument()->filePath().toString(),
|
||||
return cap->createAssistInterface(textDocument()->filePath(),
|
||||
this,
|
||||
features,
|
||||
position(),
|
||||
|
@@ -706,7 +706,7 @@ public:
|
||||
return;
|
||||
|
||||
bool isHeaderFile = false;
|
||||
m_cppFileName = correspondingHeaderOrSource(interface.fileName(), &isHeaderFile);
|
||||
m_cppFileName = correspondingHeaderOrSource(interface.filePath().toString(), &isHeaderFile);
|
||||
m_factory->setHasImplementationFile(isHeaderFile && !m_cppFileName.isEmpty());
|
||||
|
||||
m_valid = true;
|
||||
|
@@ -87,7 +87,7 @@ IAssistProcessor *CppQuickFixAssistProvider::createProcessor() const
|
||||
CppQuickFixInterface::CppQuickFixInterface(CppEditorWidget *editor,
|
||||
AssistReason reason)
|
||||
: AssistInterface(editor->document(), editor->position(),
|
||||
editor->textDocument()->filePath().toString(), reason)
|
||||
editor->textDocument()->filePath(), reason)
|
||||
, m_editor(editor)
|
||||
, m_semanticInfo(editor->semanticInfo())
|
||||
, m_snapshot(CppModelManager::instance()->snapshot())
|
||||
|
@@ -671,7 +671,7 @@ public:
|
||||
void perform() override
|
||||
{
|
||||
CppRefactoringChanges refactoring(snapshot());
|
||||
CppRefactoringFilePtr currentFile = refactoring.file(fileName());
|
||||
CppRefactoringFilePtr currentFile = refactoring.file(filePath().toString());
|
||||
|
||||
ChangeSet changes;
|
||||
if (negation) {
|
||||
@@ -763,7 +763,7 @@ public:
|
||||
void perform() override
|
||||
{
|
||||
CppRefactoringChanges refactoring(snapshot());
|
||||
CppRefactoringFilePtr currentFile = refactoring.file(fileName());
|
||||
CppRefactoringFilePtr currentFile = refactoring.file(filePath().toString());
|
||||
|
||||
ChangeSet changes;
|
||||
changes.flip(currentFile->range(binary->left_expression),
|
||||
@@ -850,7 +850,7 @@ public:
|
||||
void perform() override
|
||||
{
|
||||
CppRefactoringChanges refactoring(snapshot());
|
||||
CppRefactoringFilePtr currentFile = refactoring.file(fileName());
|
||||
CppRefactoringFilePtr currentFile = refactoring.file(filePath().toString());
|
||||
|
||||
ChangeSet changes;
|
||||
changes.replace(currentFile->range(pattern->binary_op_token), QLatin1String("||"));
|
||||
@@ -937,7 +937,7 @@ public:
|
||||
void perform() override
|
||||
{
|
||||
CppRefactoringChanges refactoring(snapshot());
|
||||
CppRefactoringFilePtr currentFile = refactoring.file(fileName());
|
||||
CppRefactoringFilePtr currentFile = refactoring.file(filePath().toString());
|
||||
|
||||
ChangeSet changes;
|
||||
|
||||
@@ -1028,7 +1028,7 @@ public:
|
||||
void perform() override
|
||||
{
|
||||
CppRefactoringChanges refactoring(snapshot());
|
||||
CppRefactoringFilePtr currentFile = refactoring.file(fileName());
|
||||
CppRefactoringFilePtr currentFile = refactoring.file(filePath().toString());
|
||||
|
||||
ChangeSet changes;
|
||||
|
||||
@@ -1101,7 +1101,7 @@ public:
|
||||
void perform() override
|
||||
{
|
||||
CppRefactoringChanges refactoring(snapshot());
|
||||
CppRefactoringFilePtr currentFile = refactoring.file(fileName());
|
||||
CppRefactoringFilePtr currentFile = refactoring.file(filePath().toString());
|
||||
|
||||
ChangeSet changes;
|
||||
|
||||
@@ -1175,7 +1175,7 @@ public:
|
||||
void perform() override
|
||||
{
|
||||
CppRefactoringChanges refactoring(snapshot());
|
||||
CppRefactoringFilePtr currentFile = refactoring.file(fileName());
|
||||
CppRefactoringFilePtr currentFile = refactoring.file(filePath().toString());
|
||||
|
||||
ChangeSet changes;
|
||||
|
||||
@@ -1254,7 +1254,7 @@ public:
|
||||
void perform() override
|
||||
{
|
||||
CppRefactoringChanges refactoring(snapshot());
|
||||
CppRefactoringFilePtr currentFile = refactoring.file(fileName());
|
||||
CppRefactoringFilePtr currentFile = refactoring.file(filePath().toString());
|
||||
|
||||
const Token binaryToken = currentFile->tokenAt(condition->binary_op_token);
|
||||
|
||||
@@ -1493,7 +1493,7 @@ public:
|
||||
void perform() override
|
||||
{
|
||||
CppRefactoringChanges refactoring(snapshot());
|
||||
CppRefactoringFilePtr currentFile = refactoring.file(fileName());
|
||||
CppRefactoringFilePtr currentFile = refactoring.file(filePath().toString());
|
||||
|
||||
ChangeSet changes;
|
||||
|
||||
@@ -1697,7 +1697,7 @@ public:
|
||||
void perform() override
|
||||
{
|
||||
CppRefactoringChanges refactoring(snapshot());
|
||||
CppRefactoringFilePtr currentFile = refactoring.file(fileName());
|
||||
CppRefactoringFilePtr currentFile = refactoring.file(filePath().toString());
|
||||
|
||||
ChangeSet changes;
|
||||
|
||||
@@ -1759,7 +1759,7 @@ public:
|
||||
void perform() override
|
||||
{
|
||||
CppRefactoringChanges refactoring(snapshot());
|
||||
CppRefactoringFilePtr currentFile = refactoring.file(fileName());
|
||||
CppRefactoringFilePtr currentFile = refactoring.file(filePath().toString());
|
||||
|
||||
ChangeSet changes;
|
||||
changes.replace(start, end, replacement);
|
||||
@@ -1918,7 +1918,7 @@ public:
|
||||
void perform() override
|
||||
{
|
||||
CppRefactoringChanges refactoring(snapshot());
|
||||
CppRefactoringFilePtr currentFile = refactoring.file(fileName());
|
||||
CppRefactoringFilePtr currentFile = refactoring.file(filePath().toString());
|
||||
|
||||
TypeOfExpression typeOfExpression;
|
||||
typeOfExpression.init(semanticInfo().doc, snapshot(), context().bindings());
|
||||
@@ -2012,7 +2012,7 @@ public:
|
||||
void perform() override
|
||||
{
|
||||
CppRefactoringChanges refactoring(snapshot());
|
||||
CppRefactoringFilePtr currentFile = refactoring.file(fileName());
|
||||
CppRefactoringFilePtr currentFile = refactoring.file(filePath().toString());
|
||||
|
||||
for (int i = 1; i < m_name.length(); ++i) {
|
||||
const QChar c = m_name.at(i);
|
||||
@@ -2080,7 +2080,7 @@ AddIncludeForUndefinedIdentifierOp::AddIncludeForUndefinedIdentifierOp(
|
||||
void AddIncludeForUndefinedIdentifierOp::perform()
|
||||
{
|
||||
CppRefactoringChanges refactoring(snapshot());
|
||||
CppRefactoringFilePtr file = refactoring.file(fileName());
|
||||
CppRefactoringFilePtr file = refactoring.file(filePath().toString());
|
||||
|
||||
insertNewIncludeDirective(m_include, file, semanticInfo().doc);
|
||||
}
|
||||
@@ -2103,7 +2103,7 @@ void AddForwardDeclForUndefinedIdentifierOp::perform()
|
||||
const QStringList namespaces = parts.mid(0, parts.length() - 1);
|
||||
|
||||
CppRefactoringChanges refactoring(snapshot());
|
||||
CppRefactoringFilePtr file = refactoring.file(fileName());
|
||||
CppRefactoringFilePtr file = refactoring.file(filePath().toString());
|
||||
|
||||
NSVisitor visitor(file.data(), namespaces, m_symbolPos);
|
||||
visitor.accept(file->cppDocument()->translationUnit()->ast());
|
||||
@@ -2391,11 +2391,11 @@ void AddIncludeForUndefinedIdentifier::match(const CppQuickFixInterface &interfa
|
||||
qualifiedName.remove(0, 2);
|
||||
if (indexItems.first()->scopedSymbolName().endsWith(qualifiedName)) {
|
||||
const ProjectExplorer::Node * const node = ProjectExplorer::ProjectTree
|
||||
::nodeForFile(Utils::FilePath::fromString(interface.fileName()));
|
||||
::nodeForFile(interface.filePath());
|
||||
ProjectExplorer::FileType fileType = node && node->asFileNode()
|
||||
? node->asFileNode()->fileType() : ProjectExplorer::FileType::Unknown;
|
||||
if (fileType == ProjectExplorer::FileType::Unknown
|
||||
&& ProjectFile::isHeader(ProjectFile::classify(interface.fileName()))) {
|
||||
&& ProjectFile::isHeader(ProjectFile::classify(interface.filePath().toString()))) {
|
||||
fileType = ProjectExplorer::FileType::Header;
|
||||
}
|
||||
if (fileType == ProjectExplorer::FileType::Header) {
|
||||
@@ -2450,7 +2450,7 @@ public:
|
||||
void perform() override
|
||||
{
|
||||
CppRefactoringChanges refactoring(snapshot());
|
||||
CppRefactoringFilePtr currentFile = refactoring.file(fileName());
|
||||
CppRefactoringFilePtr currentFile = refactoring.file(filePath().toString());
|
||||
|
||||
int targetEndPos = currentFile->endOf(m_targetParam);
|
||||
ChangeSet changes;
|
||||
@@ -2530,7 +2530,7 @@ public:
|
||||
void perform() override
|
||||
{
|
||||
CppRefactoringChanges refactoring(snapshot());
|
||||
CppRefactoringFilePtr currentFile = refactoring.file(fileName());
|
||||
CppRefactoringFilePtr currentFile = refactoring.file(filePath().toString());
|
||||
currentFile->setChangeSet(m_change);
|
||||
currentFile->apply();
|
||||
}
|
||||
@@ -2692,7 +2692,7 @@ public:
|
||||
void perform() override
|
||||
{
|
||||
CppRefactoringChanges refactoring(snapshot());
|
||||
CppRefactoringFilePtr currentFile = refactoring.file(fileName());
|
||||
CppRefactoringFilePtr currentFile = refactoring.file(filePath().toString());
|
||||
|
||||
ChangeSet changes;
|
||||
int start = currentFile->endOf(compoundStatement->lbrace_token);
|
||||
@@ -3062,7 +3062,7 @@ public:
|
||||
|
||||
// rewrite the function name
|
||||
if (nameIncludesOperatorName(decl->name())) {
|
||||
CppRefactoringFilePtr file = refactoring.file(op->fileName());
|
||||
CppRefactoringFilePtr file = refactoring.file(op->filePath().toString());
|
||||
const QString operatorNameText = file->textOf(declAST->core_declarator);
|
||||
oo.includeWhiteSpaceInOperatorName = operatorNameText.contains(QLatin1Char(' '));
|
||||
}
|
||||
@@ -3148,7 +3148,7 @@ void InsertDefFromDecl::match(const CppQuickFixInterface &interface, QuickFixOpe
|
||||
// Insert Position: Implementation File
|
||||
DeclaratorAST *declAST = simpleDecl->declarator_list->value;
|
||||
InsertDefOperation *op = nullptr;
|
||||
ProjectFile::Kind kind = ProjectFile::classify(interface.fileName());
|
||||
ProjectFile::Kind kind = ProjectFile::classify(interface.filePath().toString());
|
||||
const bool isHeaderFile = ProjectFile::isHeader(kind);
|
||||
if (isHeaderFile) {
|
||||
CppRefactoringChanges refactoring(interface.snapshot());
|
||||
@@ -3192,7 +3192,7 @@ void InsertDefFromDecl::match(const CppQuickFixInterface &interface, QuickFixOpe
|
||||
result << new InsertDefOperation(interface, decl, declAST,
|
||||
InsertionLocation(),
|
||||
DefPosOutsideClass,
|
||||
interface.fileName());
|
||||
interface.filePath().toString());
|
||||
}
|
||||
|
||||
// Insert Position: Inside Class
|
||||
@@ -3201,8 +3201,8 @@ void InsertDefFromDecl::match(const CppQuickFixInterface &interface, QuickFixOpe
|
||||
const CppRefactoringFilePtr file = interface.currentFile();
|
||||
file->lineAndColumn(file->endOf(simpleDecl), &line, &column);
|
||||
const InsertionLocation loc
|
||||
= InsertionLocation(interface.fileName(), QString(), QString(),
|
||||
line, column);
|
||||
= InsertionLocation(interface.filePath().toString(), QString(),
|
||||
QString(), line, column);
|
||||
result << new InsertDefOperation(interface, decl, declAST, loc,
|
||||
DefPosInsideClass, QString(),
|
||||
isFreeFunction);
|
||||
@@ -3488,7 +3488,7 @@ private:
|
||||
QTC_ASSERT(!m_declarations.isEmpty(), return);
|
||||
|
||||
CppRefactoringChanges refactoring(snapshot());
|
||||
const bool isHeaderFile = ProjectFile::isHeader(ProjectFile::classify(fileName()));
|
||||
const bool isHeaderFile = ProjectFile::isHeader(ProjectFile::classify(filePath().toString()));
|
||||
QString cppFile; // Only set if the class is defined in a header file.
|
||||
if (isHeaderFile) {
|
||||
InsertionPointLocator locator(refactoring);
|
||||
@@ -3568,12 +3568,12 @@ private:
|
||||
QTC_ASSERT(finder.decl(), continue);
|
||||
InsertionLocation loc;
|
||||
const QString targetFilePath = setting.defPos == DefPosImplementationFile
|
||||
? cppFile : fileName();
|
||||
? cppFile : filePath().toString();
|
||||
QTC_ASSERT(!targetFilePath.isEmpty(), continue);
|
||||
if (setting.defPos == DefPosInsideClass) {
|
||||
int line, column;
|
||||
currentFile()->lineAndColumn(currentFile()->endOf(finder.decl()), &line, &column);
|
||||
loc = InsertionLocation(fileName(), QString(), QString(), line, column);
|
||||
loc = InsertionLocation(filePath().toString(), QString(), QString(), line, column);
|
||||
}
|
||||
auto &changeSet = changeSets[targetFilePath];
|
||||
InsertDefOperation::insertDefinition(
|
||||
@@ -3849,7 +3849,7 @@ public:
|
||||
OperationType op)
|
||||
{
|
||||
CppRefactoringChanges refactoring(quickFix->snapshot());
|
||||
CppRefactoringFilePtr currentFile = refactoring.file(quickFix->fileName());
|
||||
CppRefactoringFilePtr currentFile = refactoring.file(quickFix->filePath().toString());
|
||||
|
||||
QTC_ASSERT(symbol, return);
|
||||
FullySpecifiedType fullySpecifiedType = symbol->type();
|
||||
@@ -4407,7 +4407,7 @@ public:
|
||||
{
|
||||
QTC_ASSERT(!m_funcReturn || !m_relevantDecls.isEmpty(), return);
|
||||
CppRefactoringChanges refactoring(snapshot());
|
||||
CppRefactoringFilePtr currentFile = refactoring.file(fileName());
|
||||
CppRefactoringFilePtr currentFile = refactoring.file(filePath().toString());
|
||||
|
||||
ExtractFunctionOptions options;
|
||||
if (m_functionNameGetter)
|
||||
@@ -5083,7 +5083,7 @@ public:
|
||||
} else if (Namespace *matchingNamespace = isNamespaceFunction(context(), func)) {
|
||||
// Dealing with free functions and inline member functions.
|
||||
bool isHeaderFile;
|
||||
declFileName = correspondingHeaderOrSource(fileName(), &isHeaderFile);
|
||||
declFileName = correspondingHeaderOrSource(filePath().toString(), &isHeaderFile);
|
||||
if (!QFile::exists(declFileName))
|
||||
return FoundDeclaration();
|
||||
result.file = refactoring.file(declFileName);
|
||||
@@ -5115,7 +5115,7 @@ public:
|
||||
FunctionDeclaratorAST *functionDeclaratorOfDefinition
|
||||
= functionDeclarator(m_functionDefinition);
|
||||
const CppRefactoringChanges refactoring(snapshot());
|
||||
const CppRefactoringFilePtr currentFile = refactoring.file(fileName());
|
||||
const CppRefactoringFilePtr currentFile = refactoring.file(filePath().toString());
|
||||
deduceTypeNameOfLiteral(currentFile->cppDocument());
|
||||
|
||||
ChangeSet changes;
|
||||
@@ -5291,7 +5291,7 @@ public:
|
||||
, m_identifierAST(identifierAST)
|
||||
, m_symbol(symbol)
|
||||
, m_refactoring(snapshot())
|
||||
, m_file(m_refactoring.file(fileName()))
|
||||
, m_file(m_refactoring.file(filePath().toString()))
|
||||
, m_document(interface.semanticInfo().doc)
|
||||
{
|
||||
setDescription(
|
||||
@@ -5663,7 +5663,7 @@ public:
|
||||
void perform() override
|
||||
{
|
||||
CppRefactoringChanges refactoring(snapshot());
|
||||
CppRefactoringFilePtr file = refactoring.file(fileName());
|
||||
CppRefactoringFilePtr file = refactoring.file(filePath().toString());
|
||||
|
||||
InsertionPointLocator locator(refactoring);
|
||||
ChangeSet declarations;
|
||||
@@ -6088,7 +6088,8 @@ void MoveFuncDefOutside::match(const CppQuickFixInterface &interface, QuickFixOp
|
||||
return;
|
||||
|
||||
bool isHeaderFile = false;
|
||||
const QString cppFileName = correspondingHeaderOrSource(interface.fileName(), &isHeaderFile);
|
||||
const QString cppFileName = correspondingHeaderOrSource(interface.filePath().toString(),
|
||||
&isHeaderFile);
|
||||
|
||||
if (isHeaderFile && !cppFileName.isEmpty()) {
|
||||
const MoveFuncDefRefactoringHelper::MoveType type = moveOutsideMemberDefinition
|
||||
@@ -6182,7 +6183,8 @@ void MoveAllFuncDefOutside::match(const CppQuickFixInterface &interface, QuickFi
|
||||
return;
|
||||
|
||||
bool isHeaderFile = false;
|
||||
const QString cppFileName = correspondingHeaderOrSource(interface.fileName(), &isHeaderFile);
|
||||
const QString cppFileName = correspondingHeaderOrSource(interface.filePath().toString(),
|
||||
&isHeaderFile);
|
||||
if (isHeaderFile && !cppFileName.isEmpty()) {
|
||||
result << new MoveAllFuncDefOutsideOp(interface,
|
||||
MoveFuncDefRefactoringHelper::MoveToCppFile,
|
||||
@@ -6287,7 +6289,7 @@ void MoveFuncDefToDecl::match(const CppQuickFixInterface &interface, QuickFixOpe
|
||||
return;
|
||||
|
||||
const CppRefactoringChanges refactoring(interface.snapshot());
|
||||
const CppRefactoringFilePtr defFile = refactoring.file(interface.fileName());
|
||||
const CppRefactoringFilePtr defFile = refactoring.file(interface.filePath().toString());
|
||||
const ChangeSet::Range defRange = defFile->range(completeDefAST);
|
||||
|
||||
// Determine declaration (file, range, text);
|
||||
@@ -6342,7 +6344,7 @@ void MoveFuncDefToDecl::match(const CppQuickFixInterface &interface, QuickFixOpe
|
||||
} else if (Namespace *matchingNamespace = isNamespaceFunction(interface.context(), func)) {
|
||||
// Dealing with free functions
|
||||
bool isHeaderFile = false;
|
||||
declFileName = correspondingHeaderOrSource(interface.fileName(), &isHeaderFile);
|
||||
declFileName = correspondingHeaderOrSource(interface.filePath().toString(), &isHeaderFile);
|
||||
if (isHeaderFile)
|
||||
return;
|
||||
|
||||
@@ -6374,7 +6376,7 @@ void MoveFuncDefToDecl::match(const CppQuickFixInterface &interface, QuickFixOpe
|
||||
|
||||
if (!declFileName.isEmpty() && !declText.isEmpty())
|
||||
result << new MoveFuncDefToDeclOp(interface,
|
||||
interface.fileName(),
|
||||
interface.filePath().toString(),
|
||||
declFileName,
|
||||
funcAST, declText,
|
||||
defRange, declRange);
|
||||
@@ -6398,7 +6400,7 @@ public:
|
||||
void perform() override
|
||||
{
|
||||
CppRefactoringChanges refactoring(snapshot());
|
||||
CppRefactoringFilePtr file = refactoring.file(fileName());
|
||||
CppRefactoringFilePtr file = refactoring.file(filePath().toString());
|
||||
|
||||
// Determine return type and new variable name
|
||||
TypeOfExpression typeOfExpression;
|
||||
@@ -6863,7 +6865,7 @@ public:
|
||||
void perform() override
|
||||
{
|
||||
CppRefactoringChanges refactoring(snapshot());
|
||||
CppRefactoringFilePtr currentFile = refactoring.file(fileName());
|
||||
CppRefactoringFilePtr currentFile = refactoring.file(filePath().toString());
|
||||
|
||||
const int startPos = currentFile->startOf(m_literal);
|
||||
const int endPos = currentFile->endOf(m_literal);
|
||||
@@ -6950,7 +6952,7 @@ private:
|
||||
void perform() override
|
||||
{
|
||||
CppRefactoringChanges refactoring(snapshot());
|
||||
CppRefactoringFilePtr currentFile = refactoring.file(fileName());
|
||||
CppRefactoringFilePtr currentFile = refactoring.file(filePath().toString());
|
||||
currentFile->setChangeSet(m_changes);
|
||||
currentFile->apply();
|
||||
}
|
||||
@@ -7252,7 +7254,7 @@ void ConvertQt4Connect::match(const CppQuickFixInterface &interface, QuickFixOpe
|
||||
void ExtraRefactoringOperations::match(const CppQuickFixInterface &interface,
|
||||
QuickFixOperations &result)
|
||||
{
|
||||
const auto processor = CppTools::CppToolsBridge::baseEditorDocumentProcessor(interface.fileName());
|
||||
const auto processor = CppTools::CppToolsBridge::baseEditorDocumentProcessor(interface.filePath().toString());
|
||||
if (processor) {
|
||||
const auto clangFixItOperations = processor->extraRefactoringOperations(interface);
|
||||
result.append(clangFixItOperations);
|
||||
@@ -7581,9 +7583,9 @@ private:
|
||||
void perform() override
|
||||
{
|
||||
CppRefactoringChanges refactoring(snapshot());
|
||||
CppRefactoringFilePtr currentFile = refactoring.file(fileName());
|
||||
CppRefactoringFilePtr currentFile = refactoring.file(filePath().toString());
|
||||
if (refactorFile(currentFile, refactoring.snapshot(), currentFile->endOf(m_usingDirective), true))
|
||||
processIncludes(refactoring, fileName());
|
||||
processIncludes(refactoring, filePath().toString());
|
||||
|
||||
for (auto &file : m_changes)
|
||||
file->apply();
|
||||
@@ -7660,7 +7662,7 @@ void RemoveUsingNamespace::match(const CppQuickFixInterface &interface, QuickFix
|
||||
UsingDirectiveAST *usingDirective = path.at(n)->asUsingDirective();
|
||||
if (usingDirective && usingDirective->name->name->isNameId()) {
|
||||
result << new RemoveUsingNamespaceOperation(interface, usingDirective, false);
|
||||
const bool isHeader = ProjectFile::isHeader(ProjectFile::classify(interface.fileName()));
|
||||
const bool isHeader = ProjectFile::isHeader(ProjectFile::classify(interface.filePath().toString()));
|
||||
if (isHeader && path.at(n - 1)->asTranslationUnit()) // using namespace at global scope
|
||||
result << new RemoveUsingNamespaceOperation(interface, usingDirective, true);
|
||||
}
|
||||
|
@@ -105,7 +105,7 @@ public:
|
||||
LanguageFeatures languageFeatures = LanguageFeatures::defaultFeatures();
|
||||
languageFeatures.objCEnabled = false;
|
||||
CppCompletionAssistInterface *ai
|
||||
= new CppCompletionAssistInterface(m_editorWidget->textDocument()->filePath().toString(),
|
||||
= new CppCompletionAssistInterface(m_editorWidget->textDocument()->filePath(),
|
||||
m_textDocument, m_position,
|
||||
ExplicitlyInvoked, m_snapshot,
|
||||
ProjectExplorer::HeaderPaths(),
|
||||
|
@@ -424,7 +424,8 @@ IAssistProcessor *InternalCompletionAssistProvider::createProcessor() const
|
||||
return new InternalCppCompletionAssistProcessor;
|
||||
}
|
||||
|
||||
AssistInterface *InternalCompletionAssistProvider::createAssistInterface(const QString &filePath,
|
||||
AssistInterface *InternalCompletionAssistProvider::createAssistInterface(
|
||||
const Utils::FilePath &filePath,
|
||||
const TextEditorWidget *textEditorWidget,
|
||||
const LanguageFeatures &languageFeatures,
|
||||
int position,
|
||||
@@ -434,7 +435,7 @@ AssistInterface *InternalCompletionAssistProvider::createAssistInterface(const Q
|
||||
|
||||
return new CppCompletionAssistInterface(filePath,
|
||||
textEditorWidget,
|
||||
BuiltinEditorDocumentParser::get(filePath),
|
||||
BuiltinEditorDocumentParser::get(filePath.toString()),
|
||||
languageFeatures,
|
||||
position,
|
||||
reason,
|
||||
@@ -1092,7 +1093,7 @@ int InternalCppCompletionAssistProcessor::startCompletionHelper()
|
||||
|
||||
int line = 0, column = 0;
|
||||
Utils::Text::convertPosition(m_interface->textDocument(), startOfExpression, &line, &column);
|
||||
const QString fileName = m_interface->fileName();
|
||||
const QString fileName = m_interface->filePath().toString();
|
||||
return startCompletionInternal(fileName, line, column - 1, expression, endOfExpression);
|
||||
}
|
||||
|
||||
@@ -1117,7 +1118,7 @@ bool InternalCppCompletionAssistProcessor::tryObjCCompletion()
|
||||
const int startPos = tokens[start].bytesBegin() + tokens.startPosition();
|
||||
const QString expr = m_interface->textAt(startPos, m_interface->position() - startPos);
|
||||
|
||||
Document::Ptr thisDocument = m_interface->snapshot().document(m_interface->fileName());
|
||||
Document::Ptr thisDocument = m_interface->snapshot().document(m_interface->filePath());
|
||||
if (!thisDocument)
|
||||
return false;
|
||||
|
||||
@@ -1260,7 +1261,7 @@ bool InternalCppCompletionAssistProcessor::completeInclude(const QTextCursor &cu
|
||||
|
||||
// Make completion for all relevant includes
|
||||
ProjectExplorer::HeaderPaths headerPaths = m_interface->headerPaths();
|
||||
const ProjectExplorer::HeaderPath currentFilePath(QFileInfo(m_interface->fileName()).path(),
|
||||
const ProjectExplorer::HeaderPath currentFilePath(m_interface->filePath().toFileInfo().path(),
|
||||
ProjectExplorer::HeaderPathType::User);
|
||||
if (!headerPaths.contains(currentFilePath))
|
||||
headerPaths.append(currentFilePath);
|
||||
@@ -1312,7 +1313,7 @@ bool InternalCppCompletionAssistProcessor::objcKeywordsWanted() const
|
||||
if (!m_interface->languageFeatures().objCEnabled)
|
||||
return false;
|
||||
|
||||
const QString fileName = m_interface->fileName();
|
||||
const QString fileName = m_interface->filePath().toString();
|
||||
|
||||
const Utils::MimeType mt = Utils::mimeTypeForFile(fileName);
|
||||
return mt.matchesName(QLatin1String(CppTools::Constants::OBJECTIVE_C_SOURCE_MIMETYPE))
|
||||
|
@@ -85,7 +85,7 @@ public:
|
||||
TextEditor::IAssistProcessor *createProcessor() const override;
|
||||
|
||||
TextEditor::AssistInterface *createAssistInterface(
|
||||
const QString &filePath,
|
||||
const Utils::FilePath &filePath,
|
||||
const TextEditor::TextEditorWidget *textEditorWidget,
|
||||
const CPlusPlus::LanguageFeatures &languageFeatures,
|
||||
int position,
|
||||
@@ -165,7 +165,7 @@ private:
|
||||
class CppCompletionAssistInterface : public TextEditor::AssistInterface
|
||||
{
|
||||
public:
|
||||
CppCompletionAssistInterface(const QString &filePath,
|
||||
CppCompletionAssistInterface(const Utils::FilePath &filePath,
|
||||
const TextEditor::TextEditorWidget *textEditorWidget,
|
||||
BuiltinEditorDocumentParser::Ptr parser,
|
||||
const CPlusPlus::LanguageFeatures &languageFeatures,
|
||||
@@ -179,7 +179,7 @@ public:
|
||||
, m_languageFeatures(languageFeatures)
|
||||
{}
|
||||
|
||||
CppCompletionAssistInterface(const QString &filePath,
|
||||
CppCompletionAssistInterface(const Utils::FilePath &filePath,
|
||||
QTextDocument *textDocument,
|
||||
int position,
|
||||
TextEditor::AssistReason reason,
|
||||
|
@@ -41,6 +41,8 @@ class TextEditorWidget;
|
||||
class AssistInterface;
|
||||
}
|
||||
|
||||
namespace Utils { class FilePath; }
|
||||
|
||||
namespace CppTools {
|
||||
|
||||
class CPPTOOLS_EXPORT CppCompletionAssistProvider : public TextEditor::CompletionAssistProvider
|
||||
@@ -54,7 +56,7 @@ public:
|
||||
bool isContinuationChar(const QChar &c) const override;
|
||||
|
||||
virtual TextEditor::AssistInterface *createAssistInterface(
|
||||
const QString &filePath,
|
||||
const Utils::FilePath &filePath,
|
||||
const TextEditor::TextEditorWidget *textEditorWidget,
|
||||
const CPlusPlus::LanguageFeatures &languageFeatures,
|
||||
int position,
|
||||
|
@@ -547,7 +547,7 @@ bool GlslCompletionAssistProcessor::acceptsIdleEditor() const
|
||||
// -----------------------------
|
||||
GlslCompletionAssistInterface::GlslCompletionAssistInterface(QTextDocument *textDocument,
|
||||
int position,
|
||||
const QString &fileName,
|
||||
const Utils::FilePath &fileName,
|
||||
AssistReason reason,
|
||||
const QString &mimeType,
|
||||
const Document::Ptr &glslDoc)
|
||||
|
@@ -108,7 +108,7 @@ class GlslCompletionAssistInterface : public TextEditor::AssistInterface
|
||||
{
|
||||
public:
|
||||
GlslCompletionAssistInterface(QTextDocument *textDocument,
|
||||
int position, const QString &fileName,
|
||||
int position, const Utils::FilePath &fileName,
|
||||
TextEditor::AssistReason reason,
|
||||
const QString &mimeType,
|
||||
const Document::Ptr &glslDoc);
|
||||
|
@@ -371,7 +371,7 @@ AssistInterface *GlslEditorWidget::createAssistInterface(
|
||||
if (kind == Completion)
|
||||
return new GlslCompletionAssistInterface(document(),
|
||||
position(),
|
||||
textDocument()->filePath().toString(),
|
||||
textDocument()->filePath(),
|
||||
reason,
|
||||
textDocument()->mimeType(),
|
||||
m_glslDocument);
|
||||
|
@@ -1308,10 +1308,10 @@ void Client::rehighlight()
|
||||
}
|
||||
}
|
||||
|
||||
bool Client::documentUpdatePostponed(const QString &fileName) const
|
||||
bool Client::documentUpdatePostponed(const Utils::FilePath &fileName) const
|
||||
{
|
||||
return Utils::contains(m_documentsToUpdate.keys(), [fileName](const TextEditor::TextDocument *doc) {
|
||||
return doc->filePath() == Utils::FilePath::fromString(fileName);
|
||||
return doc->filePath() == fileName;
|
||||
});
|
||||
}
|
||||
|
||||
|
@@ -179,7 +179,7 @@ public:
|
||||
HoverHandler *hoverHandler();
|
||||
void rehighlight();
|
||||
|
||||
bool documentUpdatePostponed(const QString &fileName) const;
|
||||
bool documentUpdatePostponed(const Utils::FilePath &fileName) const;
|
||||
|
||||
signals:
|
||||
void initialized(LanguageServerProtocol::ServerCapabilities capabilities);
|
||||
|
@@ -323,13 +323,12 @@ IAssistProposal *LanguageClientCompletionAssistProcessor::perform(const AssistIn
|
||||
++delta;
|
||||
if (delta < TextEditorSettings::completionSettings().m_characterThreshold)
|
||||
return nullptr;
|
||||
if (m_client->documentUpdatePostponed(interface->fileName())) {
|
||||
if (m_client->documentUpdatePostponed(interface->filePath())) {
|
||||
m_postponedUpdateConnection
|
||||
= QObject::connect(m_client,
|
||||
&Client::documentUpdated,
|
||||
[this, interface](TextEditor::TextDocument *document) {
|
||||
if (document->filePath()
|
||||
== Utils::FilePath::fromString(interface->fileName()))
|
||||
if (document->filePath() == interface->filePath())
|
||||
perform(interface);
|
||||
});
|
||||
return nullptr;
|
||||
@@ -355,8 +354,7 @@ IAssistProposal *LanguageClientCompletionAssistProcessor::perform(const AssistIn
|
||||
--column; // column is 0 based in the protocol
|
||||
params.setPosition({line, column});
|
||||
params.setContext(context);
|
||||
params.setTextDocument(TextDocumentIdentifier(
|
||||
DocumentUri::fromFilePath(Utils::FilePath::fromString(interface->fileName()))));
|
||||
params.setTextDocument(TextDocumentIdentifier(DocumentUri::fromFilePath(interface->filePath())));
|
||||
CompletionRequest completionRequest(params);
|
||||
completionRequest.setResponseCallback([this](auto response) {
|
||||
this->handleCompletionResponse(response);
|
||||
|
@@ -85,7 +85,7 @@ IAssistProposal *FunctionHintProcessor::perform(const AssistInterface *interface
|
||||
m_pos = interface->position();
|
||||
QTextCursor cursor(interface->textDocument());
|
||||
cursor.setPosition(m_pos);
|
||||
auto uri = DocumentUri::fromFilePath(Utils::FilePath::fromString(interface->fileName()));
|
||||
auto uri = DocumentUri::fromFilePath(interface->filePath());
|
||||
SignatureHelpRequest request((TextDocumentPositionParams(TextDocumentIdentifier(uri), Position(cursor))));
|
||||
request.setResponseCallback([this](auto response) { this->handleSignatureResponse(response); });
|
||||
m_client->sendContent(request);
|
||||
|
@@ -112,7 +112,7 @@ IAssistProposal *LanguageClientQuickFixAssistProcessor::perform(const AssistInte
|
||||
cursor.select(QTextCursor::LineUnderCursor);
|
||||
Range range(cursor);
|
||||
params.setRange(range);
|
||||
auto uri = DocumentUri::fromFilePath(Utils::FilePath::fromString(interface->fileName()));
|
||||
auto uri = DocumentUri::fromFilePath(interface->filePath());
|
||||
params.setTextDocument(TextDocumentIdentifier(uri));
|
||||
CodeActionParams::CodeActionContext context;
|
||||
context.setDiagnostics(m_client->diagnosticsAt(uri, range));
|
||||
|
@@ -158,8 +158,7 @@ private:
|
||||
|
||||
static Suggest::NimSuggest *nimSuggestInstance(const AssistInterface *interface)
|
||||
{
|
||||
auto filename = Utils::FilePath::fromString(interface->fileName());
|
||||
return Nim::Suggest::NimSuggestCache::instance().get(filename);
|
||||
return Nim::Suggest::NimSuggestCache::instance().get(interface->filePath());
|
||||
}
|
||||
|
||||
static std::shared_ptr<Suggest::NimSuggestClientRequest> sendRequest(const AssistInterface *interface,
|
||||
@@ -170,8 +169,7 @@ private:
|
||||
int line = 0, column = 0;
|
||||
Utils::Text::convertPosition(interface->textDocument(), pos, &line, &column);
|
||||
QTC_ASSERT(column >= 1, return nullptr);
|
||||
auto filename = Utils::FilePath::fromString(interface->fileName());
|
||||
return suggest->sug(filename.toString(), line, column - 1, dirtyFile);
|
||||
return suggest->sug(interface->filePath().toString(), line, column - 1, dirtyFile);
|
||||
}
|
||||
|
||||
static std::unique_ptr<QTemporaryFile> writeDirtyFile(const TextEditor::AssistInterface *interface)
|
||||
|
@@ -99,7 +99,7 @@ TextEditor::AssistInterface *BindingEditorWidget::createAssistInterface(
|
||||
{
|
||||
Q_UNUSED(assistKind)
|
||||
return new QmlJSEditor::QmlJSCompletionAssistInterface(
|
||||
document(), position(), QString(),
|
||||
document(), position(), Utils::FilePath(),
|
||||
assistReason, qmljsdocument->semanticInfo());
|
||||
}
|
||||
|
||||
|
@@ -145,7 +145,7 @@ QStringList BaseTextEditModifier::autoComplete(QTextDocument *textDocument, int
|
||||
= qobject_cast<QmlJSEditor::QmlJSEditorDocument *>(bte->textDocument()))
|
||||
return QmlJSEditor::qmlJSAutoComplete(textDocument,
|
||||
position,
|
||||
document->filePath().toString(),
|
||||
document->filePath(),
|
||||
explicitComplete ? TextEditor::ExplicitlyInvoked : TextEditor::ActivationCharacter,
|
||||
document->semanticInfo());
|
||||
return QStringList();
|
||||
|
@@ -328,7 +328,7 @@ bool isLiteral(AST::Node *ast)
|
||||
|
||||
QStringList qmlJSAutoComplete(QTextDocument *textDocument,
|
||||
int position,
|
||||
const QString &fileName,
|
||||
const Utils::FilePath &fileName,
|
||||
TextEditor::AssistReason reason,
|
||||
const SemanticInfo &info)
|
||||
{
|
||||
@@ -552,8 +552,6 @@ IAssistProposal *QmlJSCompletionAssistProcessor::perform(const AssistInterface *
|
||||
if (assistInterface->reason() == IdleEditor && !acceptsIdleEditor())
|
||||
return nullptr;
|
||||
|
||||
const QString &fileName = m_interface->fileName();
|
||||
|
||||
m_startPosition = assistInterface->position();
|
||||
while (isIdentifierChar(m_interface->textDocument()->characterAt(m_startPosition - 1), false, false))
|
||||
--m_startPosition;
|
||||
@@ -567,10 +565,9 @@ IAssistProposal *QmlJSCompletionAssistProcessor::perform(const AssistInterface *
|
||||
return nullptr;
|
||||
|
||||
const Document::Ptr document = semanticInfo.document;
|
||||
const QFileInfo currentFileInfo(fileName);
|
||||
|
||||
bool isQmlFile = false;
|
||||
if (currentFileInfo.suffix() == QLatin1String("qml"))
|
||||
if (m_interface->filePath().endsWith(".qml"))
|
||||
isQmlFile = true;
|
||||
|
||||
const QList<AST::Node *> path = semanticInfo.rangePath(m_interface->position());
|
||||
@@ -983,7 +980,7 @@ bool QmlJSCompletionAssistProcessor::completeUrl(const QString &relativeBasePath
|
||||
// ------------------------------
|
||||
QmlJSCompletionAssistInterface::QmlJSCompletionAssistInterface(QTextDocument *textDocument,
|
||||
int position,
|
||||
const QString &fileName,
|
||||
const Utils::FilePath &fileName,
|
||||
AssistReason reason,
|
||||
const SemanticInfo &info)
|
||||
: AssistInterface(textDocument, position, fileName, reason)
|
||||
|
@@ -107,7 +107,7 @@ class QMLJSEDITOR_EXPORT QmlJSCompletionAssistInterface : public TextEditor::Ass
|
||||
public:
|
||||
QmlJSCompletionAssistInterface(QTextDocument *textDocument,
|
||||
int position,
|
||||
const QString &fileName,
|
||||
const Utils::FilePath &fileName,
|
||||
TextEditor::AssistReason reason,
|
||||
const QmlJSTools::SemanticInfo &info);
|
||||
const QmlJSTools::SemanticInfo &semanticInfo() const;
|
||||
@@ -135,7 +135,7 @@ public:
|
||||
|
||||
QStringList QMLJSEDITOR_EXPORT qmlJSAutoComplete(QTextDocument *textDocument,
|
||||
int position,
|
||||
const QString &fileName,
|
||||
const Utils::FilePath &fileName,
|
||||
TextEditor::AssistReason reason,
|
||||
const QmlJSTools::SemanticInfo &info);
|
||||
|
||||
|
@@ -1019,7 +1019,7 @@ AssistInterface *QmlJSEditorWidget::createAssistInterface(
|
||||
if (assistKind == Completion) {
|
||||
return new QmlJSCompletionAssistInterface(document(),
|
||||
position(),
|
||||
textDocument()->filePath().toString(),
|
||||
textDocument()->filePath(),
|
||||
reason,
|
||||
m_qmlJsEditorDocument->semanticInfo());
|
||||
} else if (assistKind == QuickFix) {
|
||||
|
@@ -49,7 +49,7 @@ using namespace Internal;
|
||||
QmlJSQuickFixAssistInterface::QmlJSQuickFixAssistInterface(QmlJSEditorWidget *editor,
|
||||
AssistReason reason)
|
||||
: AssistInterface(editor->document(), editor->position(),
|
||||
editor->textDocument()->filePath().toString(), reason)
|
||||
editor->textDocument()->filePath(), reason)
|
||||
, m_semanticInfo(editor->qmlJsEditorDocument()->semanticInfo())
|
||||
, m_currentFile(QmlJSRefactoringChanges::file(editor, m_semanticInfo.document))
|
||||
{}
|
||||
|
@@ -103,12 +103,12 @@ namespace TextEditor {
|
||||
|
||||
AssistInterface::AssistInterface(QTextDocument *textDocument,
|
||||
int position,
|
||||
const QString &fileName,
|
||||
const Utils::FilePath &filePath,
|
||||
AssistReason reason)
|
||||
: m_textDocument(textDocument)
|
||||
, m_isAsync(false)
|
||||
, m_position(position)
|
||||
, m_fileName(fileName)
|
||||
, m_filePath(filePath)
|
||||
, m_reason(reason)
|
||||
{}
|
||||
|
||||
|
@@ -32,6 +32,8 @@
|
||||
#include <QString>
|
||||
#include <QVector>
|
||||
|
||||
#include <utils/fileutils.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QTextDocument;
|
||||
QT_END_NAMESPACE
|
||||
@@ -43,14 +45,14 @@ class TEXTEDITOR_EXPORT AssistInterface
|
||||
public:
|
||||
AssistInterface(QTextDocument *textDocument,
|
||||
int position,
|
||||
const QString &fileName,
|
||||
const Utils::FilePath &filePath,
|
||||
AssistReason reason);
|
||||
virtual ~AssistInterface();
|
||||
|
||||
virtual int position() const { return m_position; }
|
||||
virtual QChar characterAt(int position) const;
|
||||
virtual QString textAt(int position, int length) const;
|
||||
virtual QString fileName() const { return m_fileName; }
|
||||
virtual Utils::FilePath filePath() const { return m_filePath; }
|
||||
virtual QTextDocument *textDocument() const { return m_textDocument; }
|
||||
virtual void prepareForAsyncUse();
|
||||
virtual void recreateTextDocument();
|
||||
@@ -60,7 +62,7 @@ private:
|
||||
QTextDocument *m_textDocument;
|
||||
bool m_isAsync;
|
||||
int m_position;
|
||||
QString m_fileName;
|
||||
Utils::FilePath m_filePath;
|
||||
AssistReason m_reason;
|
||||
QString m_text;
|
||||
QVector<int> m_userStates;
|
||||
|
@@ -298,7 +298,7 @@ void pathComplete(const AssistInterface *interface, QList<AssistProposalItemInte
|
||||
if (!items)
|
||||
return;
|
||||
|
||||
if (interface->fileName().isEmpty())
|
||||
if (interface->filePath().isEmpty())
|
||||
return;
|
||||
|
||||
// For pragmatic reasons, we don't support spaces in file names here.
|
||||
@@ -319,7 +319,7 @@ void pathComplete(const AssistInterface *interface, QList<AssistProposalItemInte
|
||||
return;
|
||||
|
||||
const QString word = interface->textAt(startPos, interface->position() - startPos);
|
||||
QDir baseDir = QFileInfo(interface->fileName()).absoluteDir();
|
||||
QDir baseDir = interface->filePath().toFileInfo().absoluteDir();
|
||||
const int lastSlashPos = word.lastIndexOf(QLatin1Char('/'));
|
||||
|
||||
QString prefix = word;
|
||||
|
@@ -8424,7 +8424,7 @@ AssistInterface *TextEditorWidget::createAssistInterface(AssistKind kind,
|
||||
AssistReason reason) const
|
||||
{
|
||||
Q_UNUSED(kind)
|
||||
return new AssistInterface(document(), position(), d->m_document->filePath().toString(), reason);
|
||||
return new AssistInterface(document(), position(), d->m_document->filePath(), reason);
|
||||
}
|
||||
|
||||
QString TextEditorWidget::foldReplacementText(const QTextBlock &) const
|
||||
|
Reference in New Issue
Block a user