There should be an easy way to add type annotations to function parameters or remove them, as this operation currently requires a sequence of fiddly and largely mechanical navigation and typing actions.
Expected behavior
When the caret is on a function parameter, detect whether the symbol currently has a type annotation.
If it doesn't, show a light bulb suggestion to allow adding the type annotation - parentheses, colon and a type placeholder. If the compiler can determine the type of the symbol, it should be used for the annotation. Ideally, that should also correctly determine generic type variables used elsewhere in the function signature or scope (for nested functions).
If the symbol currently has a type annotation, show a light bulb suggestion to remove the annotation. This is primarily to reduce the mechanical work; if that causes the code to not compile, that is the user's responsibility.
We would like to implement this feature request as part of FSSF mentorship program. This seems like useful yet small enough feature to work on. Further discussion is welcome.
Description
There should be an easy way to add type annotations to function parameters or remove them, as this operation currently requires a sequence of fiddly and largely mechanical navigation and typing actions.
Expected behavior
When the caret is on a function parameter, detect whether the symbol currently has a type annotation.
If it doesn't, show a light bulb suggestion to allow adding the type annotation - parentheses, colon and a type placeholder. If the compiler can determine the type of the symbol, it should be used for the annotation. Ideally, that should also correctly determine generic type variables used elsewhere in the function signature or scope (for nested functions).
If the symbol currently has a type annotation, show a light bulb suggestion to remove the annotation. This is primarily to reduce the mechanical work; if that causes the code to not compile, that is the user's responsibility.