Skip to content

Commit

Permalink
feat(completion): support detail from schema (#243)
Browse files Browse the repository at this point in the history
Co-authored-by: Martin Aeschlimann <[email protected]>
  • Loading branch information
sumimakito and aeschli authored Dec 2, 2024
1 parent 601d5eb commit 3da5591
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/jsonSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ export interface JSONSchema {
suggestSortText?: string; // VSCode extension
allowComments?: boolean; // VSCode extension
allowTrailingCommas?: boolean; // VSCode extension
completionDetail?: string; // VSCode extension
}

export interface JSONSchemaMap {
Expand Down
10 changes: 8 additions & 2 deletions src/services/jsonCompletion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,11 @@ export class JSONCompletion {
insertText: this.getInsertTextForProperty(key, propertySchema, addValue, separatorAfter),
insertTextFormat: InsertTextFormat.Snippet,
filterText: this.getFilterTextForValue(key),
documentation: this.fromMarkup(propertySchema.markdownDescription) || propertySchema.description || '',
documentation: this.fromMarkup(propertySchema.markdownDescription) || propertySchema.description || ''
};
if (propertySchema.completionDetail !== undefined) {
proposal.detail = propertySchema.completionDetail;
}
if (propertySchema.suggestSortText !== undefined) {
proposal.sortText = propertySchema.suggestSortText;
}
Expand All @@ -261,8 +264,11 @@ export class JSONCompletion {
insertText: this.getInsertTextForProperty(name, undefined, addValue, separatorAfter),
insertTextFormat: InsertTextFormat.Snippet,
filterText: this.getFilterTextForValue(name),
documentation: enumDescription || this.fromMarkup(schemaPropertyNames.markdownDescription) || schemaPropertyNames.description || '',
documentation: enumDescription || this.fromMarkup(schemaPropertyNames.markdownDescription) || schemaPropertyNames.description || ''
};
if (schemaPropertyNames.completionDetail !== undefined) {
proposal.detail = schemaPropertyNames.completionDetail;
}
if (schemaPropertyNames.suggestSortText !== undefined) {
proposal.sortText = schemaPropertyNames.suggestSortText;
}
Expand Down

0 comments on commit 3da5591

Please sign in to comment.