We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 12aa416 commit d6ebc56Copy full SHA for d6ebc56
plugins/cpp/service/src/cppservice.cpp
@@ -1226,7 +1226,9 @@ void CppServiceHandler::getSyntaxHighlight(
1226
continue;
1227
1228
// Regular expression to find element position
1229
- std::string reg = "\\b" + node.astValue + "\\b";
+ const std::regex specialChars { R"([-[\]{}()*+?.,\^$|#\s])" };
1230
+ std::string sanitizedAstValue = std::regex_replace(node.astValue, specialChars, R"(\$&)");
1231
+ std::string reg = "\\b" + sanitizedAstValue + "\\b";
1232
1233
for (std::size_t i = node.location.range.start.line - 1;
1234
i < node.location.range.end.line && i < content.size();
0 commit comments