Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(completion): support detail from schema #243

Merged
merged 3 commits into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading