From 8d26886b379e08843ce1bb96e1c6de8a232383b9 Mon Sep 17 00:00:00 2001 From: Petr Spacek Date: Wed, 8 Nov 2023 15:06:37 +0100 Subject: [PATCH] feat: unify string insert text for array and property --- src/languageservice/services/yamlCompletion.ts | 2 +- test/autoCompletion.test.ts | 2 +- test/autoCompletionFix.test.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/languageservice/services/yamlCompletion.ts b/src/languageservice/services/yamlCompletion.ts index 99e061f0..0ef71bab 100644 --- a/src/languageservice/services/yamlCompletion.ts +++ b/src/languageservice/services/yamlCompletion.ts @@ -1205,7 +1205,7 @@ export class YamlCompletion { insertText = `\${${insertIndex++}:0}`; break; case 'string': - insertText = `\${${insertIndex++}:""}`; + insertText = `\${${insertIndex++}}`; break; case 'object': { diff --git a/test/autoCompletion.test.ts b/test/autoCompletion.test.ts index 78b14996..dd5abe0c 100644 --- a/test/autoCompletion.test.ts +++ b/test/autoCompletion.test.ts @@ -1047,7 +1047,7 @@ describe('Auto Completion Tests', () => { const completion = parseSetup(content, content.lastIndexOf('Ba') + 2); // pos: 3+2 completion .then(function (result) { - assert.strictEqual('fooBar:\n - ${1:""}', result.items[0].insertText); + assert.strictEqual('fooBar:\n - ${1}', result.items[0].insertText); }) .then(done, done); }); diff --git a/test/autoCompletionFix.test.ts b/test/autoCompletionFix.test.ts index 81053315..f81c68aa 100644 --- a/test/autoCompletionFix.test.ts +++ b/test/autoCompletionFix.test.ts @@ -482,7 +482,7 @@ objB: expect(completion.items.length).equal(1); expect(completion.items[0]).to.be.deep.equal( - createExpectedCompletion('objectWithArray', 'objectWithArray:\n - ${1:""}', 1, 4, 1, 4, 10, 2, { + createExpectedCompletion('objectWithArray', 'objectWithArray:\n - ${1}', 1, 4, 1, 4, 10, 2, { documentation: '', }) );