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

executeWorkspaceSymbolProvider should accept empty string #39522

Closed
craig006 opened this issue Dec 4, 2017 · 11 comments
Closed

executeWorkspaceSymbolProvider should accept empty string #39522

craig006 opened this issue Dec 4, 2017 · 11 comments
Assignees
Labels
api bug Issue identified by VS Code Team member as probable bug verified Verification succeeded
Milestone

Comments

@craig006
Copy link

craig006 commented Dec 4, 2017

  • VSCode Version: 1.18.1
  • OS Version: macOS 10.13.1

Steps to Reproduce:

  1. Debug an extension on a C# project
  2. run executeCommand vscode.executeWorkspaceSymbolProvider with "" or "*" as a filter
  3. either an error is thrown "Illegal argument 'query'" or no results are returned

I would like to prompt the user, from my extension, to select a symbol from the workspace for further processing. I don't have any filter text at this point so would like to show all symbols. I cant seem to get a list of unfiltered symbols using executeWorkspaceSymbolProvider... I need similar functionality to whats available in "Go To Symbol in Workspace...".

Any idea why this does not work?

Example code below. Executing this will result in a zero length array. I cant find any filter value that works as a wildcard.

            (things: any) => {
                console.log("vscode.executeWorkspaceSymbolProvider")
                console.log(things)
            }, (reason) => { 
                console.log(reason)
            });

if I change the filter above to "Service" for example, I get all the coorect results as I would expect:

vscode.commands.executeCommand('vscode.executeWorkspaceSymbolProvider', "Service").then(
            (things: any) => {
                console.log("vscode.executeWorkspaceSymbolProvider")
                console.log(things)
            }, (reason) => { 
                console.log(reason)
            });
@jrieken jrieken added the info-needed Issue requires more information from poster label Dec 4, 2017
@jrieken
Copy link
Member

jrieken commented Dec 4, 2017

Any idea why this does not work?

No, not without some sample code

@craig006
Copy link
Author

craig006 commented Dec 4, 2017

No, not without some sample code

I have added a code snippet. Sorry :)

@jrieken
Copy link
Member

jrieken commented Dec 4, 2017

Yeah... That's how it is in our tests: https://github.com/Microsoft/vscode/blob/master/src/vs/workbench/test/electron-browser/api/extHostApiCommands.test.ts#L187. Maybe one of your extensions?

@craig006
Copy link
Author

craig006 commented Dec 4, 2017

@jrieken Sorry, I'm not following. I assume that its not possible to query all symbols then? Similar to how cmd+t does it?

@jrieken
Copy link
Member

jrieken commented Dec 4, 2017

You sample looks legit and this is how we test the code. Yes, the command is more or less what the UI calls so everything should work. However, there is always the chance of an extension throwing errors. What again is the exact error you are seeing?

@craig006
Copy link
Author

craig006 commented Dec 4, 2017

This is everything I have tried:

vscode.commands.executeCommand('vscode.executeWorkspaceSymbolProvider', "*").then(
            (things: any) => {
                window.showQuickPick(things).then(test => {})
                console.log("2")
                console.log(things)
            }, (reason) => { 
                console.log(reason)
            }); 

This returns Array[0]

Next I tried:

vscode.commands.executeCommand('vscode.executeWorkspaceSymbolProvider', "").then(
            (things: any) => {
                window.showQuickPick(things).then(test => {})
                console.log("2")
                console.log(things)
            }, (reason) => { 
                console.log(reason)
            }); 

This throws error:


Error: Running the contributed command:'vscode.executeWorkspaceSymbolProvider' failed. Illegal argument 'query' - Search string
codeActionProvider.js:249
    at e.$executeContributedCommand (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:4:411939)
    at e.executeCommand (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:4:411279)
    at Object.executeCommand (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:4:488349)
...

Do you think its the omnisharp extension throwing an error? How does the Go to symbol command get a full list of symbols from omnisharp?

@jrieken
Copy link
Member

jrieken commented Dec 4, 2017

Do you think its the omnisharp extension throwing an error?

Maybe... I don't find this error in our source code. So, either you are on ancient version of VS Code (please try insiders) or this is from an extension (try with --disable-extensions)

@craig006
Copy link
Author

craig006 commented Dec 5, 2017

@jrieken I created an issue with Omnisharp and they seem to have found the error in VS code: dotnet/vscode-csharp#1904

@jrieken jrieken added the *caused-by-extension Issue identified to be caused by an extension label Dec 5, 2017
@vscodebot
Copy link

vscodebot bot commented Dec 5, 2017

This issue is caused by an extension, please file it with the repository (or contact) the extension has linked in its overview in VS Code or the marketplace for VS Code. See also our issue reporting guidelines.

Happy Coding!

@vscodebot vscodebot bot closed this as completed Dec 5, 2017
@jrieken jrieken removed the *caused-by-extension Issue identified to be caused by an extension label Dec 5, 2017
@jrieken jrieken added this to the November 2017 milestone Dec 5, 2017
@jrieken jrieken reopened this Dec 5, 2017
@jrieken
Copy link
Member

jrieken commented Dec 5, 2017

There actually is an issue on our side and that's about the empty string. It should pass the string-constraint but doesn't

@jrieken jrieken changed the title executeWorkspaceSymbolProvider wont allow empty/wildcard filter executeWorkspaceSymbolProvider should accept empty string Dec 5, 2017
@jrieken jrieken added api bug Issue identified by VS Code Team member as probable bug and removed info-needed Issue requires more information from poster labels Dec 5, 2017
@craig006
Copy link
Author

craig006 commented Dec 5, 2017

Awesome! I have resorted to a bit of a filthy hack in the interim...

@jrieken jrieken closed this as completed in 279d957 Dec 6, 2017
@mjbvz mjbvz added the verified Verification succeeded label Dec 7, 2017
@vscodebot vscodebot bot locked and limited conversation to collaborators Jan 20, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api bug Issue identified by VS Code Team member as probable bug verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

3 participants