diff --git a/README.md b/README.md index 660baf8..619a8c9 100644 --- a/README.md +++ b/README.md @@ -7,8 +7,8 @@ - `markuplint.enable`: Control whether markuplint is enabled for HTML files or not - `markuplint.debug`: Enable debug mode - `markuplint.defaultConfig`: It's the configuration specified if configuration files do not exist -- `markuplint.showAccessibility`: Enable the feature that **popup Accessibility Object** -- `markuplint.showAccessibility.ariaVersion`: Set `1.1` or `1.2` WAI-ARIA version; Default is `1.2`. +- `markuplint.hover.accessibility.enable`: Enable the feature that **popup Accessibility Object** +- `markuplint.hover.accessibility.ariaVersion`: Set `1.1` or `1.2` WAI-ARIA version; Default is `1.2`. ## Release Notes diff --git a/package.json b/package.json index bfb7634..ecc0de3 100644 --- a/package.json +++ b/package.json @@ -64,6 +64,20 @@ "markuplint:recommended" ] } + }, + "markuplint.hover.accessibility.enable": { + "type": "boolean", + "markdownDescription": "Enable the feature that **popup Accessibility Object**", + "default": true + }, + "markuplint.hover.accessibility.ariaVersion": { + "type": "string", + "enum": [ + "1.1", + "1.2" + ], + "markdownDescription": "Set `1.1` or `1.2` WAI-ARIA version; Default is `1.2`.", + "default": "1.2" } } }, diff --git a/src/server/server.ts b/src/server/server.ts index 99cc1e8..04dea73 100644 --- a/src/server/server.ts +++ b/src/server/server.ts @@ -139,13 +139,13 @@ export async function bootServer() { connection.onHover(async (params) => { const { langConfigs } = await initialized; - const showAccessibility = langConfigs['html']?.showAccessibility ?? true; + const accessibilityConfig = langConfigs['html']?.hover.accessibility ?? { enable: true, ariaVersion: '1.2' }; - if (!showAccessibility) { + if (!accessibilityConfig.enable) { return; } - const ariaVersion = typeof showAccessibility === 'boolean' ? '1.2' : showAccessibility.ariaVersion; + const ariaVersion = accessibilityConfig.ariaVersion; const node = v3.getNodeWithAccessibilityProps(params.textDocument, params.position, ariaVersion); @@ -157,8 +157,8 @@ export async function bootServer() { const props = node.exposed ? `${Object.entries(node.aria) - .map(([key, value]) => `- ${key}: ${value}`) - .join('\n')}` + .map(([key, value]) => `- ${key}: ${value}`) + .join('\n')}` : '\n**No exposed to accessibility tree** (hidden element)'; return { diff --git a/src/types.ts b/src/types.ts index 2a3d2f8..cde66d6 100644 --- a/src/types.ts +++ b/src/types.ts @@ -12,11 +12,12 @@ export type Config = { enable: boolean; debug: boolean; defaultConfig: MLConfig; - showAccessibility: - | boolean - | { - ariaVersion: ARIAVersion; - }; + hover: { + accessibility: { + enable: boolean; + ariaVersion: ARIAVersion; + }; + } }; export type LangConfigs = Record;