Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/361.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript WebStorm不会运行到等待行上的断点吗?_Javascript_Typescript_Webstorm - Fatal编程技术网

Javascript WebStorm不会运行到等待行上的断点吗?

Javascript WebStorm不会运行到等待行上的断点吗?,javascript,typescript,webstorm,Javascript,Typescript,Webstorm,我首先在let行、if语句行和wait行上设置一个断点 假设我在let行中断,然后按run键转到下一个断点,代码确实到达了下一个断点 但是,如果我在let行上,我可以按step over键转到const测试行,再按step over键,它会跳过if语句转到const test2行。推送run不会导致等待行,在到达test2后推送step over或into会导致我进入其他代码 作为一个以前的VisualStudio用户,这对我来说真的很奇怪。我不知道这是一个TypeScript特性,还是与Typ

我首先在let行、if语句行和wait行上设置一个断点

假设我在let行中断,然后按run键转到下一个断点,代码确实到达了下一个断点

但是,如果我在let行上,我可以按step over键转到const测试行,再按step over键,它会跳过if语句转到const test2行。推送run不会导致等待行,在到达test2后推送step over或into会导致我进入其他代码

作为一个以前的VisualStudio用户,这对我来说真的很奇怪。我不知道这是一个TypeScript特性,还是与TypeScript/JavaScript和async/await构造有关

我已经重建了几次,只是为了验证我的代码是否与服务器上运行的代码匹配

我认为等待行应该被命中,然后它应该暂停函数的其余部分

public async requestList() {

    let res = this.cache.get(serializedParam);

    const test = 'test';
    if (!res) {
        const test2 = 'test2';
        const _res = await Function(param);
     }
试试这个:

将函数声明为“async”,以便使用wait。该函数需要是异步的

async requestList() {
    let res = this.cache.get(serializedParam);

    const test = 'test';
    if (!res) {
        const test2 = 'test2';
        const _res = await Function(param);
     }
}

async  Function(param){

}

此问题与类似,请按照此问题进行更新。它只在使用sourcemaps时出现,在调试纯Javascript时单步执行效果很好

与类似,请按照它进行更新您似乎是对的,但我不能接受评论作为答案。我想知道我是否做错了什么,但这只是因为typescript源代码映射到javascript。无论如何,这是需要注意的。突然跳转到一段代码,却不知道哪些已经运行,哪些还没有运行,这是令人沮丧的