Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

completion on breakpoint remove all items #160373

Open
APerricone opened this issue Sep 8, 2022 · 10 comments
Open

completion on breakpoint remove all items #160373

APerricone opened this issue Sep 8, 2022 · 10 comments
Assignees
Labels
debug Debug viewlet, configurations, breakpoints, adapter issues feature-request Request for new features or functionality
Milestone

Comments

@APerricone
Copy link

Type: Bug/Feature request

when create an expression for a breakpoint looks like it does not handle correctly the world split.
I can explain it only by images, on my code If I try to complete a word it gives a lot of result:
image
But if the same word is after a logical operator the result are much less:
image

VS Code version: Code 1.71.0 (784b017, 2022-09-01T07:36:10.600Z)
OS version: Windows_NT x64 10.0.19044
Modes:
Sandboxed: No

System Info
Item Value
CPUs AMD Ryzen 5 2500U with Radeon Vega Mobile Gfx (8 x 1996)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_renderer: enabled_on
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: disabled_off
Load (avg) undefined
Memory (System) 6.90GB (0.98GB free)
Process Argv --crash-reporter-id 16bc8c7e-027f-4165-8229-92f97b9f44b4
Screen Reader no
VM 67%
Extensions (23)
Extension Author (truncated) Version
harbour ape 1.0.4
regexper-unofficial ape 0.0.3
doxdocgen csc 1.4.0
typescript-notebook don 2.0.6
vscode-npm-script eg2 0.3.28
better-cpp-syntax jef 1.15.19
vscode-language-pack-it MS- 1.71.9070919
csharp ms- 1.25.0
python ms- 2022.14.0
vscode-pylance ms- 2022.9.10
jupyter ms- 2022.8.1002431955
jupyter-keymap ms- 1.0.0
jupyter-renderers ms- 1.0.9
remote-containers ms- 0.251.0
remote-ssh ms- 0.84.0
cmake-tools ms- 1.12.26
cpptools ms- 1.12.4
cpptools-extension-pack ms- 1.3.0
hexeditor ms- 1.9.8
notepadplusplus-keybindings ms- 1.0.7
vscode-yaml red 1.10.1
LiveServer rit 5.7.9
cmake twx 0.0.17

(2 theme extensions excluded)

A/B Experiments
vsliv368:30146709
vsreu685:30147344
python383cf:30185419
vspor879:30202332
vspor708:30202333
vspor363:30204092
vswsl492cf:30256860
vslsvsres303:30308271
pythonvspyl392:30443607
vserr242:30382549
pythontb:30283811
vsjup518:30340749
pythonptprofiler:30281270
vshan820:30294714
vstes263:30335439
pythondataviewer:30285071
vscod805cf:30301675
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
cmake_vspar411:30557514
vsaa593cf:30376535
pythonvs932:30410667
cppdebug:30492333
vscaat:30438848
pylanb8912:30545647
vsclangdc:30486549
c4g48928:30535728
hb751961:30553087
dsvsc012cf:30540253
azure-dev_surveyone:30548225
i497e931:30553904

oard because it was too large to send. Please paste.
@APerricone
Copy link
Author

I saw it working on microsoft/vscode-languageserver-node#1072

@weinand weinand added the debug Debug viewlet, configurations, breakpoints, adapter issues label Sep 8, 2022
@weinand weinand assigned roblourens and unassigned weinand Sep 8, 2022
@roblourens
Copy link
Member

Sorry @dbaeumer I don't really know how this works, this editor just calls provideSuggestionItems from the beginning of the line, is there some other parsing that I am supposed to do on my end?

https://github.com/9at8/vscode/blob/64e7e2ba5baf3899572e8070b85db34200312f69/src/vs/workbench/contrib/debug/browser/breakpointWidget.ts#L251

@roblourens roblourens added the info-needed Issue requires more information from poster label Sep 8, 2022
@dbaeumer
Copy link
Member

dbaeumer commented Sep 9, 2022

@roblourens in LSP completions work the same way as normal API. So I am wondering how breakpoint completion works in a scenario where the completion provider is registered on the VS Code API directly (without any LSP). Do we have an example? Then I could explain what needs to be done in an LSP world.

@roblourens
Copy link
Member

I don't think there's a difference between the two, for this code. @isidorn do you happen to know what might be missing here?

@isidorn
Copy link
Contributor

isidorn commented Sep 12, 2022

@roblourens no, sorry. I think that the trick we are doing here is to "pretend" like the user is typing in the editor below, and not in the BreakpointWidget itself to get all the intelli-sense goodness.

@roblourens
Copy link
Member

I think that with this approach, we basically get variables that are in the scope of the main editor, then they are filtered by the text in the breakpoint widget editor. But the text in the breakpoint widget editor is never taken into account when getting completions. If I type foo.b it doesn't know that I am typing in the context of foo. so can't return foo.bar. I'm guessing this is how it's always worked but the only related issue I can find is #61357, I'm surprised there aren't more.

I think we would need something like a fake textmodel which has the code in the breakpoint widget editor inserted into that spot in the editor model, so that completions are requested with full context. I'm not really sure that's practical.

@roblourens roblourens added feature-request Request for new features or functionality and removed info-needed Issue requires more information from poster labels Sep 13, 2022
@roblourens roblourens added this to the Backlog milestone Sep 13, 2022
@isidorn
Copy link
Contributor

isidorn commented Sep 13, 2022

I confirm this is how it always worked. And I believe your interpretation is spot on.

@roblourens
Copy link
Member

@dbaeumer does LSP itself offer anything for this scenario? The scenario basically being, give me completions for this position in this document, BUT with this extra code context (the code I am typing in the breakpoint widget).

It would be nice for this to work fully but I would have to consult with another expert since the other options I can think of seem like bad hacks

  1. Create a new text model which is a copy of the real editor's model plus the input from the breakpoint widget
  2. Insert the breakpoint widget text into the real document, request completions, then delete it

@dbaeumer
Copy link
Member

@roblourens LSP has no support for this scenario. IMO if we want to provide this we need some API in VS Code as well.

@connor4312
Copy link
Member

Related: #48810

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
debug Debug viewlet, configurations, breakpoints, adapter issues feature-request Request for new features or functionality
Projects
None yet
Development

No branches or pull requests

6 participants