Skip to content

whitechno/c-x

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

C Programming Experiments

A workspace for C programming experiments and learning.

Code formatting

clang-format

ClangFormat

On macOS, you can install clang-format using Homebrew. However, VS Code's C/C++ Extension Pack comes with integrated clang-format.

Clang-Format Style Options

LLVM Coding Standards

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

indent

Using linux indent command:

format:
 indent -linux $(PATHS)*.c $(PATHS)*.h $(PATHT)*.c
 $(CLEANUP) $(PATHS)*~ $(PATHS)*~ $(PATHT)*~

VS Code setup

C/C++

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 

Markdown lint

markdownlint by David Anson: Markdown linting and style checking for Visual Studio Code.

Configure

MD003 - Heading style

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 new features

VS Code March 2025 (version 1.99)

Agent Mode

  • 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

Code Editing

  • Next Edit Suggestions is now generally available
  • Benefit from fewer distractions such as diagnostics events while AI edits are applied in the editor

Chat Features

  • 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

Notebook Editing

  • Create and edit notebooks as easily as code files with support for edit and agent mode

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published