VS code api 如何在设置中支持自定义变量?

VS code api how to support customizable variables in settings?

我目前正在使用打字稿为 VS 代码编写扩展。

该扩展正在尝试为类似 C 的语言创建花哨的注释,以提高可读性和代码结构,如下所示

目前我以 90 个字符对齐注释,但我希望允许用户定义他们想要的任何对齐方式,并允许自定义填充字符

如何获取在 settings.json 中声明的设置变量?

编辑:

代码:

const config = vscode.workspace.getConfiguration('settings');
vscode.window.showInformationMessage(config.has('maximum').toString());

Returns false 尽管包含

"configuration": {
    "maximum":
    {
        "type": ["integer"],
        "default": 40,
        "description": "The level of alignment, how far the titles will extend horizontally"
    }
}

在 package.json 文件的贡献部分。我看了在线文档和源代码,但我不清楚如何读取用户设置值。

应该修改哪个JSON文件,需要给getConfiguration()提供什么参数? API 没有清楚地解释 taht 函数的参数是什么

// launch.json configuration
const config = workspace.getConfiguration('launch', vscode.window.activeTextEditor.document.uri);

// retrieve values
const values = config.get('configurations');

https://code.visualstudio.com/api/references/vscode-api#WorkspaceConfiguration