microsoft / microsoft/java-debug

SetBreakpointsRequestHandler fails when supplied path is using forward slashes

未关闭
#318 3 条评论 0 个 reaction 已指派 1 人 在 GitHub 查看

@testforstephen 已经在做这个了。

开始于 2020年2月7日。

ai-triaged bug enhancement
主要语言
Java
星标
409
派生
204
平均合并
1 天 13 小时
30 天内合并 PR
4

描述

Description
When a DAP (debug adapter protocol) client sends a setBreakpoints request with a path that contains forward slashes the breakpoint is not set.
The server also (wrongfully?) reports back that the command was executed successfully.

Observed behavior
The code runs without halting at the breakpoint.

Expected behavior
The program should halt at the breakpoint and send a breakpoint event to the DAP client.

Logging with forward slashes (Not working)

Sending: 
{
  "command": "setBreakpoints",
  "arguments": {
    "source": {
      "name": "Hello.java",
      "path": "c:/project/src/main/java/Hello.java"
    },
    "breakpoints": [
      {
        "line": 6
      }
    ],
    "sourceModified": false,
    "lines": [
      6
    ]
  },
  "type": "request",
  "seq": 3
}

Received:
{
  "type": "response",
  "seq": 4,
  "body": {
    "breakpoints": [
      {
        "message": "",
        "line": 6,
        "verified": null,
        "id": 1
      }
    ]
  },
  "command": "setBreakpoints",
  "request_seq": 3,
  "success": true
}

Logging with backward slashes (Working)

Sending: 
{
  "command": "setBreakpoints",
  "arguments": {
    "source": {
      "name": "Hello.java",
      "path": "c:\project\src\main\java\Hello.java"
    },
    "breakpoints": [
      {
        "line": 6
      }
    ],
    "sourceModified": false,
    "lines": [
      6
    ]
  },
  "type": "request",
  "seq": 3
}

Received:
{
  "type": "response",
  "seq": 4,
  "body": {
    "breakpoints": [
      {
        "message": "",
        "line": 6,
        "verified": true,
        "id": 1
      }
    ]
  },
  "command": "setBreakpoints",
  "request_seq": 3,
  "success": true
}

Suggestion
I think the "offending" code is here
This line behaves differently depending if forward or backward slashes have been used.
Maybe replace all forward slashes with backward slashes if we are on windows.
Could be implemented before/after the drive letter fix.

System
Windows 10
DAP Client: emacs with lsp-mode/dap-mode
DAP Server: jdtls (Eclipse language server)

贡献指南

这个仓库没有索引到贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。