-
Notifications
You must be signed in to change notification settings - Fork 64
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
Proposed fix for microsoft/vscode-makefile-tools/issues/290 #291
Conversation
…ment does not seem to work. Or I am doing something wrong
@@ -103,6 +103,12 @@ export class LaunchTargetNode extends BaseNode { | |||
item.collapsibleState = vscode.TreeItemCollapsibleState.None; | |||
item.tooltip = localize("launch.target.currently.selected.for.debug.run.in.terminal", | |||
"The launch target currently selected for debug and run in terminal.\n{0}", this._toolTip); | |||
// enablement in makefile.outline.setLaunchConfiguration is not |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trying set this TreeItem
to be disabled via enablement in the command
: makefile.outline.setLaunchConfiguration
extension.getState().configureDirty = true; | ||
updatedSettingsSubkeys.push(subKey); | ||
} | ||
|
||
// Final updates in some constructs that depend on more than one of the above settings. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I may be wrong, but I think you don't need configureDirty to be true here. Toggling between view or hide the UI elements doesn't need the extension to go through the reconfigure phase. In case you encountered issues which inspired you to write this (as opposed to looking at other similar code above which may have other reasons) let me know. It doesn't hurt but sometimes, for large projects, configure may be very long and we don't want to let it happen without being necessary.
Same question for calling readCurrentLaunchConfiguration. This doesn't take long, even one less reason to insist on removing it, but do you remember whether you needed that call?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as opposed to looking at other similar code above which may have other reasons)
Yes, basically I followed the pattern without understanding the implications. I will update the PR using your input.
Thanks a lot for the feedback.
@jdmchp, thank you for taking the time to implement this. I reviewed and left a few comments (to which you responded already). But the most significant suggestion I have is about the new setting. Having the experience of another similar extension based on cmake build technologies, which is a few years older, we ended up needing to show/hide more things, not just the debug UI elements. Instead of adding a new top level setting for each UI element that we may need to hide/show in future, let's follow that pattern of having all the visibility settings encapsulated in one object top level setting, to which we can add in time based on necessities. The GitHub repository for the CMake Tools VSCode extension is here: https://github.com/microsoft/vscode-cmake-tools. You can follow in package.json and in the typescript sources how settings like "cmake.touchbar.visibility" or "cmake.statusbar.visibility" are defined and used. We don't have a "status bar" concept in the Makefile Tools extension and no "touch bar" special support yet so I imagine you can name the settings collection like "makefile.panel.visibility", with one entry for launch and in future, when somebody will need it, another entry to build (cmake tools extension needed this for debug and build, to hide/show them based on user scenarios that I don't know very well). Later edit: actually, 3 settings: one for debug, one for run and one for build. Currently you have debug/run together into one setting. |
Got it. Let me look at the CMake Tools VSCode extension. The pattern of having a single central place to enable/disable functionality makes more sense. Thanks for the guidance. |
@jdmchp, I forgot to let you know earlier. The CI tests were not hanging because of changes in your PR. I just fixed the problem somewhere in the extension and the fix will get merged in soon. |
…al features. Use OptionalFeatures to handle all optional features in a single place. If optional feature is controlled via "enablement", then the featute can be controlled via package.json changes and one change to the optionalFeatures object. Avoid ѕetting the dirty flag for the configuration when a change of properties is detected. Minimize operations when changing only flags that control run/debug local features
Hello @andreeis , Thanks for you feedback. |
package.json
Outdated
@@ -502,6 +504,27 @@ | |||
"default": null, | |||
"description": "%makefile-tools.configuration.makefile.compileCommandsPath.description%", | |||
"scope": "resource" | |||
}, | |||
"makefile.panel.visibility": { | |||
"type": "array", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It wasn't immediately obvious to me why this would be an array of objects instead of just an object. Do we need to support an array of objects for this, or will a single object suffice?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello @bobbrow , thanks for the quick reply. My goal is to have a list of features that can be toggled independently of each other. Being a list, I thought of using an array. The goal being able to add optional (toggle-able features) easily. The original PR had a single optional feature (build/debug locally).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An object would be a better representation of what you want. If you do an array of objects, then this would be valid syntax in the settings:
{
"makefile.panel.visibility": [
{
"enableLocalDebugging": false
},
{
"enableLocalDebugging": true
}
]
}
It would be better to just do an object:
{
"makefile.panel.visibility": {
"enableLocalDebugging": false
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The use of an array made iterating through the possible different 'option flags' easy. I can refactor to make the makefile.panel.visibility
and object and then iterate through its properties instead.
Thanks for the input.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
…makefile.panel.visibiluty to makefile.optionalFeatures
package.json
Outdated
@@ -502,6 +504,22 @@ | |||
"default": null, | |||
"description": "%makefile-tools.configuration.makefile.compileCommandsPath.description%", | |||
"scope": "resource" | |||
}, | |||
"makefile.optionalFeatures": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the old name makefile.panel.visibility
was better. "Optional features" is a bit too vague. And if we copy the pattern from CMake Tools, the individual settings can have simpler names like "debug" and "run" because the context is already understood.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see your point. Let me put that back. Do you think I should have a type in configurations.ts that matches the makefile.panel.visibility
exactly:
// as described in makefile.panel.visibility
type MakefilePanelVisibility = {
enableLocalDebugging: boolean,
enableLocalRunning: boolean
};
I am not sure what the conventions are. But having an easily relatable name for the type that represents the object that is encapsulated by makefile.panel.visibility makes sense to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK. Changed the property back to makefile.panel.visibility
and adjusted types to be relatable to that name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll let @andreeis comment on that. She knows the code better than I do. I tend to chime in more on the stuff that our users would notice like settings, commands, and such.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK. Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@andreeis , if there is any more work needed on this PR, please let me know. Thanks in advance for your input.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jdmchp, thank you for continuing to work on this. I was out of office, I am going to review and test your updates today.
…ug related to restoring defaults for optional features.
@jdmchp, I am pushing a commit with the following changes I did:
Additionally, the telemetry was broken for variables like "makefile.name1.name2.name3" etc... and I have PR #309 to fix that. It is separate from your PR. |
@andreeis |
@jdmchp, thank you again for implementing this support. It is included in Makefile Tools 0.5.0 which was released today. |
As mentioned in issue 290, we would like to propose making the local (to the host) options of debugging and running optional. This makes the vscode-makefile-tools extension friendlier to use with other extensions that allow debugging in embedded systems.