-
Notifications
You must be signed in to change notification settings - Fork 61
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
Add setting to Run the target on every save #558
Comments
@parmi93 I'll put some more thought into this, but the initial thought I have is that the current workaround that you have is likely a good one for the time being. However, we could possibly add a setting that does this automatically, so I'll mark this as a request and we can track interest and priority by upvotes on the issue. As for adding a new target in the UI, we do not currently support this and I believe it would be possibly difficult to manage injecting code into the makefile through a tool. The best way to add a target would be to modify your Makefile. Thanks! |
@parmi93 , hooking up a build command to Ctrl+S is a good workaround so far (except that indeed, on File->Save it wouldn't be triggered) and we can implement in future triggering it on any kind of save, via a new setting (eventually accompanied by a new UI element in the panel). Now, about what targets to get built when the build action is executing. One entry-point is the "Build target: " UI element that in your screenshot is [Unset]. You click on the pencil, see all the makefile targets in a list and chose one (we have several work items for the future to make this a multi-selection, or add a new string that for any reason is not in the list...etc...). Now you would be able to chose this way your tests target, it would get built on Ctrl+S but this is not a good solution because that target only (not the rest, no "all"...) would be built when the extension is looking for information to parse for IntelliSense. Building that test target would produce the tests output and not compiler/linker commands which we need in order to calculate good IntelliSense in C/C++ files. So, whatever target you chose in the "Build target" UI element, will be built on Ctrl+S (due to your binding, otherwise not), on project load (when calculating IntelliSense), before any launch debug/run in terminal (in case you have the setting "makefie.buildBeforeLaunch") or when you invoke manually a build (clean or not) command. As I understand your scenario, I suggest you add an entry to the array "makefile.configurations". Do you currently have anything defined within this setting? Look at settings.json. I am asking because in your screenshot I see "Configuration: [Unset]" (which is a default) and most probably you did not need this setting until now. But you can also have defined it without selecting one entry via the UI. If you already have configurations defined, just add to ".makeArgs" another string element with the name of the tests target but also the "all" (or a general build target so that we don't build only the tests target). Or, in the makefile, can you define a dependency so that when "make" builds the tests target also builds a comprehensive complete enough (whatever your developer scenario needs) source code build target. I think using the "makefile.configurations" setting is the cleanest way to achieve your scenario until we implement a more direct way of doing it. |
Hi @parmi93, sorry for the very long delay. I was going back through issues and checking for any responses I missed and saw this. Are you still facing this issue? I'd love to try and help you understand. Let me know, thanks! |
I'm trying to use Test Driven Development for a new project, TDD requires you to run tests very often and one of the recommended techniques is to run the tests at every save instead of triggering the tests manually.
I haven't been able to find a configuration anywhere that allows me to do this, as a workaround I have attached the
Build target
option to the Ctrl+s key combination, although it is not ideal because if I save viaFile->Save
the tests are not triggered.Also I was wondering how can I add a new target in the U.I.? in my case a target to run tests.
The text was updated successfully, but these errors were encountered: