forked from qt-creator/qt-creator
QmlJS: Use mime types to distinguish qml and js files.
This allows adding patterns to the qml mime type in the options dialog. Previously they were always parsed as js. Change-Id: Ifa344fb6ab8cbcda02becef991cf6807615a1caa Reviewed-on: http://codereview.qt-project.org/4515 Reviewed-by: Leandro T. C. Melo <leandro.melo@nokia.com>
This commit is contained in:
@@ -37,6 +37,7 @@
|
||||
#include <qmljs/qmljscheck.h>
|
||||
#include <qmljs/qmljscontext.h>
|
||||
#include <qmljs/qmljslink.h>
|
||||
#include <qmljstools/qmljsmodelmanager.h>
|
||||
|
||||
namespace QmlJSEditor {
|
||||
namespace Internal {
|
||||
@@ -122,7 +123,12 @@ SemanticInfo SemanticInfoUpdater::semanticInfo(const SemanticInfoUpdaterSource &
|
||||
|
||||
if (! doc) {
|
||||
snapshot = source.snapshot;
|
||||
doc = snapshot.documentFromSource(source.code, source.fileName);
|
||||
QmlJS::Document::Language language;
|
||||
if (m_lastSemanticInfo.document)
|
||||
language = m_lastSemanticInfo.document->language();
|
||||
else
|
||||
language = QmlJSTools::languageOfFile(source.fileName);
|
||||
doc = snapshot.documentFromSource(source.code, source.fileName, language);
|
||||
doc->setEditorRevision(source.revision);
|
||||
doc->parse();
|
||||
snapshot.insert(doc);
|
||||
|
||||
Reference in New Issue
Block a user