66
77import { Hover , MarkupContent , MarkupKind , Position , Range } from 'vscode-languageserver-types' ;
88import { matchOffsetToDocument } from '../utils/arrUtils' ;
9- import { LanguageSettings } from '../yamlLanguageService' ;
9+ import { LanguageSettings , HoverSettings } from '../yamlLanguageService' ;
1010import { YAMLSchemaService } from './yamlSchemaService' ;
1111import { setKubernetesParserOption } from '../parser/isKubernetes' ;
1212import { TextDocument } from 'vscode-languageserver-textdocument' ;
@@ -24,7 +24,7 @@ import { stringify as stringifyYAML } from 'yaml';
2424export class YAMLHover {
2525 private shouldHover : boolean ;
2626 private indentation : string ;
27- private hoverSettings : LanguageSettings [ 'hoverSettings' ] ;
27+ private hoverSettings : HoverSettings ;
2828 private schemaService : YAMLSchemaService ;
2929
3030 constructor ( schemaService : YAMLSchemaService , private readonly telemetry ?: Telemetry ) {
@@ -36,7 +36,7 @@ export class YAMLHover {
3636 if ( languageSettings ) {
3737 this . shouldHover = languageSettings . hover ;
3838 this . indentation = languageSettings . indentation ;
39- this . hoverSettings = languageSettings . hoverSettings ;
39+ this . hoverSettings = languageSettings . hoverSettings ?? { } ;
4040 }
4141 }
4242
@@ -105,9 +105,8 @@ export class YAMLHover {
105105 return value . replace ( / \| \| \s * $ / , '' ) ;
106106 } ;
107107
108- const hoverSettings = this . hoverSettings || { } ;
109- const showSource = ! ! hoverSettings ?. showSource ;
110- const showTitle = ! ! hoverSettings ?. showTitle ;
108+ const showSource = this . hoverSettings ?. showSource ?? true ; // showSource enabled by default
109+ const showTitle = this . hoverSettings ?. showTitle ?? true ; // showTitle enabled by default
111110
112111 return this . schemaService . getSchemaForResource ( document . uri , doc ) . then ( ( schema ) => {
113112 if ( schema && node && ! schema . errors . length ) {
0 commit comments