Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Marco Bubke
flatpak-qt-creator
Commits
e3376720
Commit
e3376720
authored
Sep 08, 2010
by
Roberto Raggi
Browse files
Introduced SemanticInfo::isValid().
parent
cf40fdcc
Changes
8
Hide whitespace changes
Inline
Side-by-side
src/plugins/qmljseditor/qmljscodecompletion.cpp
View file @
e3376720
...
...
@@ -678,12 +678,11 @@ int CodeCompletion::startCompletion(TextEditor::ITextEditable *editor)
m_completions
.
clear
();
const
SemanticInfo
semanticInfo
=
edit
->
semanticInfo
();
const
QmlJS
::
Snapshot
snapshot
=
semanticInfo
.
snapshot
;
const
Document
::
Ptr
document
=
semanticInfo
.
document
;
if
(
!
document
)
if
(
!
semanticInfo
.
isValid
()
)
return
-
1
;
const
Document
::
Ptr
document
=
semanticInfo
.
document
;
const
QFileInfo
currentFileInfo
(
fileName
);
bool
isQmlFile
=
false
;
...
...
src/plugins/qmljseditor/qmljseditor.cpp
View file @
e3376720
...
...
@@ -556,6 +556,11 @@ QList<AST::Node *> SemanticInfo::astPath(int cursorPosition) const
LookupContext
::
Ptr
SemanticInfo
::
lookupContext
(
const
QList
<
QmlJS
::
AST
::
Node
*>
&
path
)
const
{
Q_ASSERT
(
!
m_context
.
isNull
());
if
(
m_context
.
isNull
())
return
LookupContext
::
create
(
document
,
snapshot
,
path
);
return
LookupContext
::
create
(
document
,
snapshot
,
*
m_context
,
path
);
}
...
...
@@ -610,6 +615,14 @@ AST::Node *SemanticInfo::nodeUnderCursor(int pos) const
return
0
;
}
bool
SemanticInfo
::
isValid
()
const
{
if
(
document
&&
m_context
)
return
true
;
return
false
;
}
int
SemanticInfo
::
revision
()
const
{
if
(
document
)
...
...
@@ -1360,6 +1373,9 @@ void QmlJSTextEditor::createToolBar(QmlJSEditorEditable *editable)
TextEditor
::
BaseTextEditor
::
Link
QmlJSTextEditor
::
findLinkAt
(
const
QTextCursor
&
cursor
,
bool
/*resolveTarget*/
)
{
const
SemanticInfo
semanticInfo
=
m_semanticInfo
;
if
(
!
semanticInfo
.
isValid
())
return
Link
();
const
unsigned
cursorPosition
=
cursor
.
position
();
AST
::
Node
*
node
=
semanticInfo
.
nodeUnderCursor
(
cursorPosition
);
...
...
src/plugins/qmljseditor/qmljseditor.h
View file @
e3376720
...
...
@@ -121,6 +121,7 @@ class SemanticInfo
public:
SemanticInfo
()
{}
bool
isValid
()
const
;
int
revision
()
const
;
// Returns the declaring member
...
...
src/plugins/qmljseditor/qmljshoverhandler.cpp
View file @
e3376720
...
...
@@ -110,7 +110,7 @@ void HoverHandler::identifyMatch(TextEditor::ITextEditor *editor, int pos)
if
(
!
matchDiagnosticMessage
(
qmlEditor
,
pos
))
{
const
SemanticInfo
&
semanticInfo
=
qmlEditor
->
semanticInfo
();
if
(
semanticInfo
.
revision
()
!=
qmlEditor
->
editorRevision
())
if
(
!
semanticInfo
.
isValid
()
||
semanticInfo
.
revision
()
!=
qmlEditor
->
editorRevision
())
return
;
QList
<
AST
::
Node
*>
astPath
=
semanticInfo
.
astPath
(
pos
);
...
...
src/plugins/qmljseditor/qmljsmodelmanager.cpp
View file @
e3376720
...
...
@@ -80,7 +80,12 @@ ModelManager::ModelManager(QObject *parent):
void
ModelManager
::
loadQmlTypeDescriptions
()
{
const
QString
resourcePath
=
Core
::
ICore
::
instance
()
->
resourcePath
();
loadQmlTypeDescriptions
(
Core
::
ICore
::
instance
()
->
resourcePath
());
loadQmlTypeDescriptions
(
Core
::
ICore
::
instance
()
->
userResourcePath
());
}
void
ModelManager
::
loadQmlTypeDescriptions
(
const
QString
&
resourcePath
)
{
const
QDir
typeFileDir
(
resourcePath
+
QLatin1String
(
"/qml-type-descriptions"
));
const
QStringList
xmlExtensions
=
QStringList
()
<<
QLatin1String
(
"*.xml"
);
const
QFileInfoList
xmlFiles
=
typeFileDir
.
entryInfoList
(
xmlExtensions
,
...
...
src/plugins/qmljseditor/qmljsmodelmanager.h
View file @
e3376720
...
...
@@ -101,6 +101,7 @@ protected:
bool
emitDocChangedOnDisk
);
void
loadQmlTypeDescriptions
();
void
loadQmlTypeDescriptions
(
const
QString
&
path
);
void
updateImportPaths
();
...
...
src/plugins/qmljseditor/qmljsquickfix.cpp
View file @
e3376720
...
...
@@ -136,7 +136,7 @@ TextEditor::QuickFixState *QmlJSQuickFixCollector::initializeCompletion(TextEdit
if
(
QmlJSTextEditor
*
qmljsEditor
=
qobject_cast
<
QmlJSTextEditor
*>
(
editor
))
{
const
SemanticInfo
info
=
qmljsEditor
->
semanticInfo
();
if
(
qmljsEditor
->
isOutdated
())
{
if
(
!
info
.
isValid
()
||
qmljsEditor
->
isOutdated
())
{
// outdated
qWarning
()
<<
"TODO: outdated semantic info, force a reparse."
;
return
0
;
...
...
src/plugins/qmljseditor/qmloutlinemodel.cpp
View file @
e3376720
...
...
@@ -330,6 +330,8 @@ Document::Ptr QmlOutlineModel::document() const
void
QmlOutlineModel
::
update
(
const
SemanticInfo
&
semanticInfo
)
{
m_semanticInfo
=
semanticInfo
;
if
(
!
m_semanticInfo
.
isValid
())
return
;
m_treePos
.
clear
();
m_treePos
.
append
(
0
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment