From d7509c6eed18ab9aa5f6eaa11bfc6517aafaecf6 Mon Sep 17 00:00:00 2001 From: Shawn Melton <11204251+wsmelton@users.noreply.github.com> Date: Wed, 29 Mar 2023 01:29:32 -0500 Subject: [PATCH] Updates to devcontainer configuration (#8823) --- .devcontainer/{dockerfile => Dockerfile} | 7 +- .devcontainer/devcontainer.json | 59 ++++---- .vscode/settings.json | 175 +++++++++++++---------- 3 files changed, 135 insertions(+), 106 deletions(-) rename .devcontainer/{dockerfile => Dockerfile} (83%) diff --git a/.devcontainer/dockerfile b/.devcontainer/Dockerfile similarity index 83% rename from .devcontainer/dockerfile rename to .devcontainer/Dockerfile index fbf0d60fed..5d79df7a17 100644 --- a/.devcontainer/dockerfile +++ b/.devcontainer/Dockerfile @@ -18,12 +18,15 @@ RUN echo "export HISTFILE=/commandhistory/.bash_history" >> "/root/.bashrc" \ && touch /commandhistory/.bash_history \ && mkdir /workspace +SHELL ["/opt/microsoft/powershell/7/pwsh", "-c"] +RUN Set-PSRepository -Name PSGallery -InstallationPolicy Trusted + # Install Pester, has to be 4.4.3 because 4.4.2 has bug in Unix machines -SHELL ["/usr/bin/pwsh", "-c"] +SHELL ["/opt/microsoft/powershell/7/pwsh", "-c"] RUN $ErrorActionPreference='Stop'; Install-Module -Name Pester -Force -SkipPublisherCheck -MaximumVersion 4.4.3; # Install PSScriptAnalyzer -SHELL ["/usr/bin/pwsh", "-c"] +SHELL ["/opt/microsoft/powershell/7/pwsh", "-c"] RUN $ErrorActionPreference='Stop'; Install-Module -Name PSScriptAnalyzer -Force -SkipPublisherCheck -MaximumVersion 1.18.2; # Git command prompt diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 6b008a7c4f..80d4ac1d74 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,29 +1,38 @@ { - "name": "dbatools", - "workspaceFolder": "/workspace", - "dockerComposeFile": [ - "docker-compose.yml" - ], - "remoteEnv": { - "LOCAL_WORKSPACE_FOLDER": "${localWorkspaceFolder}", - "MY_SERVERS": "dbatools1,dbatools2,dbatools3", - "MY_SERVER": "dbatools1" - }, - "service": "dbatools1", - "settings": { - "terminal.integrated.shell.linux": "/usr/bin/pwsh" - }, - // Add the IDs of extensions you want installed when the container is created. - "extensions": [ + "name": "dbatools", + "workspaceFolder": "/workspace", + "dockerComposeFile": ["docker-compose.yml"], + "remoteEnv": { + "LOCAL_WORKSPACE_FOLDER": "${localWorkspaceFolder}", + "MY_SERVERS": "dbatools1,dbatools2,dbatools3", + "MY_SERVER": "dbatools1" + }, + "service": "dbatools1", + // Add the IDs of extensions you want installed when the container is created. + "customizations": { + "vscode": { + "extensions": [ "ms-vscode.powershell", + "ms-mssql.mssql", "github.vscode-pull-request-github", - "2gua.rainbow-brackets", + "usernamehw.errorlens", "oderwat.indent-rainbow", - "mhutchie.git-graph", - "usernamehw.errorlens" - ] - // Uncomment the next line if you want to keep your containers running after VS Code shuts down. - // "shutdownAction": "none", - // Uncomment the next line to run commands after the container is created - for example installing curl. - // "postCreateCommand": "apt-get update && apt-get install -y curl", -} \ No newline at end of file + "wengerk.highlight-bad-chars", + "streetsidesoftware.code-spell-checker" + ], + "settings": { + "terminal.integrated.profiles.linux": { + "pwsh": { + "path": "/opt/microsoft/powershell/7/pwsh", + "icon": "terminal-powershell" + } + }, + "terminal.integrated.defaultProfile.linux": "pwsh" + } + } + } + // Uncomment the next line if you want to keep your containers running after VS Code shuts down. + // "shutdownAction": "none", + // Uncomment the next line to run commands after the container is created - for example installing curl. + // "postCreateCommand": "apt-get update && apt-get install -y curl", +} diff --git a/.vscode/settings.json b/.vscode/settings.json index ae936bfd12..a2556a31be 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,87 +1,104 @@ // Place your settings in this file to overwrite default and user settings. { - // cleans up whitespace - "files.trimTrailingWhitespace": true, - // formatting style this project adheres to: https://en.wikipedia.org/wiki/Indentation_style#Variant:_1TBS_(OTBS) - "powershell.codeFormatting.preset": "OTBS", - // editor settings for formatting standards on this project + // cleans up whitespace + "files.trimTrailingWhitespace": true, + // formatting style this project adheres to: https://en.wikipedia.org/wiki/Indentation_style#Variant:_1TBS_(OTBS) + "powershell.codeFormatting.preset": "OTBS", + // editor settings for formatting standards on this project + // editor settings that will auto add the closing quote or curly brace + "powershell.codeFormatting.useConstantStrings": false, + // now your double clicks on a variable names include the dollar sign '$' + // https://twitter.com/TylerLeonhardt/status/1102749805233737729 + "[json]": { + "editor.tabSize": 2 + }, + "[yaml]": { + "editor.insertSpaces": true, + "editor.tabSize": 2, + "diffEditor.ignoreTrimWhitespace": false, + "gitlens.codeLens.scopes": [ + "document" + ], + "editor.quickSuggestions": { + "other": true, + "comments": false, + "strings": true + } + }, + "[powershell]": { + "diffEditor.ignoreTrimWhitespace": false, + "editor.wordSeparators": "`~!@#%^&*()-=+[{]}\\|;:'\",.<>/?", "editor.tabSize": 4, "editor.detectIndentation": false, "editor.insertSpaces": true, "editor.formatOnSave": false, - // editor settings that will auto add the closing quote or curly brace "editor.autoClosingBrackets": "always", "editor.autoClosingQuotes": "always", - "editor.autoSurround": "languageDefined", - "powershell.codeFormatting.useConstantStrings": false, - // now your double clicks on a variable names include the dollar sign '$' - // https://twitter.com/TylerLeonhardt/status/1102749805233737729 - "[powershell]": { - "editor.wordSeparators": "`~!@#%^&*()-=+[{]}\\|;:'\",.<>/?" - }, - "powershell.scriptAnalysis.settingsPath": "bin\\PSScriptAnalyzerRules.psd1", - "powershell.codeFormatting.addWhitespaceAroundPipe": true, - "cSpell.words": [ - "Aduck", - "Andreas", - "Bargsley", - "Benner", - "Bizzotto", - "Boggiano", - "Brodeur", - "CHECKDB", - "Ciucu", - "cjsommer", - "Cown", - "DBCC", - "dgmyrs", - "DISA", - "erinstellato", - "Fleitas", - "fleitasarts", - "Furgiuele", - "gbargsley", - "hiramfleitas", - "ifexists", - "ISNULL", - "Jakob", - "jaxnoth", - "jbruns", - "jpomfret", - "Kehayias", - "Kendal", - "Kirill", - "Klaas", - "Kokkinos", - "Kravtsov", - "Mikey", - "nchar", - "niphlod", - "ntext", - "nvarscar", - "Ordix", - "pittfurg", - "PKCS", - "Pollus", - "randomizer", - "richiebzzzt", - "Samuelsson", - "securables", - "serg", - "SMIME", - "Spid", - "Spids", - "SQLDB", - "sqlpadawan", - "sqlstad", - "SSDT", - "Stad", - "Stellato's", - "STIG", - "Tepp", - "Vandenberghe", - "Viorel", - "Wsfc", - "wsmelton" - ] -} \ No newline at end of file + "editor.autoSurround": "languageDefined" + }, + "powershell.scriptAnalysis.settingsPath": "bin\\PSScriptAnalyzerRules.psd1", + "powershell.codeFormatting.addWhitespaceAroundPipe": true, + "cSpell.words": [ + "Aduck", + "Andreas", + "Bargsley", + "Benner", + "Bizzotto", + "Boggiano", + "Brodeur", + "CHECKDB", + "Ciucu", + "cjsommer", + "Cown", + "DBCC", + "dgmyrs", + "DISA", + "erinstellato", + "Fleitas", + "fleitasarts", + "Furgiuele", + "gbargsley", + "hiramfleitas", + "ifexists", + "ISNULL", + "Jakob", + "jaxnoth", + "jbruns", + "jpomfret", + "Kehayias", + "Kendal", + "Kirill", + "Klaas", + "Kokkinos", + "Kravtsov", + "Mikey", + "nchar", + "niphlod", + "ntext", + "nvarscar", + "Ordix", + "pittfurg", + "PKCS", + "Pollus", + "randomizer", + "richiebzzzt", + "Samuelsson", + "securables", + "serg", + "SMIME", + "Spid", + "Spids", + "SQLDB", + "sqlpadawan", + "sqlstad", + "SSDT", + "Stad", + "Stellato's", + "STIG", + "Tepp", + "Vandenberghe", + "Viorel", + "Wsfc", + "wsmelton" + ] +}