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
9408378a
Commit
9408378a
authored
Mar 31, 2010
by
Christian Kamm
Browse files
QmlJSEditor: Fix file/directory imports for qml files not in a project.
Reviewed-by: Roberto Raggi
parent
107ad1ca
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/plugins/qmljseditor/qmljseditor.cpp
View file @
9408378a
...
...
@@ -749,12 +749,11 @@ static void appendExtraSelectionsForMessages(
void
QmlJSTextEditor
::
onDocumentUpdated
(
QmlJS
::
Document
::
Ptr
doc
)
{
if
(
file
()
->
fileName
()
!=
doc
->
fileName
())
{
return
;
}
if
(
doc
->
documentRevision
()
!=
document
()
->
revision
())
{
// got an outdated document.
if
(
file
()
->
fileName
()
!=
doc
->
fileName
()
||
doc
->
documentRevision
()
!=
document
()
->
revision
())
{
// didn't get the currently open, or an up to date document.
// trigger a semantic rehighlight anyway, after a time
updateDocument
();
return
;
}
...
...
@@ -764,6 +763,7 @@ void QmlJSTextEditor::onDocumentUpdated(QmlJS::Document::Ptr doc)
const
SemanticHighlighter
::
Source
source
=
currentSource
(
/*force = */
true
);
m_semanticHighlighter
->
rehighlight
(
source
);
}
else
{
// show parsing errors
QList
<
QTextEdit
::
ExtraSelection
>
selections
;
appendExtraSelectionsForMessages
(
&
selections
,
doc
->
diagnosticMessages
(),
document
());
setExtraSelections
(
CodeWarningsSelection
,
selections
);
...
...
src/plugins/qmljseditor/qmljsmodelmanager.cpp
View file @
9408378a
...
...
@@ -100,7 +100,19 @@ Snapshot ModelManager::snapshot() const
void
ModelManager
::
updateSourceFiles
(
const
QStringList
&
files
)
{
refreshSourceFiles
(
files
);
// for files that are not yet in the snapshot, scan the whole directory
QStringList
filesToParse
;
QSet
<
QString
>
sourceDirectories
;
foreach
(
const
QString
&
file
,
files
)
{
if
(
!
_snapshot
.
document
(
file
))
sourceDirectories
.
insert
(
QFileInfo
(
file
).
path
());
else
filesToParse
.
append
(
file
);
}
refreshSourceFiles
(
filesToParse
);
refreshSourceDirectories
(
sourceDirectories
.
toList
());
}
QFuture
<
void
>
ModelManager
::
refreshSourceFiles
(
const
QStringList
&
sourceFiles
)
...
...
src/plugins/qmlprojectmanager/qmlproject.cpp
View file @
9408378a
...
...
@@ -106,13 +106,7 @@ void QmlProject::parseProject(RefreshOptions options)
}
if
(
m_projectItem
)
{
m_projectItem
.
data
()
->
setSourceDirectory
(
projectDir
().
path
());
QSet
<
QString
>
sourceDirectories
;
foreach
(
const
QString
&
file
,
m_projectItem
.
data
()
->
files
())
{
sourceDirectories
.
insert
(
QFileInfo
(
file
).
path
());
}
m_modelManager
->
updateSourceDirectories
(
sourceDirectories
.
toList
());
m_modelManager
->
updateSourceDirectories
(
m_projectItem
.
data
()
->
files
());
}
m_rootNode
->
refresh
();
}
...
...
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