如何为类似VS的语言为TypeScript提供源代码级调试? [英] How do I provide source-level debugging for a language like VS does for TypeScript?

查看:112
本文介绍了如何为类似VS的语言为TypeScript提供源代码级调试?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我理解使用JavaScript的源地图的概念,以便通过精简脚本等来调试更容易。我没有得到的是源代码级调试的工作原理,就像Visual Studio中的TypeScript一样( http://blogs.msdn.com/ b / typescript / archive / 2012/11/15 / announcing-typescript-0-8-1.aspx )。



例如,如果我创建我自己的语言编译/翻译为JavaScript,我如何与浏览器进行接口来提供这种源代码级调试?这是否有标准协议? Visual Studio如何做?



更新



假设我发明了一种称为咖啡因饮料脚本的语言,它编译为JavaScript。我为我的语言构建一个IDE,并且我想要能够在JavaScript在浏览器中运行时在我的IDE中设置断点,逐步执行代码,检查变量等。如何让IDE与浏览器进行通信?

解决方案

您可能会考虑使用WebKit的远程调试API: p>

https: //developers.google.com/chrome-developer-tools/docs/protocol/1.0/index



我相信这是Sublime Web Inspector使用的。 / p>

https://github.com/sokolovstas/SublimeWebInspector


I understand the concept of using source maps with JavaScript to make debugging easier with minified scripts, etc. What I don't get is how source-level debugging works like it does for TypeScript in Visual Studio (http://blogs.msdn.com/b/typescript/archive/2012/11/15/announcing-typescript-0-8-1.aspx).

For example, if I create my own language that compiles/translates to JavaScript, how do I interface with browsers to provide this kind of source-level debugging? Is there a standard protocol for this? How does Visual Studio do it?

Update

To clarify even more, let's say I invent a language called Caffeinated Beverage Script that compiles to JavaScript. I build an IDE for my language and I want to be able to set breakpoints, step through code, inspect variables, etc. in my IDE while the JavaScript runs in a browser. How do I get my IDE to communicate with the browser on this level?

解决方案

You might consider WebKit's remote debugging API:

https://developers.google.com/chrome-developer-tools/docs/protocol/1.0/index

I believe that's what Sublime Web Inspector uses.

https://github.com/sokolovstas/SublimeWebInspector

这篇关于如何为类似VS的语言为TypeScript提供源代码级调试?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆