如何在打字稿文件中订阅重命名符号(例如,类名)?
我尝试进行<div
style={{
height: "32px",
opacity: scrolled ? 1 : 0,
transition: "opacity .3s",
transitionDelay: scrolled ? ".3s" : 0,
}}
>
<img
src={logo}
style={{
height: scrolled ? "100%" : 0,
transition: "height .3s",
transitionDelay: scrolled ? 0 : ".3s",
}}
/>
</div>
,但是我不想提供整个重命名实现只是为了添加一些小的功能。
以下代码将说明我要做什么:
registerRenameProvider,
我还尝试注册其他命令处理程序
export function activate(context: vscode.ExtensionContext) {
vscode.languages.registerOnSymbolRenameHook('typescript', ({newSymbolName, symbolType}) => {
// e.g. rename file if there is only one class inside && symbolType === 'class'
});
...
但不幸的是,我无法注册其他命令挂钩:
vscode.commands.registerCommand('vscode.executeDocumentRenameProvider', () => {
console.log('vscode.executeDocumentRenameProvider called!');
});