Dies ist eine alte Version des Dokuments!
Inhaltsverzeichnis
Visual Studio Code
Visual Studio Code ist open-source und für Windows, Linux, macOS und im Web verfügbar!
Neben https://vscode.dev/ gibt es noch https://github.dev/ (in einem beliebigen github repo github.com durch github.dev ersetzen oder auf der Webseite die Punkt-Taste (.) drücken)
GitHub: https://github.com/microsoft/vscode
Folgende URLs sind equivalent, um das github repo von vscode im Web zu bearbeiten:
Für mehr Infos über VS Code im Web und GitHub siehe hier
Für Infos über Schriftarten und Ligaturen siehe ligaturen
Installation
https://code.visualstudio.com/docs/setup/linux
sudo apt-get install wget gpg wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg sudo install -D -o root -g root -m 644 packages.microsoft.gpg /etc/apt/keyrings sudo sh -c 'echo "deb [arch=amd64,arm64,armhf signed-by=/etc/apt/keyrings/packages.microsoft.gpg] https://packages.microsoft.com/repos/code stable main" > /etc/apt/sources.list.d/vscode.list' rm -f packages.microsoft.gpg sudo apt install apt-transport-https sudo apt update sudo apt install code
Konfigurationsdatei
Gist: https://gist.github.com/masterflitzer/3d954880ae7599e28da81c5acef0ad8d
- settings.json
{ "[bat]": { "files.eol": "\r\n" }, "[css]": { "editor.defaultFormatter": "esbenp.prettier-vscode" }, "[dockercompose]": { "editor.defaultFormatter": "ms-azuretools.vscode-docker" }, "[html]": { "editor.defaultFormatter": "vscode.html-language-features" }, "[javascript]": { "editor.defaultFormatter": "esbenp.prettier-vscode" }, "[json]": { "editor.defaultFormatter": "vscode.json-language-features", "editor.tabSize": 2 }, "[jsonc]": { "editor.defaultFormatter": "vscode.json-language-features", "editor.tabSize": 2 }, "[markdown]": { "editor.defaultFormatter": "esbenp.prettier-vscode", "files.trimTrailingWhitespace": false }, "[powershell]": { "editor.defaultFormatter": "ms-vscode.powershell", "files.eol": "\r\n" }, "[python]": { "editor.formatOnPaste": true, "editor.formatOnSaveMode": "modificationsIfAvailable" }, "[tsv]": { "editor.insertSpaces": false }, "[typescript]": { "editor.defaultFormatter": "esbenp.prettier-vscode" }, "[xml]": { "editor.defaultFormatter": "redhat.vscode-xml", "editor.tabSize": 2 }, "[yaml]": { "editor.defaultFormatter": "redhat.vscode-yaml", "editor.tabSize": 2 }, "csharp.inlayHints.parameters.enabled": true, "csharp.inlayHints.types.enabled": true, "css.styleSheets": [ "https://cdn.jsdelivr.net/npm/bootstrap/dist/css/bootstrap.min.css", "https://cdn.jsdelivr.net/npm/bootstrap-icons/font/bootstrap-icons.css" ], "debug.onTaskErrors": "showErrors", "diffEditor.codeLens": false, "diffEditor.ignoreTrimWhitespace": false, "diffEditor.renderIndicators": true, "diffEditor.renderSideBySide": true, "diffEditor.wordWrap": "inherit", "editor.autoClosingBrackets": "always", "editor.autoClosingDelete": "always", "editor.autoClosingQuotes": "always", "editor.bracketPairColorization.enabled": true, "editor.codeLens": true, "editor.cursorSmoothCaretAnimation": true, "editor.defaultFormatter": null, "editor.detectIndentation": true, "editor.fontFamily": "'Fira Code', 'Cascadia Code', Consolas, 'Courier New', monospace", "editor.fontLigatures": "'calt', 'zero', 'ss04', 'ss07', 'ss09', 'ss10', 'cv06', 'cv25', 'cv26', 'cv27', 'cv28', 'cv29', 'cv30', 'cv32'", "editor.fontSize": 14, "editor.fontWeight": "normal", "editor.formatOnPaste": true, "editor.formatOnSave": true, "editor.formatOnSaveMode": "file", "editor.formatOnType": true, "editor.guides.bracketPairs": true, "editor.guides.bracketPairsHorizontal": true, "editor.guides.highlightActiveBracketPair": true, "editor.guides.highlightActiveIndentation": true, "editor.guides.indentation": true, "editor.inlayHints.enabled": "offUnlessPressed", "editor.inlineSuggest.enabled": true, "editor.insertSpaces": true, "editor.letterSpacing": 0, "editor.minimap.renderCharacters": false, "editor.renderControlCharacters": true, "editor.renderWhitespace": "boundary", "editor.smoothScrolling": true, "editor.suggestSelection": "recentlyUsedByPrefix", "editor.tabSize": 4, "editor.unicodeHighlight.allowedCharacters": { "ß": true, "ä": true, "ö": true, "ü": true }, "editor.unicodeHighlight.allowedLocales": { "_os": true, "_vscode": true }, "editor.unicodeHighlight.ambiguousCharacters": true, "editor.unicodeHighlight.includeComments": true, "editor.unicodeHighlight.includeStrings": true, "editor.unicodeHighlight.invisibleCharacters": true, "editor.unicodeHighlight.nonBasicASCII": true, "editor.wordWrap": "on", "editor.wrappingIndent": "indent", "explorer.confirmDelete": false, "explorer.confirmDragAndDrop": false, "files.associations": { "*.ascx": "html", "*.ashx": "html", "*.asmx": "html", "*.aspx": "html", "*.master": "html" }, "files.autoGuessEncoding": true, "files.autoSave": "onFocusChange", "files.defaultLanguage": "${activeEditorLanguage}", "files.encoding": "utf8", "files.eol": "\n", "files.hotExit": "onExit", "files.insertFinalNewline": true, "files.trimFinalNewlines": true, "git.autofetch": true, "git.confirmSync": false, "git.enableSmartCommit": true, "gitlens.defaultDateFormat": "YYYY-MM-DD HH:mm", "gitlens.defaultDateLocale": null, "gitlens.defaultDateShortFormat": "YYYY-MM-DD", "gitlens.defaultTimeFormat": "HH:mm", "html.format.extraLiners": "", "html.format.indentInnerHtml": false, "html.format.wrapAttributes": "aligned-multiple", "html.validate.scripts": true, "html.validate.styles": true, "javascript.updateImportsOnFileMove.enabled": "always", "livePreview.notifyOnOpenLooseFile": false, "omnisharp.useModernNet": true, "powershell.pester.useLegacyCodeLens": false, "powershell.scriptAnalysis.enable": true, "prettier.jsxBracketSameLine": true, "prettier.tabWidth": 4, "python.formatting.provider": "black", "redhat.telemetry.enabled": false, "remote.SSH.remotePlatform": {}, "rpc.appName": "Visual Studio Code", "rpc.buttonActiveLabel": "View Repository", "rpc.buttonEnabled": true, "rpc.buttonInactiveLabel": "GitHub", "rpc.buttonInactiveUrl": "https://github.com/masterflitzer", "rpc.checkIdle": true, "rpc.detailsDebugging": "Debugging {file_name}", "rpc.detailsEditing": "Editing {file_name}", "rpc.detailsIdling": "Coding", "rpc.detailsViewing": "Viewing {file_name}", "rpc.enabled": true, "rpc.idleText": "zZz", "rpc.idleTimeout": 1800, "rpc.largeImage": "Editing a {lang} file", "rpc.largeImageIdling": "AFK", "rpc.lowerDetailsDebugging": "In {workspace} - {problems} problems found", "rpc.lowerDetailsEditing": "In {workspace} - {problems} problems found", "rpc.lowerDetailsIdling": "{empty}", "rpc.lowerDetailsNoWorkspaceFound": "empty workspace", "rpc.lowerDetailsViewing": "In {workspace} - {problems} problems found", "rpc.prioritizeLanguagesOverExtensions": true, "rpc.problemsText": "{problemsCount}", "rpc.removeDetails": false, "rpc.removeElapsedTime": false, "rpc.removeLowerDetails": false, "rpc.removeLowerDetailsIdling": true, "rpc.showProblems": true, "rpc.suppressNotifications": true, "security.workspace.trust.enabled": true, "sortJSON.contextMenu": { "sortJSON": true, "sortJSONAlphaNum": false, "sortJSONAlphaNumReverse": false, "sortJSONKeyLength": false, "sortJSONKeyLengthReverse": false, "sortJSONReverse": false, "sortJSONType": false, "sortJSONTypeReverse": false, "sortJSONValues": false, "sortJSONValuesReverse": false }, "telemetry.telemetryLevel": "off", "terminal.explorerKind": "integrated", "terminal.external.windowsExec": "pwsh", "terminal.integrated.copyOnSelection": true, "terminal.integrated.cursorBlinking": true, "terminal.integrated.cursorStyle": "block", "terminal.integrated.defaultProfile.windows": "PowerShell", "terminal.integrated.gpuAcceleration": "auto", "terminal.integrated.rightClickBehavior": "paste", "terminal.integrated.shellIntegration.enabled": true, "terminal.integrated.useWslProfiles": true, "terminal.integrated.windowsEnableConpty": true, "typescript.updateImportsOnFileMove.enabled": "always", "update.enableWindowsBackgroundUpdates": true, "update.mode": "default", "update.showReleaseNotes": false, "vscode-edge-devtools.sourceMaps": true, "vscode-edge-devtools.useHttps": true, "vscode-edge-devtools.userDataDir": false, "vscode-edge-devtools.webhint": true, "window.menuBarVisibility": "visible", "window.openFilesInNewWindow": "off", "window.openFoldersInNewWindow": "default", "window.openWithoutArgumentsInNewWindow": "on", "window.restoreWindows": "all", "workbench.list.smoothScrolling": true, "workbench.startupEditor": "welcomePageInEmptyWorkbench" }
Extensions
- Extensions exportieren:
code --list-extensions > vscode-extensions.txt - Extensions importieren:
- Windows:
cat vscode-extensions.txt | % { code --install-extension $_ } - Linux:
cat vscode-extensions.txt | xargs -l1 code --install-extension
- vscode-extensions.txt
42Crunch.vscode-openapi augustocdias.tasks-shell-input dbaeumer.vscode-eslint denoland.vscode-deno eamodio.gitlens ecmel.vscode-html-css EditorConfig.EditorConfig eg2.vscode-npm-script esbenp.prettier-vscode firefox-devtools.vscode-firefox-debug GitHub.remotehub GitHub.vscode-pull-request-github GitLab.gitlab-workflow GrapeCity.gc-excelviewer James-Yu.latex-workshop LeonardSSH.vscord mechatroner.rainbow-csv mhutchie.git-graph ms-azuretools.vscode-docker ms-dotnettools.csharp ms-edgedevtools.vscode-edge-devtools ms-python.python ms-python.vscode-pylance ms-toolsai.jupyter-keymap ms-vscode-remote.remote-containers ms-vscode-remote.remote-ssh ms-vscode-remote.remote-ssh-edit ms-vscode-remote.remote-wsl ms-vscode-remote.vscode-remote-extensionpack ms-vscode.cpptools ms-vscode.hexeditor ms-vscode.live-server ms-vscode.powershell ms-vscode.remote-repositories ms-vsliveshare.vsliveshare redhat.java redhat.vscode-xml redhat.vscode-yaml richie5um2.vscode-sort-json rust-lang.rust-analyzer serayuzgur.crates tamasfe.even-better-toml usernamehw.errorlens vadimcn.vscode-lldb VisualStudioExptTeam.vscodeintellicode Vue.volar WallabyJs.quokka-vscode
Entwicklungsumgebung einrichten
C/C++
.vscode/
- .vscode/launch.json
{ // Use IntelliSense to learn about possible attributes. // Hover to view descriptions of existing attributes. // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ { "name": "C (clang)", "type": "cppdbg", "request": "launch", "program": "${fileDirname}/${fileBasenameNoExtension}.exe", "args": [], "stopAtEntry": false, "cwd": "${fileDirname}", "environment": [], "externalConsole": false, "MIMode": "lldb", "miDebuggerPath": "C:/msys64/clang64/bin/lldb.exe", "setupCommands": [], "preLaunchTask": "C (clang)" }, { "name": "C++ (clang++)", "type": "cppdbg", "request": "launch", "program": "${fileDirname}/${fileBasenameNoExtension}.exe", "args": [], "stopAtEntry": false, "cwd": "${fileDirname}", "environment": [], "externalConsole": false, "MIMode": "lldb", "miDebuggerPath": "lldb", "setupCommands": [], "preLaunchTask": "C++ (clang++)" }, { "name": "C/C++ (cl)", "type": "cppvsdbg", "request": "launch", "program": "${fileDirname}/${fileBasenameNoExtension}.exe", "args": [], "stopAtEntry": false, "cwd": "${fileDirname}", "environment": [], "console": "integratedTerminal", "preLaunchTask": "C/C++ (cl)" } ] }
- .vscode/tasks.json
{ "version": "2.0.0", "tasks": [ { "label": "C (clang)", "type": "cppbuild", "command": "clang", "args": [ "-fcolor-diagnostics", "-g", "${file}", "-o", "${fileDirname}/${fileBasenameNoExtension}.exe" ], "options": { "cwd": "${fileDirname}" }, "problemMatcher": [ "$gcc" ], "group": { "kind": "build", "isDefault": true }, "detail": "C (clang)" }, { "label": "C++ (clang++)", "type": "cppbuild", "command": "clang++", "args": [ "-fcolor-diagnostics", "-g", "${file}", "-o", "${fileDirname}/${fileBasenameNoExtension}.exe" ], "options": { "cwd": "${fileDirname}" }, "problemMatcher": [ "$gcc" ], "group": { "kind": "build", "isDefault": true }, "detail": "C++ (clang++)" }, { "label": "C/C++ (cl)", "type": "shell", "command": "${workspaceFolder}/.vscode/build.ps1", "args": [ "/Zi", "/EHsc", "/nologo", "/Fe:", "${fileDirname}/${fileBasenameNoExtension}.exe", "${file}" ], "options": { "cwd": "${fileDirname}" }, "problemMatcher": [ "$msCompile" ], "group": { "kind": "build", "isDefault": true }, "detail": "C/C++ (cl)" } ] }
Windows (Clang)
https://code.visualstudio.com/docs/cpp/config-mingw
mehr infos bezüglich msys2: https://msys2.org/
für folgende PowerShell Kommandos werden Admin Rechte benötigt
Setup
# install msys2 winget install -e --id msys2.msys2 # open clang environment of msys2 (new window) C:/msys64/msys2_shell.cmd -clang64 pacman -Syu # confirm with Y (window will close) and repeat: C:/msys64/msys2_shell.cmd -clang64 pacman -Syu # install clang toolchain (just choose all) pacman -S --needed base-devel mingw-w64-clang-x86_64-toolchain # when up to date, close window/exit with ctrl+d # update windows path $msys2Path = "C:\msys64\clang64\bin" $envTargetMachine = [System.EnvironmentVariableTarget]::Machine $envPath = [System.Environment]::GetEnvironmentVariable("Path", $envTargetMachine) $envPathList = [System.Collections.Generic.List[string]]::new($envPath.Trim(";").Split(";")) $envPathList.Add($msys2Path) $envPath = [string]::Join(";", $envPathList) + ";" [System.Environment]::SetEnvironmentVariable("Path", $envPath, $envTargetMachine)
.vscode/
- .vscode/c_cpp_properties.json
{ "configurations": [ { "name": "Win32", "defines": [ "_DEBUG", "UNICODE", "_UNICODE" ], "compilerPath": "C:/msys64/clang64/bin/clang++.exe", "cStandard": "c17", "cppStandard": "c++20", "intelliSenseMode": "windows-clang-x64" } ], "version": 4 }
Windows (MSVC)
https://code.visualstudio.com/docs/cpp/config-msvc
- C/C++ Extension installieren
- VS Build Tools installieren (Visual Studio Downloads)
- automatisch: Visual Studio installieren und Workload Desktop development with C++ im Visual Studio Installer auswählen
- manuell: Tools for Visual Studio > Build Tools for Visual Studio installieren
- Projekt/Verzeichnis in VS Code öffnen > Terminal > Configure Default Build Task > cl.exe auswählen
- tasks.json und launch.json wie oben gezeigt anpassen
.vscode/
- .vscode/c_cpp_properties.json
{ "configurations": [ { "name": "Win32", "defines": [ "_DEBUG", "UNICODE", "_UNICODE" ], "compilerPath": "C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.32.31326/bin/Hostx64/x64/cl.exe", "cStandard": "c17", "cppStandard": "c++20", "intelliSenseMode": "windows-msvc-x64" } ], "version": 4 }
- .vscode/build.ps1
$ErrorActionPreference = "Stop" $VSPath = "C:/Program Files/Microsoft Visual Studio/2022/Community" Import-Module "$VSPath/Common7/Tools/Microsoft.VisualStudio.DevShell.dll" Enter-VsDevShell -VsInstallPath "$VSPath" $command = "cl" foreach ($arg in $args) { $command += " ""$arg""" } Write-Host "Build Command: `n$command`n" Invoke-Expression $command
