Spell-checking dbatools with Visual Studio Code

Earlier this week I was working on adding a new feature
to Update-DbaTools
and while looking at another cmdlet to check syntax/conventions, I noticed an ugly typo in some of the help for it. 100% perfect prose isn’t necessary
in the comment-based help for PowerShell cmdlets, but seeing misspellings and such kind of bugs me. Fortunately this is something I can help fix since the module is on Github.

First I needed to find a spell-checker that works with Visual Studio Code to help me spot misspellings. This was slightly
trickier than expected, as I use macOS at home and at least one of the first plugins I found was Windows-only. I finally settled on Code Spellchecker
.

But as you can see from the marketplace page there, by default this plugin doesn’t know PowerShell. In my user settings file settings.json
, I added PowerShell to the cSpell.enabledLanguageIds
section so it’s always recognized:

"cSpell.enabledLanguageIds": [
        "c",
        "cpp",
        "csharp",
        "go",
        "javascript",
        "javascriptreact",
        "json",
        "latex",
        "markdown",
        "php",
        "plaintext",
        "powershell",
        "python",
        "text",
        "typescript",
        "typescriptreact",
        "yml",
        "powershell"
    ],

And with that, VSCode was giving me green squiggles under lots
of words – both misspelled and not. Code Spellchecker doesn’t understand PowerShell in its default setup, it doesn’t have a dictionary for it. Just to get things started, I added a cSpell.userWords
section to my settings.json
and the squiggles started disappearing. The list I’m working with so far is posted as a gist on Github:

I’ll keep this updated as I encounter more strings that need to be recognized, whether they’re PowerShell tokens or specific to the dbatools project. In addition to actual PowerShell syntax in there, I’m dropping in strings that are commonly found throughout the module. Eventually I suppose I should get a proper dictionary file or two together, but this works well for a quick & dirty way to get going with a spellcheck & language cleanup for the module.

您可能感兴趣的

Speaking at Omaha PowerShell User Group on PowerSh... For those of you around the Omaha/Lincoln area, you can catch me tomorrow night speaking at the Omaha PowerShell User group where I will be talking a...
PowerShell disappeared or….. Utilizing the mighty Irwin´s Operation testing in the environment I am building and administrering right now is great success. I have set up a s...
Visual Studio Code integration with Azure Applicat... I don't know how I've missed this but today I found out that Visual Studio Code (VS Code) provides excellent integration with Application Insights...
PowerShell Constrained Language Mode PowerShell Constrained Language Mode What is PowerShell Constrained Language? PowerShell Constrained Language is alanguage mode of PowerShell...
Using PFX Files in PowerShell One of the things I’ve been working on lately is adding a new to the xCertificate DSC Resource module for exporting an certificate with (or without) ...
责编内容来自:The Rest is Just Code (源链) | 更多关于

阅读提示:酷辣虫无法对本内容的真实性提供任何保证,请自行验证并承担相关的风险与后果!
本站遵循[CC BY-NC-SA 4.0]。如您有版权、意见投诉等问题,请通过eMail联系我们处理。
酷辣虫 » Spell-checking dbatools with Visual Studio Code



专业 x 专注 x 聚合 x 分享 CC BY-NC-SA 4.0

使用声明 | 英豪名录