好的,我已经弄清楚了。
首先,我通过某些外部来源(我使用JSHINT)获取错误信息。然后,我修改了修饰内容:
let newDecorations = errors.map(e => {
return {
range: new monaco.Range(e.startLineNumber, 1, e.startLineNumber, 1),
options: {
glyphMarginClassName: e.severity === monaco.Severity.Error ? 'errorIcon' : 'warningIcon',
glyphMarginHoverMessage: {value: e.message}
}
}
})
this.decorations = this.editor.deltaDecorations(this.decorations, newDecorations)
.warningIcon {
display: block;
background-image: url('../assets/icons/warningIcon.png');
background-size: contain;
background-repeat: no-repeat;
}
.errorIcon {
display: block;
background-image: url('../assets/icons/errorIcon.png');
background-size: contain;
background-repeat: no-repeat;
}