Implemented tooltip and lookat for #include directives.

This commit is contained in:
Roberto Raggi
2008-12-10 17:21:01 +01:00
parent 6ae2cc0b5b
commit d454607264
7 changed files with 59 additions and 13 deletions

View File

@@ -480,13 +480,23 @@ void CPPEditor::jumpToDefinition()
Document::Ptr doc = m_modelManager->document(file()->fileName());
if (!doc)
return;
QTextCursor tc = textCursor();
unsigned lineno = tc.blockNumber() + 1;
foreach (const Document::Include &incl, doc->includes()) {
if (incl.line() == lineno) {
if (TextEditor::BaseTextEditor::openEditorAt(incl.fileName(), 0, 0))
return; // done
break;
}
}
Symbol *lastSymbol = doc->findSymbolAt(line, column);
if (!lastSymbol)
return;
// Get the expression under the cursor
const int endOfName = endOfNameUnderCursor();
QTextCursor tc = textCursor();
tc.setPosition(endOfName);
ExpressionUnderCursor expressionUnderCursor;
const QString expression = expressionUnderCursor(tc);