Skip to content

Commit 3da5591

Browse files
sumimakitoaeschli
andauthored
feat(completion): support detail from schema (#243)
Co-authored-by: Martin Aeschlimann <[email protected]>
1 parent 601d5eb commit 3da5591

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/jsonSchema.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ export interface JSONSchema {
8585
suggestSortText?: string; // VSCode extension
8686
allowComments?: boolean; // VSCode extension
8787
allowTrailingCommas?: boolean; // VSCode extension
88+
completionDetail?: string; // VSCode extension
8889
}
8990

9091
export interface JSONSchemaMap {

src/services/jsonCompletion.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,8 +237,11 @@ export class JSONCompletion {
237237
insertText: this.getInsertTextForProperty(key, propertySchema, addValue, separatorAfter),
238238
insertTextFormat: InsertTextFormat.Snippet,
239239
filterText: this.getFilterTextForValue(key),
240-
documentation: this.fromMarkup(propertySchema.markdownDescription) || propertySchema.description || '',
240+
documentation: this.fromMarkup(propertySchema.markdownDescription) || propertySchema.description || ''
241241
};
242+
if (propertySchema.completionDetail !== undefined) {
243+
proposal.detail = propertySchema.completionDetail;
244+
}
242245
if (propertySchema.suggestSortText !== undefined) {
243246
proposal.sortText = propertySchema.suggestSortText;
244247
}
@@ -261,8 +264,11 @@ export class JSONCompletion {
261264
insertText: this.getInsertTextForProperty(name, undefined, addValue, separatorAfter),
262265
insertTextFormat: InsertTextFormat.Snippet,
263266
filterText: this.getFilterTextForValue(name),
264-
documentation: enumDescription || this.fromMarkup(schemaPropertyNames.markdownDescription) || schemaPropertyNames.description || '',
267+
documentation: enumDescription || this.fromMarkup(schemaPropertyNames.markdownDescription) || schemaPropertyNames.description || ''
265268
};
269+
if (schemaPropertyNames.completionDetail !== undefined) {
270+
proposal.detail = schemaPropertyNames.completionDetail;
271+
}
266272
if (schemaPropertyNames.suggestSortText !== undefined) {
267273
proposal.sortText = schemaPropertyNames.suggestSortText;
268274
}

0 commit comments

Comments
 (0)