fix: Add editors to ContributionConfig and additional properties to EditorKeyword (#38098)

This commit is contained in:
Michael S. Molina
2026-02-19 15:00:21 -03:00
committed by GitHub
parent f049d3e34a
commit 1f76944c2b
8 changed files with 17 additions and 7 deletions

View File

@@ -88,6 +88,10 @@ class ContributionConfig(BaseModel):
default_factory=dict,
description="Menu contributions by scope and location",
)
editors: list[dict[str, Any]] = Field(
default_factory=list,
description="Editor contributions",
)
class BaseExtension(BaseModel):

View File

@@ -294,6 +294,10 @@ export interface EditorKeyword {
meta?: string;
/** Sorting priority; higher scores appear first in the completion list */
score?: number;
/** Short supplementary text such as a type signature or the full value when truncated */
detail?: string;
/** Longer documentation content as an HTML string, shown in a documentation popup */
documentation?: string;
}
/**

View File

@@ -295,7 +295,7 @@ test('returns column keywords among selected tables', async () => {
);
});
test('returns long keywords with docText', async () => {
test('returns long keywords with detail', async () => {
const expectLongKeywordDbId = 2;
const longKeyword = 'veryveryveryveryverylongtablename';
const dbFunctionNamesApiRoute = `glob:*/api/v1/database/${expectLongKeywordDbId}/function_names/`;
@@ -335,7 +335,7 @@ test('returns long keywords with docText', async () => {
expect.objectContaining({
name: longKeyword,
value: longKeyword,
docText: longKeyword,
detail: longKeyword,
}),
),
);

View File

@@ -55,7 +55,7 @@ const { useQueryState: useTablesQueryState } = tableEndpoints.tables;
const getHelperText = (value: string) =>
value.length > 30 && {
docText: value,
detail: value,
};
const extensionsRegistry = getExtensionsRegistry();

View File

@@ -189,6 +189,8 @@ const toAceKeyword = (keyword: EditorKeyword): AceCompleterKeyword => ({
value: keyword.value ?? keyword.name,
score: keyword.score ?? 0,
meta: keyword.meta ?? '',
docText: keyword.detail,
docHTML: keyword.documentation,
});
/**

View File

@@ -184,13 +184,13 @@ test('passes keywords as objects to SQLEditorWithValidation for autocomplete', (
expect(keyword).toHaveProperty('meta');
});
// Verify column keywords specifically have docHTML for rich tooltips
// Verify column keywords specifically have documentation for rich tooltips
const columnKeywords = keywords.filter(
(k: Record<string, unknown>) => k.meta === 'column',
);
expect(columnKeywords.length).toBe(2); // We passed 2 columns
columnKeywords.forEach((keyword: Record<string, unknown>) => {
expect(keyword).toHaveProperty('docHTML');
expect(keyword).toHaveProperty('documentation');
});
});

View File

@@ -31,7 +31,7 @@ test('returns HTML for a column tooltip', () => {
expect(getColumnKeywords([expected])).toContainEqual({
name: expected.column_name,
value: expected.column_name,
docHTML: expect.stringContaining(expected.description),
documentation: expect.stringContaining(expected.description),
score: 50,
meta: 'column',
});

View File

@@ -34,7 +34,7 @@ export function getColumnKeywords(columns: ColumnMeta[]) {
}) => ({
name: verbose_name || column_name,
value: column_name,
docHTML: getTooltipHTML({
documentation: getTooltipHTML({
title: column_name,
body: `type: ${type || 'unknown'}<br />${description ? `description: ${description}` : ''}`,
footer: is_certified ? t('Certified by %s', certified_by) : undefined,