Re: [PATCH] gdb/dap: stop setting CompletionItem.length

Tom Tromey <[email protected]>
Newsgroups gmane.comp.gdb.patches
Message-ID <[email protected]>
>>>>> "Oleg" == Oleg Tolmatcev <[email protected]> writes:

Oleg> Do not set the CompletionItem.length field in completions responses.
Oleg> According to the DAP spec, length says how many characters the
Oleg> completion text should overwrite. It is not the length of the
Oleg> completion label, so using the label length here is wrong.

I am not so sure about this.

The spec says:

  /**
   * Length determines how many characters are overwritten by the completion
   * text and it is measured in UTF-16 code units. If missing the value 0 is
   * assumed which results in the completion text being inserted.
   */
  length?: number;


But IIUC the gdb 'completions' result will also include whatever prefix
was supplied.

So for instance I think if we try to complete "print" we might get
results like "print_this" and "print_that".  But here we wouldn't want
to report length=0, because wouldn't that mean "the completion text
being inserted" would result in "printprint_this" and "printprint_that"?

Tom
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.