Skip to content

Instantly share code, notes, and snippets.

@ninmonkey
Last active May 28, 2021 00:42
Show Gist options
  • Save ninmonkey/1c1ab3fcaa6776e754679598231fc26b to your computer and use it in GitHub Desktop.
Save ninmonkey/1c1ab3fcaa6776e754679598231fc26b to your computer and use it in GitHub Desktop.
VS Code settings.json
{
// example: <https://cdn.discordapp.com/attachments/447476117629304853/797526322200576030/Expand_Aliases_and_Splatting.mp4>
"powershell.codeFormatting.autoCorrectAliases": true,
"powershell.codeFormatting.useCorrectCasing": true,
"powershell.codeFormatting.useConstantStrings": true,
"files.defaultLanguage": "${activeEditorLanguage}",
"files.trimTrailingWhitespace": true,
"terminal.integrated.shell.windows": "C:/Program Files/PowerShell/7/pwsh.exe",
"terminal.integrated.shellArgs.windows": [
"-NoLogo"
],
"[powershell]": {
"editor.formatOnSave": true,
"editor.snippetSuggestions": "none",
"files.encoding": "utf8bom",
"editor.formatOnSaveMode": "file",
"editor.formatOnPaste": true,
"files.autoGuessEncoding": false,
"editor.detectIndentation": false, // required for tabsize
"editor.tabSize": 4,
// if autoIndent is set to 'full' it breaks indentation on 'move line up/down'
"editor.autoIndent": "advanced",
"editor.semanticHighlighting.enabled": true,
},
"editor.semanticHighlighting.enabled": true, // or "ConfiguredByTheme"
"editor.semanticTokenColorCustomizations": {
"[Default Dark+]": {
"enabled": true,
"rules": {
"parameter": "#d4d4d4",
}
},
},
"files.associations": {
"*.json": "jsonc",
"*.ps1xml": "xml",
},
/*
uses 'redhat.vscode-xml'
applies schemas to PowerShell '.Format.ps1xml' and '.Types.ps1xml'
*/
"xml.fileAssociations": [
{
"systemId": "https://raw.githubusercontent.com/PowerShell/PowerShell/master/src/Schemas/Format.xsd",
"pattern": "**/*.Format.ps1xml"
},
{
"systemId": "https://raw.githubusercontent.com/PowerShell/PowerShell/master/src/Schemas/Types.xsd",
"pattern": "**/*.Types.ps1xml"
}
],
}
{
/* vscode settings for powershell */
// new featurs:
"editor.suggest.showStatusBar": true, // https://code.visualstudio.com/updates/v1_51#_status-bar-for-suggestions
// "editor.suggest.insertMode":"insert", // https://code.visualstudio.com/updates/v1_51#_move-cursor-to-select-suggestions
// enable logging:
// "powershell.developer.editorServicesLogLevel": "Diagnostic",
// "powershell editor services.trace.server": "verbose",
"files.defaultLanguage": "${activeEditorLanguage}", // I love this for all languages
"editor.trimAutoWhitespace": true,
"editor.formatOnSave": true,
"files.encoding": "utf8",
"files.autoGuessEncoding": true,
"files.associations": {
"*.ps1xml": "xml", // PowerShell format files
"*.json": "jsonc",
},
/*
XML Schema for Format and Types .ps1xml
extension id: 'redhat.vscode-xml'
*/
"xml.fileAssociations": [
{
"systemId": "https://raw.githubusercontent.com/PowerShell/PowerShell/master/src/Schemas/Format.xsd",
"pattern": "**/*.Format.ps1xml"
},
{
"systemId": "https://raw.githubusercontent.com/PowerShell/PowerShell/master/src/Schemas/Types.xsd",
"pattern": "**/*.Types.ps1xml"
}
],
// misc editor settings
"editor.renderControlCharacters": true,
// "editor.definitionLinkOpensInPeek": false,
// powershell code formatting
"powershell.buttons.showPanelMovementButtons": true,
"powershell.buttons.showRunButtons": true,
"powershell.codeFolding.enable": true,
"powershell.codeFolding.showLastLine": true,
// "powershell.codeFormatting.addWhitespaceAroundPipe": true,
"powershell.codeFormatting.autoCorrectAliases": true,
"powershell.codeFormatting.ignoreOneLineBlock": true,
"powershell.codeFormatting.useCorrectCasing": true,
"powershell.codeFormatting.whitespaceBetweenParameters": false, // fixes some formatter bugs
// "powershell.codeFormatting.whitespaceAroundPipe": true,
"powershell.enableProfileLoading": true,
"powershell.integratedConsole.suppressStartupBanner": false,
"powershell.scriptAnalysis.enable": true,
"powershell.scriptAnalysis.settingsPath": "C:\\foo\\PSScriptAnalyzerSettings.psd1",
// "powershell.developer.bundledModulesPath": "",
// "powershell.developer.waitForSessionFileTimeoutSeconds": 240,
"[powershell]": {
// see: https://docs.microsoft.com/en-us/powershell/scripting/dev-cross-plat/vscode/understanding-file-encoding?view=powershell-7#configuring-vs-code
"editor.snippetSuggestions": "none",
"files.encoding": "utf8bom",
"files.autoGuessEncoding": false,
"editor.semanticHighlighting.enabled": true, // toggle off if syntax highlighting is broken
"editor.formatOnSave": true,
"editor.formatOnPaste": true,
// if autoIndent is set to 'full' it breaks indentation on 'move line up/down'
"editor.autoIndent": "advanced",
"files.trimTrailingWhitespace": true,
"files.insertFinalNewline": true,
"debug.focusWindowOnBreak": true,
"debug.console.closeOnEnd": false,
"editor.fontSize": 15,
"editor.wordWrap": "on", //# bounded or on
"editor.wordWrapColumn": 140,
"editor.formatOnSaveMode": "file",
"editor.formatOnType": false, // currently it's NYI
"editor.detectIndentation": false, // required for tabsize
"editor.tabSize": 4,
},
"[csv]": {
"editor.wordWrap": "off" // combine with rainbow CSV
},
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.detectIndentation": false,
"editor.formatOnPaste": true,
"editor.formatOnSave": true,
"editor.semanticHighlighting.enabled": true,
"editor.tabSize": 4,
// "editor.defaultFormatter": "vscode.json-language-features",
// "editor.maxTokenizationLineLength": 20000
},
"[jsonc]": {
"editor.defaultFormatter": "vscode.json-language-features", // or "esbenp.prettier-vscode"
"editor.detectIndentation": false,
"editor.formatOnPaste": false,
"editor.formatOnSave": true,
"editor.tabSize": 4,
// default to allow jsonc syntax because lots of 'json' are actually 'jsonc'
},
"terminal.external.windowsExec": "\"C:\\Program Files\\PowerShell\\7\\pwsh.exe\"",
"terminal.integrated.rendererType": "canvas",
"terminal.integrated.shell.windows": "C:\\Program Files\\PowerShell\\7\\pwsh.exe",
"terminal.integrated.shellArgs.windows": [],
"terminal.integrated.unicodeVersion": "11",
// "powershell.powerShellDefaultVersion": "",
// "workbench.editor.focusRecentEditorAfterClose": false,
// "workbench.quickOpen.closeOnFocusLost": false,
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment