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

vscode: add support for debug/toolbar, debug/variables/context menus contribution and debugState when clause context #11871

Closed
kittaakos opened this issue Nov 16, 2022 · 3 comments · Fixed by #11984
Assignees
Labels
debug issues that related to debug functionality vscode issues related to VSCode compatibility

Comments

@kittaakos
Copy link
Contributor

kittaakos commented Nov 16, 2022

Feature Description:

Add support for the following in Theia to improve the VS Code compatibility:


Steps to reproduce:

  • Check out the vscode-mock-debug--theia branch in my fork,
  • Build and start Theia from the sources (make sure to run yarn download:plugins to make the mock debugger VS Code extension available before Theia start),
  • Open the sampleWorkspace folder from Microsoft/vscode-mock-debug repo as a workspace in Theia,
  • Open the Debug view and start Debug readme.md,

Screen Shot 2022-11-16 at 17 05 57

2022-11-16T15:08:02.683Z root WARN Failed to register a menu item for plugin kittaakos.mock-debug contributed to debug/toolBar {
  command: 'extension.mock-debug.sayHello',
  submenu: undefined,
  alt: undefined,
  group: 'navigation',
  when: "debugType == 'mock'"
} Error: Could not find submenu with id debug/toolBar
    at MenuModelRegistry.getMenuNode (file:///Users/a.kitta/dev/git/theia/examples/electron/lib/bundle.js:137499:23)
    at file:///Users/a.kitta/dev/git/theia/examples/electron/lib/packages_plugin-ext_lib_hosted_browser_hosted-plugin_js.js:6634:66
    at Array.forEach (<anonymous>)
    at MenusContributionPointHandler.handle (file:///Users/a.kitta/dev/git/theia/examples/electron/lib/packages_plugin-ext_lib_hosted_browser_hosted-plugin_js.js:6628:37)
    at file:///Users/a.kitta/dev/git/theia/examples/electron/lib/packages_plugin-ext_lib_hosted_browser_hosted-plugin_js.js:7350:71
    at pushContribution (file:///Users/a.kitta/dev/git/theia/examples/electron/lib/packages_plugin-ext_lib_hosted_browser_hosted-plugin_js.js:7245:32)
    at PluginContributionHandler.handleContributions (file:///Users/a.kitta/dev/git/theia/examples/electron/lib/packages_plugin-ext_lib_hosted_browser_hosted-plugin_js.js:7350:9)
    at HostedPluginSupport.loadContributions (file:///Users/a.kitta/dev/git/theia/examples/electron/lib/packages_plugin-ext_lib_hosted_browser_hosted-plugin_js.js:446:61)
    at HostedPluginSupport.doLoad (file:///Users/a.kitta/dev/git/theia/examples/electron/lib/packages_plugin-ext_lib_hosted_browser_hosted-plugin_js.js:358:42)
    at async ProgressService.withProgress (file:///Users/a.kitta/dev/git/theia/examples/electron/lib/bundle.js:140547:20)
2022-11-16T15:08:02.681Z root WARN Failed to register a menu item for plugin kittaakos.mock-debug contributed to debug/variables/context {
  command: 'extension.mock-debug.sayVariableContextMenu',
  submenu: undefined,
  alt: undefined,
  group: 'navigation',
  when: "inDebugMode && debugType == 'mock' && debugState == stopped"
} Error: Could not find submenu with id debug/variables/context
    at MenuModelRegistry.getMenuNode (file:///Users/a.kitta/dev/git/theia/examples/electron/lib/bundle.js:137499:23)
    at file:///Users/a.kitta/dev/git/theia/examples/electron/lib/packages_plugin-ext_lib_hosted_browser_hosted-plugin_js.js:6634:66
    at Array.forEach (<anonymous>)
    at MenusContributionPointHandler.handle (file:///Users/a.kitta/dev/git/theia/examples/electron/lib/packages_plugin-ext_lib_hosted_browser_hosted-plugin_js.js:6628:37)
    at file:///Users/a.kitta/dev/git/theia/examples/electron/lib/packages_plugin-ext_lib_hosted_browser_hosted-plugin_js.js:7350:71
    at pushContribution (file:///Users/a.kitta/dev/git/theia/examples/electron/lib/packages_plugin-ext_lib_hosted_browser_hosted-plugin_js.js:7245:32)
    at PluginContributionHandler.handleContributions (file:///Users/a.kitta/dev/git/theia/examples/electron/lib/packages_plugin-ext_lib_hosted_browser_hosted-plugin_js.js:7350:9)
    at HostedPluginSupport.loadContributions (file:///Users/a.kitta/dev/git/theia/examples/electron/lib/packages_plugin-ext_lib_hosted_browser_hosted-plugin_js.js:446:61)
    at HostedPluginSupport.doLoad (file:///Users/a.kitta/dev/git/theia/examples/electron/lib/packages_plugin-ext_lib_hosted_browser_hosted-plugin_js.js:358:42)
    at async ProgressService.withProgress (file:///Users/a.kitta/dev/git/theia/examples/electron/lib/bundle.js:140547:20)

Missing features:

  1. The custom command is missing from the debug toolbar (debug/toolbar).
    Screen Shot 2022-11-16 at 17 51 09

    Screen Shot 2022-11-16 at 17 04 53
  2. The context menu is unavailable for the Variables view (debug/variables/context).
    Screen Shot 2022-11-16 at 15 05 53
    Screen Shot 2022-11-16 at 17 06 22

  3. The debugState when context is undefined. It should be one of the following: 'inactive', 'initializing', 'stopped', 'running'. To verify this, I have written a sample command to show the when context value for a key.

    • inDebugMode is supported, ✅
    • debugType is supported, ✅
    • debugState is undefined. ❌
      Screen Shot 2022-11-16 at 17 00 14
      Screen Shot 2022-11-16 at 17 00 25
      Screen Shot 2022-11-16 at 17 00 46
@kittaakos
Copy link
Contributor Author

I will take care of this issue.

kittaakos pushed a commit to kittaakos/arduino-ide that referenced this issue Nov 24, 2022
kittaakos pushed a commit to arduino/arduino-ide that referenced this issue Nov 28, 2022
kittaakos pushed a commit to arduino/arduino-ide that referenced this issue Nov 29, 2022
kittaakos pushed a commit to arduino/arduino-ide that referenced this issue Nov 29, 2022
kittaakos pushed a commit to arduino/arduino-ide that referenced this issue Dec 1, 2022
kittaakos pushed a commit to kittaakos/theia that referenced this issue Dec 13, 2022
 - feat: aded support for `debug/toolbar` and `debug/variables/context`,
 - feat: added support for `debugState` when context (eclipse-theia#11871),
 - feat: can customize debug session timeout, and error handling (eclipse-theia#11879),
 - fix: the `debugType` context that is not updated,
 - fix: `configure` must happen after receiving capabilities (eclipse-theia#11886),
 - fix: added missing conext menu in the _Variables_ view,
 - fix: handle `setFunctionBreakboints` response with no `body` (eclipse-theia#11885),
 - fix: `DebugExt` fires `didStart` event on `didCreate` (eclipse-theia#11916)

Closes eclipse-theia#11871
Closes eclipse-theia#11879
Closes eclipse-theia#11885
Closes eclipse-theia#11886
Closes eclipse-theia#11916

Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
kittaakos pushed a commit to kittaakos/theia that referenced this issue Dec 13, 2022
 - feat: aded support for `debug/toolbar` and `debug/variables/context`,
 - feat: added support for `debugState` when context (eclipse-theia#11871),
 - feat: can customize debug session timeout, and error handling (eclipse-theia#11879),
 - fix: the `debugType` context that is not updated,
 - fix: `configure` must happen after receiving capabilities (eclipse-theia#11886),
 - fix: added missing conext menu in the _Variables_ view,
 - fix: handle `setFunctionBreakboints` response with no `body` (eclipse-theia#11885),
 - fix: `DebugExt` fires `didStart` event on `didCreate` (eclipse-theia#11916)

Closes eclipse-theia#11871
Closes eclipse-theia#11879
Closes eclipse-theia#11885
Closes eclipse-theia#11886
Closes eclipse-theia#11916

Signed-off-by: Akos Kitta <a.kitta@arduino.cc>

s

Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
kittaakos pushed a commit to kittaakos/theia that referenced this issue Dec 13, 2022
 - feat: aded support for `debug/toolbar` and `debug/variables/context`,
 - feat: added support for `debugState` when context (eclipse-theia#11871),
 - feat: can customize debug session timeout, and error handling (eclipse-theia#11879),
 - fix: the `debugType` context that is not updated,
 - fix: `configure` must happen after receiving capabilities (eclipse-theia#11886),
 - fix: added missing conext menu in the _Variables_ view,
 - fix: handle `setFunctionBreakboints` response with no `body` (eclipse-theia#11885),
 - fix: `DebugExt` fires `didStart` event on `didCreate` (eclipse-theia#11916),
 - fix: validate editor selection based on the text model (eclipse-theia#11880)

Closes eclipse-theia#11871
Closes eclipse-theia#11879
Closes eclipse-theia#11885
Closes eclipse-theia#11886
Closes eclipse-theia#11916
Closes eclipse-theia#11880

Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
kittaakos pushed a commit to kittaakos/theia that referenced this issue Dec 13, 2022
 - feat: added support for `debug/toolbar` and `debug/variables/context`,
 - feat: added support for `debugState` when context (eclipse-theia#11871),
 - feat: can customize debug session timeout, and error handling (eclipse-theia#11879),
 - fix: the `debugType` context that is not updated,
 - fix: `configure` must happen after receiving capabilities (eclipse-theia#11886),
 - fix: added missing conext menu in the _Variables_ view,
 - fix: handle `setFunctionBreakboints` response with no `body` (eclipse-theia#11885),
 - fix: `DebugExt` fires `didStart` event on `didCreate` (eclipse-theia#11916),
 - fix: validate editor selection based on the text model (eclipse-theia#11880)

Closes eclipse-theia#11871
Closes eclipse-theia#11879
Closes eclipse-theia#11885
Closes eclipse-theia#11886
Closes eclipse-theia#11916
Closes eclipse-theia#11880

Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
@marcdumais-work
Copy link
Contributor

Note: support for debug/toolbar will also be useful for adoption of ms-vscode.js-debug, coming along with support for vscode API v1.64.2 (pre-requisite: support for TerminalProfileProvider #11503)

2022-12-16T16:45:04.289Z root WARN Failed to register a menu item for plugin ms-vscode.js-debug contributed to debug/toolBar {
  command: 'extension.js-debug.stopProfile',
  submenu: undefined,
  alt: undefined,
  group: undefined,
  when: 'debugType == pwa-extensionHost && jsDebugIsProfiling || debugType == node-terminal && jsDebugIsProfiling || debugType == pwa-node && jsDebugIsProfiling || debugType == pwa-chrome && jsDebugIsProfiling || debugType == pwa-msedge && jsDebugIsProfiling'
} getMenuNode@http://localhost:3000/bundle.js:141788:23
2022-12-16T16:45:04.289Z root WARN Failed to register a menu item for plugin ms-vscode.js-debug contributed to debug/toolBar {
  command: 'extension.js-debug.openEdgeDevTools',
  submenu: undefined,
  alt: undefined,
  group: undefined,
  when: 'debugType == pwa-msedge'
} getMenuNode@http://localhost:3000/bundle.js:141788:23

@kittaakos
Copy link
Contributor Author

Note: support for debug/toolbar will also be useful for adoption of ms-vscode.js-debug, coming along with support for vscode API v1.64.2 (pre-requisite: support for TerminalProfileProvider #11503)

Great news! Please help to move #11984 forward.

kittaakos pushed a commit to kittaakos/theia that referenced this issue Jan 17, 2023
 - feat: added support for `debug/toolbar` and `debug/variables/context`,
 - feat: added support for `debugState` when context (eclipse-theia#11871),
 - feat: can customize debug session timeout, and error handling (eclipse-theia#11879),
 - fix: the `debugType` context that is not updated,
 - fix: `configure` must happen after receiving capabilities (eclipse-theia#11886),
 - fix: added missing conext menu in the _Variables_ view,
 - fix: handle `setFunctionBreakboints` response with no `body` (eclipse-theia#11885),
 - fix: `DebugExt` fires `didStart` event on `didCreate` (eclipse-theia#11916),
 - fix: validate editor selection based on the text model (eclipse-theia#11880)

Closes eclipse-theia#11871
Closes eclipse-theia#11879
Closes eclipse-theia#11885
Closes eclipse-theia#11886
Closes eclipse-theia#11916
Closes eclipse-theia#11880

Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
paul-marechal added a commit that referenced this issue Jan 24, 2023
* fix: various debug fixes and VS Code compatibility enhancements

 - feat: added support for `debug/toolbar` and `debug/variables/context`,
 - feat: added support for `debugState` when context (#11871),
 - feat: can customize debug session timeout, and error handling (#11879),
 - fix: the `debugType` context that is not updated,
 - fix: `configure` must happen after receiving capabilities (#11886),
 - fix: added missing conext menu in the _Variables_ view,
 - fix: handle `setFunctionBreakboints` response with no `body` (#11885),
 - fix: `DebugExt` fires `didStart` event on `didCreate` (#11916),
 - fix: validate editor selection based on the text model (#11880)

Signed-off-by: Akos Kitta <a.kitta@arduino.cc>

* fix: use when context for command node filtering

Signed-off-by: Akos Kitta <a.kitta@arduino.cc>

* chore: removed test debug VSIX

Signed-off-by: Akos Kitta <a.kitta@arduino.cc>

* fix: revert `timeout` check

Signed-off-by: Akos Kitta <a.kitta@arduino.cc>

* fix: clarification on the possible `'debugState'`

Signed-off-by: Akos Kitta <a.kitta@arduino.cc>

* fix: use hard-coded debugger `clientID` and `clientName`

Signed-off-by: Akos Kitta <a.kitta@arduino.cc>

* fix: use review-requested method name

Signed-off-by: Akos Kitta <a.kitta@arduino.cc>

* fix: changed method name + added doc

Signed-off-by: Akos Kitta <a.kitta@arduino.cc>

* fix: `stopTimeout` is a default `ctor` argument

Signed-off-by: Akos Kitta <a.kitta@arduino.cc>

* fix: incorrect method name

Signed-off-by: Akos Kitta <a.kitta@arduino.cc>

* fix: both `didCreate` and `didStart` must be API

Signed-off-by: Akos Kitta <a.kitta@arduino.cc>

* fix: call both on create and start

Signed-off-by: Akos Kitta <a.kitta@arduino.cc>

* fix: workaround for microsoft/vscode-mock-debug#85

Signed-off-by: Akos Kitta <a.kitta@arduino.cc>

* simplify writing

The collection of contributed commands was written in a convoluted way,
this commit makes it more straightforward with just 2 loops.

* use `Math.max` to clamp values into positives

The ternary implementation is stricly equivalent to the `Math.max`
function, so use that instead.

* fix default option value handling

Assigning a default option object to set default values is problematic
as said default values will be discarded if any option object is passed.

Instead default values must be handled in conjuction of whatever options
are passed to functions.

Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
Co-authored-by: Paul Maréchal <paul.marechal@ericsson.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
debug issues that related to debug functionality vscode issues related to VSCode compatibility
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants