A workspace for C programming experiments and learning.
On macOS, you can install clang-format using Homebrew. However, VS Code's C/C++ Extension Pack comes with integrated clang-format.
The code between a comment // clang-format off or /* clang-format off */ up
to a comment // clang-format on or /* clang-format on */ will not be
formatted. The comments themselves will be formatted (aligned) normally. Also,
a colon (:) and additional text may follow // clang-format off or
// clang-format on to explain why clang-format is turned off or back on.
I really like this section: Use Early Exits and continue to Simplify Code
Using linux indent command:
format:
indent -linux $(PATHS)*.c $(PATHS)*.h $(PATHT)*.c
$(CLEANUP) $(PATHS)*~ $(PATHS)*~ $(PATHT)*~
C/C++ Extension Pack from Microsoft:
- C/C++ IntelliSense
- C/C++ Themes
- CMake Tools
In "Manage->Settings" (⌘,) search for "C_Cpp" (162 Settings Found).
See Editing and Navigating C++ Code and Customizing default settings.
You can format an entire file with Format Document (⇧⌥F) or just the current selection with Format Selection (⌘K ⌘F) in right-click context menu.
See Formatting.
The Visual Studio style is similar to:
BasedOnStyle: LLVM,
UseTab: Never,
IndentWidth: 4,
TabWidth: 4,
BreakBeforeBraces: Allman,
AllowShortIfStatementsOnASingleLine: false,
IndentCaseLabels: false,
ColumnLimit: 0,
AccessModifierOffset: -4,
NamespaceIndentation: All,
FixNamespaceComments: false markdownlint by David Anson: Markdown linting and style checking for Visual Studio Code.
MD013/line-length : Line length :
Add in ~/Library/Application Support/Code/User/settings.json:
"markdownlint.config": {
"MD003": { // Heading style
"style": "setext_with_atx"
},
"MD013": { // Line length
"code_blocks": false,
"tables": false
}
},VS Code March 2025 (version 1.99)
- Agent mode is available in VS Code Stable. Enable it by setting
chat.agent.enabled - Extend agent mode with Model Context Protocol (MCP) server tools
- Try the new built-in tools in agent mode for fetching web content, finding symbol references, and deep thinking
- Next Edit Suggestions is now generally available
- Benefit from fewer distractions such as diagnostics events while AI edits are applied in the editor
- Use your own API keys to access more language models in chat (preview)
- Easily switch between ask, edit, and agent mode from the unified chat experience
- Experience improved workspace search speed and accuracy with instant remote workspace indexing
- Create and edit notebooks as easily as code files with support for edit and agent mode