asciidoctor-vscode icon indicating copy to clipboard operation
asciidoctor-vscode copied to clipboard

Folder level configuration for asciidoc.preview.asciidoctorAttributes

Open jxdm-dmoreau opened this issue 10 months ago • 2 comments
trafficstars

Description

When trying to configure Asciidoctor attributes at the folder level using .vscode/settings.json, the configuration is ignored. However, the same configuration works when set in VSCode's User Settings.

Steps to reproduce

  1. Create a .vscode/settings.json file in your repository with:
{
    "asciidoc.preview.asciidoctorAttributes": {
        "skip-front-matter": ""
    }
}

Open an AsciiDoc file with front matter.

---
title: Title
---

some text

The front matter is still processed in the preview, indicating the attribute is not taken into account

Other folder settings (non-preview related) work correctly, confirming that the .vscode/settings.json file is properly loaded

Analysis

Looking at the extension's source code, specifically in asciidoctorAttributesConfig.ts:

const asciidocPreviewConfig = vscode.workspace.getConfiguration('asciidoc.preview', null)

The getConfiguration method is called with null as the scope parameter. According to VSCode API documentation, this means it will only get the global configuration. To properly support folder-level configuration, the extension should probably use the appropriate scope (Uri or WorkspaceFolder) when calling getConfiguration.

Additional Information

VSCode Version: 1.96.2 Extension Version: 3.5.2 OS: Windows 11 on remote WSL Ubuntu 24.04

jxdm-dmoreau avatar Jan 07 '25 15:01 jxdm-dmoreau