添加更多种下划线颜色

问题描述

我正在使用Monaco Editor制作自己的IDE。我使用provideHover在某些代码下划线。似乎不同的DiagnosticCategoryMarkerSeverity对下划线的颜色有影响。目前看来,下划线颜色只有4种。

/* Diagnostics */
enum DiagnosticCategory {
    Warning = 0,Error = 1,Suggestion = 2,Message = 3
}

有人知道如何添加更多的下划线颜色吗?

解决方法

下划线的形状和颜色由其CSS类确定,例如squiggly-error

enter image description here

在VS Code项目的intervalTree.ts中声明了相应CSS类的常量:

export const enum ClassName {
    EditorHintDecoration = 'squiggly-hint',EditorInfoDecoration = 'squiggly-info',EditorWarningDecoration = 'squiggly-warning',EditorErrorDecoration = 'squiggly-error',EditorUnnecessaryDecoration = 'squiggly-unnecessary',EditorUnnecessaryInlineDecoration = 'squiggly-inline-unnecessary',EditorDeprecatedInlineDecoration = 'squiggly-inline-deprecated'
}

使用这些常量的代码位于markerDecorationsServiceImpl.ts中(在基于MarkerSeverity的开关中)。


它似乎并未设计为可通过配置扩展。添加另一个下划线类型可能需要在vs核心类中进行更改。

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...