vscode-error-lens
vscode-error-lens copied to clipboard
Message displays incorrectly when template does not have a whitespace between empty elements
If an element in the message template does not exist for a given diagnostic, and if there is no space between that element and another part of the string, the result.replace() logic here is removing other parts of the message.
https://github.com/usernamehw/vscode-error-lens/blob/b7c556afed68e5f4a8173cdf033c863da8718dc9/src/utils/extUtils.ts#L188
For example, if the message template is defined like this, then it shows correctly when the diagnostic has a valid $code, but if the $code is not valid, then the $source and other characters (parenthesis with this template) are also removed leaving only the $message piece (in this example, the Pylance $source indicator is not seen.
{
"errorLens.alignMessage": {
"start": 45,
"end": 0,
"minimumMargin": 5
},
"errorLens.messageTemplate": "$source($code): $message",
}
However if spaces are added instead of the parenthesis, then the message does show the $source.
{
"errorLens.alignMessage": {
"start": 45,
"end": 0,
"minimumMargin": 5
},
"errorLens.messageTemplate": "$source $code : $message",
}