How can I disable verb highlighting in Visual Studio Code?

0
6
Asked By SillyGiraffe27 On

I'm facing an issue in Visual Studio Code where my functions are getting syntax highlighted based on approved verbs, and I'd like to know how to turn that off. When I use an approved verb, my function names show in yellow, but they turn white when I use verbs that aren't in the approved list. It's quite annoying! I'm currently using the PowerShell extension by Microsoft.

3 Answers

Answered By TechSavvyHiker On

You can fix this by modifying the PSScriptAnalyzerSettings.psd1 file to ignore the approved verbs rule. Check out the GitHub page for guidance on how to set that up. It should help you get rid of that annoying highlighting!

Answered By CleverCoder88 On

Another option is to use the SuppressMessageAttribute. You can add this attribute to your functions: `[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseApprovedVerbs", "", Justification="sue me")]`. This will stop the highlighting for that specific function.

Answered By CasualDev42 On

Honestly, if it’s not a cmdlet you're creating for shell binding, I wouldn’t stress about using approved verbs. Just name your functions whatever you like in PascalCase. It’s way more flexible for everyday coding!

SillyGiraffe27 -

Exactly! Sometimes it just feels good to break the rules a bit.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.