请帮助从配置贡献点读取配置值。在${extension_path}\package.json
中,我接下来的部分:
{
"name": "markdown-table-of-contents",
"displayName": "Generate table of contents for markdown",
"publisher": "dkultasev",
"description": "",
"version": "0.0.1",
"engines": {
"vscode": "^1.31.0"
},
"categories": [
"Other"
],
"activationEvents": [
"onCommand:extension.sqlGenerateYAMLComment"
],
"main": "./out/extension.js",
"contributes": {
"configuration": {
"title": "Default name to use for YAML comment block",
"properties": {
"markdown-table-of-contents.author_name": {
"type": [
"string",
"Change Name"
],
"default": null,
"description": "Specify default name when generating YAML comment block"
}
}
}
...
然后在extension_folder\.vscode\settings.json
中设置"markdown-table-of-contents.author_name": "Dmitrij Kultasev"
,并在扩展代码中尝试获取以下值:
const name = vscode.workspace.getConfiguration('markdown-table-of-contents').get('author_name');
它是Change Name
,但我希望Dmitrij Kultasev
在settings.json
文件中配置