QML Static Analysis 2 - Custom Pass
In this chapter we learn how to improve our custom warnings by amending them with fixit hints.
So far, we only created warning messages. However, sometimes we also want to add a tip for the user how to fix the code. For that, we can pass an instance of FixSuggestion to emitWarning. A fix suggestion always consists of a description of what should be fixed, and the location where it should apply. It can also feature a replacement text. By default,
the replacement text is only shown in the diagnostic message. By calling setAutoApplicable(true) on the FixSuggestion, the user can however apply the fix automatically via
qmllint or the QML language server. It is important to only mark the suggestion as auto-applicable if the resulting code is valid.
As part of the free Business evaluation, we offer a free welcome call for companies, to talk about your requirements, and how the Felgo SDK & Services can help you. Just sign up and schedule your call.
Sign up now to start your free Business evaluation: