MCPcopy Create free account
hub / github.com/Codeya-IDE/deepin-ide / highlightColor

Method highlightColor

src/plugins/codeeditor/lsp/lspclientmanager.cpp:43–118  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

41}
42
43QColor LSPClientManager::highlightColor(const QString &langId, lsp::SemanticTokenType::type_value token)
44{
45 auto defaultColor = DGuiApplicationHelper::instance()->themeType() == DGuiApplicationHelper::LightType
46 ? QColor("#000000")
47 : QColor("#d6cf9a");
48
49 QMutexLocker lk(&dataMutex);
50 if (!styleMap.contains(langId)) {
51 const auto &filePath = support_file::EditorStyle::globalPath(langId);
52 StyleSettings settings;
53 if (!settings.load(filePath))
54 return defaultColor;
55
56 styleMap.insert(langId, settings);
57 }
58
59 QString theme = DGuiApplicationHelper::instance()->themeType() == DGuiApplicationHelper::LightType
60 ? StyleSettings::Theme::get()->Light
61 : StyleSettings::Theme::get()->Dark;
62
63 QJsonObject typeObj;
64 if (lsp::SemanticTokenType::get()->Namespace == token) {
65 typeObj = styleMap[langId].value(theme, StyleSettings::Key_1::get()->Namespace).toObject();
66 } else if (lsp::SemanticTokenType::get()->Type == token) {
67 typeObj = styleMap[langId].value(theme, StyleSettings::Key_1::get()->Type).toObject();
68 } else if (lsp::SemanticTokenType::get()->Class == token) {
69 typeObj = styleMap[langId].value(theme, StyleSettings::Key_1::get()->Class).toObject();
70 } else if (lsp::SemanticTokenType::get()->Enum == token) {
71 typeObj = styleMap[langId].value(theme, StyleSettings::Key_1::get()->Enumeration).toObject();
72 } else if (lsp::SemanticTokenType::get()->Interface == token) {
73 typeObj = styleMap[langId].value(theme, StyleSettings::Key_1::get()->Text).toObject();
74 } else if (lsp::SemanticTokenType::get()->Struct == token) {
75 typeObj = styleMap[langId].value(theme, StyleSettings::Key_1::get()->Text).toObject();
76 } else if (lsp::SemanticTokenType::get()->TypeParameter == token) {
77 typeObj = styleMap[langId].value(theme, StyleSettings::Key_1::get()->Variable).toObject();
78 } else if (lsp::SemanticTokenType::get()->Parameter == token) {
79 typeObj = styleMap[langId].value(theme, StyleSettings::Key_1::get()->Parameter).toObject();
80 } else if (lsp::SemanticTokenType::get()->Variable == token) {
81 typeObj = styleMap[langId].value(theme, StyleSettings::Key_1::get()->Variable).toObject();
82 } else if (lsp::SemanticTokenType::get()->Property == token) {
83 typeObj = styleMap[langId].value(theme, StyleSettings::Key_1::get()->Property).toObject();
84 } else if (lsp::SemanticTokenType::get()->EnumMember == token) {
85 typeObj = styleMap[langId].value(theme, StyleSettings::Key_1::get()->Enumeration).toObject();
86 } else if (lsp::SemanticTokenType::get()->Event == token) {
87 typeObj = styleMap[langId].value(theme, StyleSettings::Key_1::get()->Text).toObject();
88 } else if (lsp::SemanticTokenType::get()->Function == token) {
89 typeObj = styleMap[langId].value(theme, StyleSettings::Key_1::get()->Function).toObject();
90 } else if (lsp::SemanticTokenType::get()->Method == token) {
91 typeObj = styleMap[langId].value(theme, StyleSettings::Key_1::get()->FunctionDeclaration).toObject();
92 } else if (lsp::SemanticTokenType::get()->Macro == token) {
93 typeObj = styleMap[langId].value(theme, StyleSettings::Key_1::get()->Macro).toObject();
94 } else if (lsp::SemanticTokenType::get()->Keyword == token) {
95 typeObj = styleMap[langId].value(theme, StyleSettings::Key_1::get()->Keyword).toObject();
96 } else if (lsp::SemanticTokenType::get()->Modifier == token) {
97 typeObj = styleMap[langId].value(theme, StyleSettings::Key_1::get()->Keyword).toObject();
98 } else if (lsp::SemanticTokenType::get()->Comment == token) {
99 typeObj = styleMap[langId].value(theme, StyleSettings::Key_1::get()->Comment).toObject();
100 } else if (lsp::SemanticTokenType::get()->String == token) {

Callers 1

symbolIndicColorMethod · 0.80

Calls 8

insertMethod · 0.80
atMethod · 0.80
getFunction · 0.50
containsMethod · 0.45
loadMethod · 0.45
valueMethod · 0.45
isEmptyMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected