fix: Some variables are incorrectly highlighted as errors (#2690)

Non-auto function arguments of custom types defined inside a namespace
made the highlighter unable to check if member uses inside the function
are valid. Argument types were not parsed as fully qualified types and
the problem is corrected by making sure that fully qualified names are
used when they are found in function arguments.

An example of a pattern that shows the error is id3.hexpat in the which
uses unqualified types. In order to obtain the correct highlighting then
you have to add the namespace to all custom types even if they are being
used inside the namespace. Type names without namespace are considered
by the syntax highlighting code as belonging to the global scope
regardless of where the use takes place.
This commit is contained in:
paxcut
2026-03-20 10:45:01 -07:00
committed by GitHub
parent a109e14ee3
commit 854535fec6

View File

@@ -1909,8 +1909,10 @@ namespace hex::plugin::builtin {
if (peek(tkn::ValueType::Any))
typeStr = Token::getTypeName(*getValue<Token::ValueType>(0));
else if (peek(tkn::Literal::Identifier))
typeStr = getValue<Token::Identifier>(0)->get();
else if (peek(tkn::Literal::Identifier)) {
std::vector<Identifier *> identifiers;
getQualifiedName(typeStr, identifiers, true, false);
}
m_curr = curr;
return typeStr;