我正在编写自定义陪同规则。规则在代码中标记了正确的位置,但是Visual Studio Code没有提供我的快速修复程序。
这是代码的开头:
module.exports = {
meta: {
type: "suggestion",
docs: {
description: "Use design tokens",
category: "Design System",
recommended: false
},
fixable: "code"
},
这是我报告问题的地方:
for (const m of matchedTokens) {
suggest.push({
desc: property.value.raw + " should be " + m,
fix(fixer) {
return fixer.replaceText(property.value, m);
}
})
}
context.report({
node: property,
message: 'Possible value for replacement of {{ key }} with design token',
data: {
key: property.key.name
},
suggest
})
如何使建议在IDE中起作用?我期望这些正确显示在Visual Studio
代码中是否正确?我还需要采取其他措施来修正问题吗?