diff --git a/src/languageservice/services/yamlHover.ts b/src/languageservice/services/yamlHover.ts index 9ad870cd..7c4dcb41 100644 --- a/src/languageservice/services/yamlHover.ts +++ b/src/languageservice/services/yamlHover.ts @@ -91,7 +91,7 @@ export class YAMLHover { const regex = new RegExp(this.indentation, 'g'); const markupContent: MarkupContent = { kind: MarkupKind.Markdown, - value: contents.replace(regex, ' '), + value: this.indentation ? contents.replace(regex, ' ') : contents, }; const result: Hover = { contents: markupContent, diff --git a/test/hover.test.ts b/test/hover.test.ts index e01b90c0..edacc9ec 100644 --- a/test/hover.test.ts +++ b/test/hover.test.ts @@ -20,13 +20,10 @@ describe('Hover Tests', () => { let telemetry: TestTelemetry; before(() => { - languageSettingsSetup = new ServiceSetup() - .withHover() - .withIndentation(' ') - .withSchemaFileMatch({ - uri: 'http://google.com', - fileMatch: ['bad-schema.yaml'], - }); + languageSettingsSetup = new ServiceSetup().withHover().withSchemaFileMatch({ + uri: 'http://google.com', + fileMatch: ['bad-schema.yaml'], + }); const { languageService: langService, languageHandler: langHandler, @@ -65,7 +62,7 @@ describe('Hover Tests', () => { }); } - describe('Hover', function () { + describe('Hover', function() { it('Hover on key on root', async () => { languageService.addSchema(SCHEMA_ID, { type: 'object', @@ -513,7 +510,26 @@ users: ); }); - it('hover on value and its description has multiline, indentationa and special string', async () => { + it('hover on value and its description has multiline, indentation and special string', async () => { + (() => { + languageSettingsSetup = new ServiceSetup() + .withHover() + .withIndentation(' ') + .withSchemaFileMatch({ + uri: 'http://google.com', + fileMatch: ['bad-schema.yaml'], + }); + const { + languageService: langService, + languageHandler: langHandler, + yamlSettings: settings, + telemetry: testTelemetry, + } = setupLanguageService(languageSettingsSetup.languageSettings); + languageService = langService; + languageHandler = langHandler; + yamlSettings = settings; + telemetry = testTelemetry; + })(); //https://github.com/redhat-developer/vscode-yaml/issues/886 languageService.addSchema(SCHEMA_ID, { type: 'object', diff --git a/test/integration.test.ts b/test/integration.test.ts index e34fe40f..c2b6487a 100644 --- a/test/integration.test.ts +++ b/test/integration.test.ts @@ -22,7 +22,6 @@ describe('Kubernetes Integration Tests', () => { const fileMatch = ['*.yml', '*.yaml']; languageSettingsSetup = new ServiceSetup() .withHover() - .withIndentation(' ') .withValidate() .withCompletion() .withSchemaFileMatch({