ui: Extracted syntax highlighting rules for java and cpp to files
* pass file language from storage to code view * load syntax highlighting rules files from install directory "syntax_highlighting_rules" * files must be named <language_identifier>.rules to make syntax highlighting work
This commit is contained in:
@@ -87,14 +87,7 @@ QtCodeField::QtCodeField(
|
||||
|
||||
createAnnotations(locationFile);
|
||||
|
||||
FilePath path = locationFile->getFilePath();
|
||||
LanguageType language = LANGUAGE_UNKNOWN;
|
||||
if (!path.empty())
|
||||
{
|
||||
language = (path.extension() == L".java" ? LANGUAGE_JAVA : LANGUAGE_CPP);
|
||||
}
|
||||
|
||||
m_highlighter = std::make_shared<QtHighlighter>(document(), language);
|
||||
m_highlighter = std::make_shared<QtHighlighter>(document(), locationFile->getLanguage());
|
||||
m_highlighter->highlightDocument();
|
||||
|
||||
ApplicationSettings* appSettings = ApplicationSettings::getInstance().get();
|
||||
|
||||
@@ -19,8 +19,8 @@ QtCodeSnippet* QtCodeSnippet::merged(
|
||||
SourceLocationFile* aFile = a->m_codeArea->getSourceLocationFile().get();
|
||||
SourceLocationFile* bFile = b->m_codeArea->getSourceLocationFile().get();
|
||||
|
||||
std::shared_ptr<SourceLocationFile> locationFile =
|
||||
std::make_shared<SourceLocationFile>(aFile->getFilePath(), aFile->isWhole(), aFile->isComplete(), aFile->isIndexed());
|
||||
std::shared_ptr<SourceLocationFile> locationFile = std::make_shared<SourceLocationFile>(
|
||||
aFile->getFilePath(), aFile->getLanguage(), aFile->isWhole(), aFile->isComplete(), aFile->isIndexed());
|
||||
|
||||
aFile->forEachSourceLocation(
|
||||
[&locationFile](SourceLocation* loc)
|
||||
|
||||
@@ -102,6 +102,11 @@ void QtNewsWidget::updateNews()
|
||||
size_t itemNum = 0;
|
||||
for (QJsonValueRef value : doc.array())
|
||||
{
|
||||
if (!value.isObject())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
itemNum++;
|
||||
QJsonObject newsItem = value.toObject();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user