eclipse-theia/theia

Commands "editor.action.peekLocations" and "editor.action.goToLocations" doesn't work

Open

#9669 opened on Jun 30, 2021

View on GitHub
 (0 comments) (0 reactions) (0 assignees)TypeScript (18,676 stars) (2,478 forks)batch import
help wantedmonacovscode

Description

Bug Description:

Using editor.action.peekLocations or editor.action.goToLocations in a VSCode extension doesn't work when it's running in Theia.

Here is the code used to invoke the command:

vscode.commands.executeCommand(
          "editor.action.goToLocations",
          vscode.window.activeTextEditor!.document.uri,
          new vscode.Range(0, 1, 0, 1),
         [],
          "peek"
        );

There seems to be an issue with the first URI parameter. I suspect that there is an issue with converting it from the VSCode types to monaco types which causes the assertion to fail when checking command parameters.

Steps to Reproduce:

  1. Clone https://github.com/voicis/theia-monaco-commands
  2. Run the VSCode extension in Theia
  3. Open a file
  4. Trigger Test: Go To File Start command from command palette

Expected result: Peek window with two locations should open.

Actual result: The following error is thrown when the command is invoked:

root ERROR [hosted-plugin: 4032] With stack trace: Error: argument does not match one of these constraints: arg instanceof constraint, arg.constructor === constraint, nor constraint(arg) === true
    at validateConstraint (https://3030-fuchsia-manatee-pw4mh4mr.ws-eu08.gitpod.io/vs/editor/editor.main.js:16287:19)
    at Object.validateConstraints (https://3030-fuchsia-manatee-pw4mh4mr.ws-eu08.gitpod.io/vs/editor/editor.main.js:16262:13)
    at idOrCommand.handler (https://3030-fuchsia-manatee-pw4mh4mr.ws-eu08.gitpod.io/vs/editor/editor.main.js:82213:29)
    at InstantiationService.invokeFunction (https://3030-fuchsia-manatee-pw4mh4mr.ws-eu08.gitpod.io/vs/editor/editor.main.js:84046:27)
    at Object.execute (https://3030-fuchsia-manatee-pw4mh4mr.ws-eu08.gitpod.io/packages_monaco_lib_browser_monaco-frontend-module_js-node_modules_vscode-textmate_release_sy-1446ac.bundle.js:534:64)
    at CommandRegistry.<anonymous> (https://3030-fuchsia-manatee-pw4mh4mr.ws-eu08.gitpod.io/bundle.js:131035:62)
    at step (https://3030-fuchsia-manatee-pw4mh4mr.ws-eu08.gitpod.io/bundle.js:130812:23)
    at Object.next (https://3030-fuchsia-manatee-pw4mh4mr.ws-eu08.gitpod.io/bundle.js:130793:53)
    at fulfilled (https://3030-fuchsia-manatee-pw4mh4mr.ws-eu08.gitpod.io/bundle.js:130784:58)

Additional Information

  • Operating System: MacOS 11.4
  • Theia Version: 1.14.0

Contributor guide