简体   繁体   English

如何从 git 存储库的本地克隆运行打字稿 vscode 扩展?

[英]How do I run a typescript vscode extension from a local clone of the git repository?

I edited the javascript of a vscode extension installed in .vscode/extensions and made a useful change.我编辑了安装在 .vscode/extensions 中的 vscode 扩展的 javascript 并进行了有用的更改。

So, I forked and checked out the git repo hoping to make a pull request.所以,我分叉并检查了 git repo,希望能提出一个拉取请求。 I found that the javascript I had edited was generated from typescript.我发现我编辑的 javascript 是从打字稿生成的。 The code was similar enough, so I made the same edits.代码非常相似,所以我做了同样的编辑。 Now I want to load this extension to test it before making a pull request.现在我想在发出拉取请求之前加载这个扩展来测试它。

I tried copying the modified repo contents to .vscode/extensions, and it shows up in the list of installed extensions.我尝试将修改后的 repo 内容复制到 .vscode/extensions,它显示在已安装的扩展列表中。 No matter how much I reload, disable, and re-enable the extension from inside of vscode, though, no javascript is generated.但是,无论我从 vscode 内部重新加载、禁用和重新启用扩展程序多少,都不会生成 javascript。

I've made sure tsc is installed and on my PATH, but this doesn't seem to make a difference.我已经确保 tsc 已安装并在我的 PATH 上,但这似乎没有什么区别。 No out directory is created, no messages appear in the debug console -- in short, it doesn't appear that anything is kicked off to compile the typescript at all.没有创建 out 目录,没有消息出现在调试控制台中——简而言之,似乎根本没有启动任何东西来编译打字稿。

The documentation I've found only talks about creating a new extension, not getting a modified existing extension to work.我发现的文档只讨论了创建新扩展,而不是让修改后的现有扩展工作。 Any pointers would be greatly appreciated.任何指针将不胜感激。

(This is on a Debian Linux system.) (这是在 Debian Linux 系统上。)

Open your repo folder in vscode as usual.像往常一样在 vscode 中打开你的 repo 文件夹。 Then create a launch config for extension development ("Add Configuration" in the Debug section, launch.json editor):然后为扩展开发创建启动配置(“调试”部分中的“添加配置”,launch.json 编辑器):

在此处输入图片说明

This should add a new launch config as extension host, with a prelaunch task of "tsc".这应该添加一个新的启动配置作为扩展主机,预启动任务为“tsc”。 You can then use this to launch a second vscode instance in debug mode where you see your changed extension, by starting a debug session.然后,您可以使用它在调试模式下启动第二个 vscode 实例,通过启动调试会话,您可以在其中看到更改的扩展名。

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

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