-
Notifications
You must be signed in to change notification settings - Fork 677
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
'Go to Symbol in Workspace' doesn't work unless there is an open C# file #1375
Comments
This is really a dupe of #1150. Essentially, there isn't a good way to get VS Code to launch C# for VS Code without opening a C# file. |
@DustinCampbell is it really too much overkill to have a small startup that always activates, but does a quick search for any |
There are a couple of problems with that approach:
cc @chrisdias |
Definitely agreed on the last point -- though I think you will need more than just wildcard -- it would also need deep traversal right? On point 1 wouldn't the telemetry just need to be delayed? And wouldn't the telemetry be broken if vscode supported the fuzzy folder based activation? Since you'd be activated for a folder, and wouldn't get deactivated. Basically I was just thinking that we'd put something in between the vscode extension activation and the code that runs now (or the code that would run if vscode supported this feature). I was just thinking it would be a tiny shim that could be dropped once vscode added support for the feature. |
I can't think of a way to do that "tiny shim" due to my point about an extension not knowing how is was activated. |
But won't you have the same problem if vscode adds the feature you are requesting? |
Why would we have the same problem? The problem here is about activating the C# extension so that C# features work even before a C# file is opened (such as debugging). If the user opens a folder containing a *.cs or *.csproj, I would expect the extension to be activated. It would be a problem if the extension were loaded even when a *.cs or *.csproj weren't present. WRT to point #1, that is about VS Code's telemetry around extension activation, not the extension's telemetry. VS Code telemetry would be broken because we'd be activated for any folder even if there wasn't a .cs file anywhere in the workspace. That would have the effort of loading the C# extension even for those just doing JavaScript development, which would skew VS Code's telemetry as it's designed today. |
Ah so now I see that the telemetry would be broken without vscode providing the activation. But other than that (which may not matter -- since I'm guessing that is a deal breaker by itself) -- but unless I'm missing something (which is probably likely) it should be possible to simulate the vscode activation without actually having the feature. So for example, currently the extension gets activated via Outside of the telemetry, wouldn't that provide almost the same thing vscode would provide? |
Sort of, you'd need more there to know when the user actually opens a folder. There aren't any extension events that VS Code triggers in that case. So, you'd need to poll to see if the workspace rootPath changes or some other logic like that. |
As far as I know (and have seen in GitLens), the extension gets re-activated when the folder changes. |
Does it? The documentation says that "interested extensions will be activated whenever VS Code starts up." |
Yeah, it does for me (both in the debugger and live) |
You could also activate on the "showAllSymbols" command: "activationEvents": [
"onCommand:workbench.action.showAllSymbols"
], When you press What I see as a problem is that if you do |
@chrisdias: I'm seeing a problem with the extension being activated for commands it lists in its activationEvents. For example, if I try to use the "Restart OmniSharp" command before the extension is activated, I get an error from VS Code. Is that expected? It seem broken to me. |
Sounds like a bug to me, can you open issue? |
@DustinCampbell I opened microsoft/vscode#24570 -- it may be false hope, but we'll see where it goes ;) |
@eamodio: It looks like your PR didn't pass VS Code's CI. |
Fingers crossed EDIT: Doh -- I'm guessing you meant didn't pass -- I have no idea why it isn't passing, I don't see any failures in Travis, and in AppVeyor it seems like a build issue which I don't have locally (nor is it in a file I even changed) |
@DustinCampbell I apparently just needed to kick it again -- now the CI is passing! |
@DustinCampbell its been merged! microsoft/vscode#24570 |
Environment data
dotnet --info
output:VS Code version:
1.11.1
C# Extension version:
1.8.1
Go to Symbol in Workspace
only seems to work if there is at least one C# file (editor) open. Originally opened here microsoft/vscode#23584, but was asked to open an issue here (microsoft/vscode#23584 (comment))I often hit this when working in web projects -- for example I'm working in js/ts or html/css and then need to jump to a backend (C#) class and I try a symbol search and get nothing :)
Steps to reproduce
Open a folder
With no editors open, do a symbol search for a known symbol
No results will be displayed
Open a folder
Open a C# file
Do a symbol search for a known Typescript symbol
Results will be displayed
Expected behavior
Results should be displayed in both scenarios
Actual behavior
Results only displayed if there is an open C# file
The text was updated successfully, but these errors were encountered: