Repository: vscode
Issue: DAP completions mishandled
Labels: bug,debug


Type: <b>Bug</b>

1. install a debugger that supports the DAP completions request (or write your own!)
2. assuming it's targeting gdb, in the debug console type 'help b' and wait for completions to appear
3. select 'help breakpoints' and press tab
4. note how 'help b' becomes 'help help breakpoints'.

I'm writing (yet another) gdb adapter, and was struggling to get the completions to work as advertised. I've also seen this behaviour on vGDB.
After investigation I know where the bug is, and I could create a pull request, but it might be quicker to just show you:

src/vs/workbench/contrib/debug/browser/repl.ts(273)
```
	//const word = model.getWordAtPosition(position);
	//const overwriteBefore = word ? word.word.length : 0;
	const overwriteBefore = position.column;
```

The issue is the DAP completion request and response are not relative to word boundaries, so the processing of them in the DebugConsole shouldn't be processing them as if they are.

VS Code version: Code 1.96.4 (Universal) (cd4ee3b1c348a13bafd8f9ad8060705f6d4b9cba, 2025-01-16T00:16:19.038Z)
OS version: Darwin arm64 24.1.0
Modes:
Remote OS version: Linux x64 5.10.60-qnap

<details>
<summary>System Info</summary>

|Item|Value|
|---|---|
|CPUs|Apple M4 (10 x 2400)|
|GPU Status|2d_canvas: enabled<br>canvas_oop_rasterization: enabled_on<br>direct_rendering_display_compositor: disabled_off_ok<br>gpu_compositing: enabled<br>multiple_raster_threads: enabled_on<br>opengl: enabled_on<br>rasterization: enabled<br>raw_draw: disabled_off_ok<br>skia_graphite: disabled_off<br>video_decode: enabled<br>video_encode: enabled<br>webgl: enabled<br>webgl2: enabled<br>webgpu: enabled<br>webnn: disabled_off|
|Load (avg)|3, 3, 4|
|Memory (System)|16.00GB (0.09GB free)|
|Process Argv|--crash-reporter-id 6e06ef7f-0758-449d-bad8-b85f9dd6a2fc|
|Screen Reader|no|
|VM|0%|

|Item|Value|
|---|---|
|Remote|SSH: ubuntu-2404np|
|OS|Linux x64 5.10.60-qnap|
|CPUs|Intel(R) Celeron(R) CPU  J1900  @ 1.99GHz (4 x 2417)|
|Memory (System)|7.66GB (5.53GB free)|
|VM|22%|
</details><details><summary>Extensions (38)</summary>

Extension|Author (truncated)|Version
---|---|---
process-matcher|abd|0.0.3
android-dev-ext|ade|1.4.0
rtf|ale|2.8.0
amazon-q-vscode|ama|1.43.0
fast-tasks|bat|0.0.11
vscode-eslint|dba|3.0.10
vscode-commands|fab|2.0.2
copilot|Git|1.257.0
copilot-chat|Git|0.23.2
gitweb|iso|1.0.1
modules|iso|1.0.1
mugdb|iso|0.0.0
better-cpp-syntax|jef|1.27.1
svn-scm|joh|2.17.0
git-graph|mhu|1.30.0
vscode-dotnet-runtime|ms-|2.2.5
debugpy|ms-|2024.14.0
python|ms-|2024.22.2
vscode-pylance|ms-|2024.12.1
jupyter|ms-|2024.11.0
jupyter-keymap|ms-|1.1.2
jupyter-renderers|ms-|1.0.21
vscode-jupyter-cell-tags|ms-|0.1.9
vscode-jupyter-slideshow|ms-|0.1.6
remote-ssh|ms-|0.116.1
remote-ssh-edit|ms-|0.87.0
cmake-tools|ms-|1.19.52
cpptools|ms-|1.22.11
cpptools-extension-pack|ms-|1.3.0
hexeditor|ms-|1.11.1
remote-explorer|ms-|0.4.3
vscode-serial-monitor|ms-|0.13.1
platformio-ide|pla|3.3.4
rust-analyzer|rus|0.3.2273
vscode-3dviewer|sle|0.2.2
memento-inputs|spa|1.0.0
cmake|twx|0.0.17
cursor-align|yo1|2.1.1

(1 theme extensions excluded)

</details><details>
<summary>A/B Experiments</summary>

```
vsliv368:30146709
vspor879:30202332
vspor708:30202333
vspor363:30204092
vscod805:30301674
binariesv615:30325510
vsaa593cf:30376535
py29gd2263:31024239
c4g48928:30535728
azure-dev_surveyone:30548225
2i9eh265:30646982
962ge761:30959799
pythonnoceb:30805159
pythonmypyd1:30879173
2e7ec940:31000449
pythontbext0:30879054
cppperfnew:31000557
dsvsc020:30976470
pythonait:31006305
dsvsc021:30996838
dvdeprecation:31068756
dwnewjupytercf:31046870
nativerepl2:31139839
pythonrstrctxt:31112756
nativeloc2:31192216
cf971741:31144450
iacca1:31171482
notype1cf:31157160
5fd0e150:31155592
dwcopilot:31170013
stablechunks:31184530
6074i472:31201624
dwoutputs:31217127

```

</details>

<!-- generated by issue reporter -->