【发布时间】:2018-04-18 01:54:03
【问题描述】:
我目前正在使用 typescript 为 VS 代码编写扩展。
该扩展正在尝试为类似 C 的语言创建精美的 cmets,以提高可读性和代码结构,如下所示
目前我将 cmets 对齐为 90 个字符,但我希望允许用户定义他们想要的任何对齐方式,并允许自定义填充字符
如何获取在 settings.json 中声明的设置变量?
编辑:
代码:
const config = vscode.workspace.getConfiguration('settings');
vscode.window.showInformationMessage(config.has('maximum').toString());
尽管包含
,但返回 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函数的参数是什么
【问题讨论】:
标签: typescript visual-studio-code text-editor vscode-extensions