VSCode suggests that you should surround $b[3] with a function because this is stuff that on first glance isn’t that maintainable. I see you want the 3rd path of the path variable but don’t know what exactly you are looking for, neither does anyone that will potentially maintain the script so you should wrap this line into something meaningfull.
It’s not obvious from your screenshot, but the crucial aspect is that you’ve selected$b[3].
Whenever you select a multi-character range, Visual Studio’s PowerShell extensionoffers you potentially useful actions, indicated by and accessible via the lightbulb icon:
You can click on the icon or use Control-. (period) to invoke the menu of available actions.
Actions of a general nature that are always presented pertain to surrounding (enclosing) the selected text with various constructs, such as shown in your screenshot.
This is a convenient way to make the selected text part of a larger language construct, such as an if statement or a function definition.
These actions are not prescriptive, i.e. it is up to you to decide whether any of the actions presented make sense in the context of what you’re trying to do.
2
Answers
VSCode suggests that you should surround $b[3] with a function because this is stuff that on first glance isn’t that maintainable. I see you want the 3rd path of the path variable but don’t know what exactly you are looking for, neither does anyone that will potentially maintain the script so you should wrap this line into something meaningfull.
Take this as an example:
i wrapped my search for a specific path into a function with meaningfull name so whoever maintains the script will know what i searched for
It’s not obvious from your screenshot, but the crucial aspect is that you’ve selected
$b[3]
.Whenever you select a multi-character range, Visual Studio’s PowerShell extension offers you potentially useful actions, indicated by and accessible via the lightbulb icon:
You can click on the icon or use Control-. (period) to invoke the menu of available actions.
Actions of a general nature that are always presented pertain to surrounding (enclosing) the selected text with various constructs, such as shown in your screenshot.
This is a convenient way to make the selected text part of a larger language construct, such as an
if
statement or afunction
definition.These actions are not prescriptive, i.e. it is up to you to decide whether any of the actions presented make sense in the context of what you’re trying to do.