简体   繁体   English

VSCode 扩展激活事件 onCreate 文件

[英]VSCode extension activation event onCreate file

I'm looking for create a extension on vscode but I want to trigger it when someone create a new file.我正在寻找在 vscode 上创建扩展,但我想在有人创建新文件时触发它。 I read the documentation but I find nothing on OnCreate activation event.我阅读了文档,但在 OnCreate 激活事件上找不到任何内容。 Somebody know if it's possible to trigger this event ?有人知道是否可以触发此事件? Or why VSCode don't allow to trigger this event ?或者为什么 VSCode 不允许触发这个事件?

Thanks in advance for the response ;)预先感谢您的回复;)

As of VS Code 1.29, there is no generic fileCreated activation event. 从VS Code 1.29开始,没有通用的fileCreated激活事件。 Please file a feature request if this is something you want to see 如果您要查看此功能,提出功能请求

If you are only interested in files of a specific language, use the onLanguage: activation event . 如果您只对特定语言的文件感兴趣,请使用onLanguage:激活事件 This will be fired when a new file is created of a given language. 当使用给定语言创建新文件时将触发此事件。

Otherwise, you can activate on * . 否则,您可以在*激活。 If you do this, try to defer any extensive operations until they are really needed since your extension will always be activated 如果这样做,请尝试推迟任何繁琐的操作,直到真正需要它们为止,因为您的扩展程序将始终被激活

可以监听工作区对象上的事件: onWillCreateFilesonDidCreateFiles

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM