Egg: vscode eggjs 开发辅助插件

Created on 16 Mar 2017  ·  22Comments  ·  Source: eggjs/egg

https://marketplace.visualstudio.com/items?itemName=yuzukwok.eggjs-dev-tools

发布了一个vscode 插件,目前实现了service 和model 类的自动完成 和一些代码段

目前实现还是比较简单的,希望能提供更多思路打造一个完善的插件

Most helpful comment

更新:支持ctx.service 类的智能感应 (利用vscode 自身的符号功能)

All 22 comments

cool~

PS: GitHub 链接是挂的
image

image

这段是做智能提示的?有几个可以优化的点:

  1. service 这些的文件名,还需要做下处理,驼峰转换,可以看下 egg-core 的 loader
  2. @popomore 有没有可能类似你在 api docs 那边那样,抽离一个框架处理,可以用于快速导出某个应用的 api 列表,这样就可以用于智能提示了。

egg-swagger 也很需要,好像egg 在api 接口自描述文档这块没有统一标准和工具链

wiki里面加个ide插件分类

Sent from my iPhone

On 16 Mar 2017, at 5:00 PM, yuzukwok notifications@github.com wrote:

egg-swagger 也很需要,好像egg 在api 接口自描述文档这块没有统一标准和工具链


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.

更新支持了app.config 的智能感应 ,基于run 目录下文件提供的信息

@yuzukwok 👍

PS:run 某些场景下可能会滞后, 譬如我上一次运行的代码,如果现在没启动的话,改了代码,还会用旧的。

new Application 后就可以拿到 loader 了。

可以写个插件自动把 loader 加载的写入文件,这样 vscode 只要读取这个配置就好了

更新:支持ctx.service 类的智能感应 (利用vscode 自身的符号功能)

刚刚的更新太棒了! @yuzukwok

@yuzukwok 目前只能 ps 关键词

@popomore 可以考虑在 egg 或 egg-development 里面把 pid 写入到 run 目录?

584 调试的优化

支持自动附加到调试进程,优化egg调试体验(实验,待egg 或vscode优化后会移除)
先在集成控制台中使用npm run dev -- --inspect 开启调试后
命令面板 选择“egg自动附加调试进程(实验)”(默认快捷建为ctrl+1/ cmd+1) vscode 将自动附加一个node调试进程,规则如下
mac: 以--inspect= 启动的进程
windows:以调试端口>9230的调试进程

👍🏻 是 attach worker? 支持自动侦测 debug 端口么? worker 重启后端口会变

需要手工按键触发,但不需要指定port或者修改调试配置文件,自动侦测debug端口
vscode 调试配置文件restart可以自动重新attach,但是端口不变 ,所以没法用

自动 attach 可以研究下这个:

If a TerminatedEvent has an attribute 'restart' and its value is true, the debug session is restarted.

思路应该是研究下如何发出 TerminatedEvent 这个事件,可以考虑做到 egg-development 中,这样就不需要插件也能支持了。

我擦,刚发现 vscode 这块文档更新了: https://code.visualstudio.com/docs/nodejs/nodejs-debugging#_restarting-debug-sessions-automatically-when-source-is-edited

  • 新增了一个 "restart": true 不知道是否已经支持了,要试试。
  • 居然支持 The Restart Frame action allows you to re-enter the current function after you have changed variables with the Set Value action

@atian25 加了链接关闭这个 issue?

我为什么没有service和controller智能提示,只有config和plugin,需要在设置什么吗?

智能提示直接用 d.ts 即可,https://github.com/whxaxes/blog/issues/16

我为什么没有服务和控制器智能提示,只有配置和插件,需要在设置什么吗?

请问这个问题解决了吗,我也碰到了

无需用插件,看 https://zhuanlan.zhihu.com/p/56780733 的说明即可,现在支持还不错。

Was this page helpful?
0 / 5 - 0 ratings