microsoft / microsoft/java-debug

CompletionItem of completions response always have `start = 0` and text prefix inclusion is mixed

オープン
#524 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

ai-triaged bug
主要言語
Java
スター
409
フォーク
204
平均マージ
1日 13時間
マージ済み PR(30日)
4

説明

I noticed recently that in nvim-dap, if you complete com. and select an entry you get com.com... inserted, so today I took a closer look and noticed that the responses from java-debug are somewhat odd - and I think incorrect.

With a client that specified columnsStartAt1 = true, and a completions payload like:

{
    frameId = <frameId>,
    text = "List.",
    column = 6
}

The responses include:

  }, {
    label = "of(E e1, E e2, E e3, E e4) : List<E>",
    number = 0,
    sortText = "999999179",
    start = 0,
    text = "of()",
    type = "function"
  }, {

The specification says:

/**

  • Start position (within the text attribute of the completions request)
  • where the completion text is added. The position is measured in UTF-16 code
  • units and the client capability columnsStartAt1 determines whether it is
  • 0- or 1-based. If the start position is omitted the text is added at the
  • location specified by the column attribute of the completions request.
    */
    start?: number;

The expected result for the user is to have List.of() if the completion candidate is selected. Now, start=0 is already odd given the columnsStartAt1, so a possible interpretation in the client is that it's absent, and that the client should just append .of()

This is kinda what I did in nvim-dap so far, and it works for the List.of case, and also for variables, but with a payload like:

{
  column = 5,
  frameId = <frameId>,
  text = "com."
}

I get responses like:

  }, {
    label = "com.sun.tools.example",
    number = 0,
    sortText = "999999183",
    start = 0,
    text = "com.sun.tools.example",
    type = "module"
  }, {

Opposed to the List. result, here text includes the prefix com. and it's again start=0. This led to com.com.sun.tools.example

I suspect vscode does some kind of prefix matching on the client side again, so this isn't noticable there?
As far as I can tell, based on the specification the current behavior is wrong.

I used JDK 21 in my tests - in case it matters.
I can also provide some sample project if needed - but I tried to use examples that should behave similar with only the JDK as dependency

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず、レポートにある JDK 21 の例を使用して、Java デバッグサーバーにおける completions リクエストと CompletionItem レスポンスの DAP 補完処理を追跡します。nvim-dap などのクライアントで List.com. のケースを再現し、その後、starttext が DAP 仕様に従っていること、および各候補を選択するとプレフィックスを重複させずに期待どおりの補完が挿入されることを検証します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
java
領域
devtools
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。