Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vscode eggjs 开发辅助插件 #583

Closed
yuzukwok opened this issue Mar 16, 2017 · 22 comments · Fixed by #756
Closed

vscode eggjs 开发辅助插件 #583

yuzukwok opened this issue Mar 16, 2017 · 22 comments · Fixed by #756

Comments

@yuzukwok
Copy link

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

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

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

@atian25
Copy link
Member

atian25 commented Mar 16, 2017

cool~

PS: GitHub 链接是挂的
image

@atian25
Copy link
Member

atian25 commented Mar 16, 2017

image

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

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

@yuzukwok
Copy link
Author

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

@fengmk2
Copy link
Member

fengmk2 commented Mar 16, 2017 via email

@yuzukwok
Copy link
Author

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

@atian25
Copy link
Member

atian25 commented Mar 16, 2017

@yuzukwok 👍

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

@popomore
Copy link
Member

new Application 后就可以拿到 loader 了。

@popomore
Copy link
Member

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

@yuzukwok
Copy link
Author

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

@alastairruhm
Copy link

刚刚的更新太棒了! @yuzukwok

@atian25
Copy link
Member

atian25 commented Mar 18, 2017

@yuzukwok 目前只能 ps 关键词

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

@yuzukwok
Copy link
Author

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

@atian25
Copy link
Member

atian25 commented Mar 18, 2017

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

@yuzukwok
Copy link
Author

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

@atian25
Copy link
Member

atian25 commented Mar 26, 2017

自动 attach 可以研究下这个:

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

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

@atian25
Copy link
Member

atian25 commented Mar 26, 2017

我擦,刚发现 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

@popomore
Copy link
Member

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

@atian25
Copy link
Member

atian25 commented Apr 14, 2017

好,加到 https://eggjs.org/zh-cn/resource.html 好了

@huchun666
Copy link

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

@atian25
Copy link
Member

atian25 commented Jan 20, 2019

智能提示直接用 d.ts 即可,whxaxes/blog#16

@baojunGit
Copy link

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

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

@atian25
Copy link
Member

atian25 commented Mar 15, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants