Skip to content

Commit f68a447

Browse files
committed
feat: add extra data with solutionTitle to property completion
PR: redhat-developer#974
1 parent 8f2aef5 commit f68a447

File tree

2 files changed

+23
-4
lines changed

2 files changed

+23
-4
lines changed

src/languageservice/services/yamlCompletion.ts

+1
Original file line numberDiff line numberDiff line change
@@ -956,6 +956,7 @@ export class YamlCompletion {
956956
insertText,
957957
insertTextFormat: InsertTextFormat.Snippet,
958958
documentation: this.fromMarkup(propertySchema.markdownDescription) || propertySchema.description || '',
959+
...(schema.schema.title ? { data: { schemaTitle: schema.schema.title } } : undefined),
959960
},
960961
didOneOfSchemaMatches
961962
);

test/autoCompletion.test.ts

+22-4
Original file line numberDiff line numberDiff line change
@@ -3220,7 +3220,12 @@ describe('Auto Completion Tests', () => {
32203220

32213221
expect(result.items.length).equal(5);
32223222
expect(result.items[0]).to.deep.equal(
3223-
createExpectedCompletion('type', 'type: ${1|typeObj1,typeObj2|}', 0, 0, 0, 0, 10, 2, { documentation: '' })
3223+
createExpectedCompletion('type', 'type: ${1|typeObj1,typeObj2|}', 0, 0, 0, 0, 10, 2, {
3224+
documentation: '',
3225+
data: {
3226+
schemaTitle: 'Object1',
3227+
},
3228+
})
32243229
);
32253230
expect(result.items[1]).to.deep.equal(
32263231
createExpectedCompletion('Object1', 'type: typeObj1\noptions:\n label: ', 0, 0, 0, 0, 7, 2, {
@@ -3232,7 +3237,12 @@ describe('Auto Completion Tests', () => {
32323237
})
32333238
);
32343239
expect(result.items[2]).to.deep.equal(
3235-
createExpectedCompletion('options', 'options:\n label: ', 0, 0, 0, 0, 10, 2, { documentation: '' })
3240+
createExpectedCompletion('options', 'options:\n label: ', 0, 0, 0, 0, 10, 2, {
3241+
documentation: '',
3242+
data: {
3243+
schemaTitle: 'Object1',
3244+
},
3245+
})
32363246
);
32373247
expect(result.items[3]).to.deep.equal(
32383248
createExpectedCompletion('obj2', 'type: typeObj2\noptions:\n description: ', 0, 0, 0, 0, 7, 2, {
@@ -3269,7 +3279,12 @@ describe('Auto Completion Tests', () => {
32693279

32703280
expect(result.items.length).equal(5);
32713281
expect(result.items[0]).to.deep.equal(
3272-
createExpectedCompletion('type', 'type: ${1|typeObj1,typeObj2|}', 0, 2, 0, 2, 10, 2, { documentation: '' })
3282+
createExpectedCompletion('type', 'type: ${1|typeObj1,typeObj2|}', 0, 2, 0, 2, 10, 2, {
3283+
documentation: '',
3284+
data: {
3285+
schemaTitle: 'Object1',
3286+
},
3287+
})
32733288
);
32743289
expect(result.items[1]).to.deep.equal(
32753290
createExpectedCompletion('Object1', 'type: typeObj1\n options:\n label: ', 0, 2, 0, 2, 7, 2, {
@@ -3281,7 +3296,10 @@ describe('Auto Completion Tests', () => {
32813296
})
32823297
);
32833298
expect(result.items[2]).to.deep.equal(
3284-
createExpectedCompletion('options', 'options:\n label: ', 0, 2, 0, 2, 10, 2, { documentation: '' })
3299+
createExpectedCompletion('options', 'options:\n label: ', 0, 2, 0, 2, 10, 2, {
3300+
documentation: '',
3301+
data: { schemaTitle: 'Object1' },
3302+
})
32853303
);
32863304
expect(result.items[3]).to.deep.equal(
32873305
createExpectedCompletion('obj2', 'type: typeObj2\n options:\n description: ', 0, 2, 0, 2, 7, 2, {

0 commit comments

Comments
 (0)