-
Notifications
You must be signed in to change notification settings - Fork 137
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
Use VS Code's built-in launch configuration detection #2578
Comments
We do have a setting "azureFunctions.projectSubpath" which is supposed to help for this situation. Basically, set that to the subpath of the functions project, run the "Initialize Project for Use with VS Code" command (we prompt users to do this in a few places, or you can access it from the command palette), and things should just start working
We automatically look for projects at the root of the workspace or 1 folder level down. This detection logic happens when users first open a VS Code window and we didn't want to search the entire workspace because that could negatively affect startup performance.
This is worth looking into. I think I tried it a while ago and the VS Code API wasn't quite good enough. For example I think it only let us specify content to go into the "launch.json" file and we would need to edit the "tasks.json" and "settings.json" files as well. |
Am I correct in understanding that this would only work/assume you have a single Azure Function in the workspace? Although detecting Functions a few folders level deep is part of the request, the other is that projects often have several functions so it'd be nice to have the configs detected and setup for more than just one hardcoded in |
There's a bit of confusion here in terminology between "function" and "project". That setting should point to the root of your project, where the "host.json" file is, but that project can contain multiple functions. If you want to debug multiple projects at once, we have this doc on how to do it: https://github.com/microsoft/vscode-azurefunctions/wiki/Multiple-function-projects |
That's correct, sorry I should have clarified multiple Azure Function projects (which as you point out can each supply multiple individual functions) -- so it looks like Option 2 is the path forward for now. However this is unfortunate because it requires initialization of the Functions one-by-one, then grouping them into a workspace which Omnisharp will fail to support (OmniSharp/omnisharp-roslyn#909) leaving a very poor developer experience. |
The issue you linked in OmniSharp is pretty sparse and old, so I'm not sure how relevant it is. What exactly doesn't work with OmniSharp multi-root workspaces? |
Taking a step back, what I'm trying to convey is that the developer experience around editing anything more than a single azure function (particularly if across solutions) is very poor. Specifically around omnisharp - issue linked is indeed old but still relevant, multiple solutions are not supported by OmniSharp and you have to switch between which standalone projects or solution file is currently being served. So if you have something like:
and open the folder containing this structure in VS Code, the user gets broken problem detection for a good chunk of your codebase. The functions also won't get detected and configured. You have to open each one individually i.e. If you use a multi-root workspaces, then you're just re-adding subfolders as top-level one and now you've got duplicated files trees, etc. I also tested with a simpler structure, two blank HTTP Functions in a local folder with:
VS Code does detect them for initialization with Lastly, through this testing I accidentally clicked "Don't show again" to the initialize for VS Code prompt and now it's never returned, despite my user + workspace setting for "Show Project Warning" being enabled. |
Internal Trackingdevdivcsef 412378 |
This issue has become stale and is at risk of being closed. The community has 60 days to upvote the issue. If it receives 5 upvotes we will keep it open and take another look. If not, we will close it. To learn more about how we handle issues, please see our documentation. Happy Coding! |
When opening up a large project that consists of several C# projects (including some Azure Functions), the extension will never detect/offer to produce settings. One must open the specific folder containing the Azure Function .csproj file for it to offer to build launch configuration, meaning users need to either (1) do so and then merge that configuration, adjusting paths, into their parent workspace; or (2) keep two editor windows open - one for editing the broader solution, and a second for launching the Azure Function.
Asks:
The text was updated successfully, but these errors were encountered: