| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
OpenCode plugin that automatically formats .NET files (C#, F#, VB) using dotnet format whenever OpenCode edits them.
Add the plugin to your OpenCode config file:
Global (~/.config/opencode/opencode.json):
{
"plugin": ["@workedbeforepush/opencode-dotnet-format"]
}Project-level (opencode.json):
{
"plugin": ["@workedbeforepush/opencode-dotnet-format"]
}OpenCode installs npm plugins automatically at startup.
Copy src/index.ts to one of the plugin directories:
Files placed in these directories are loaded automatically at startup.
file.edited event fires
|
v
Is the file extension .cs / .vb / .fs / .fsi / .fsx / .fsscript?
|
yes
|
v
Walk parent directories for *.slnx / *.sln / *.csproj / *.fsproj / *.vbproj
|
found
|
v
dotnet format style <project-file> --include <relative-path> --severity info
|
v
Log result (success or warning)
This plugin has no configuration options. It uses whatever rules your .editorconfig and analyzer settings define.
To control which style rules apply and at what severity, configure them in your .editorconfig:
[*.cs]
# Enforce var usage
csharp_style_var_for_built_in_types = true:suggestion
csharp_style_var_when_type_is_apparent = true:suggestion
# Namespace declarations
csharp_style_namespace_declarations = file_scoped:warning
# Using directives
dotnet_sort_system_directives_first = trueSee the .NET code style rule options documentation for all available settings.
Enable debug logging to see plugin output:
opencode --log-level DEBUGLook for log lines with service opencode-dotnet-format:
opencode-dotnet-format info dotnet-format plugin loaded opencode-dotnet-format info Formatting: dotnet format style MyProject.sln --include src/MyFile.cs --severity info
If the plugin does not load:
# Install dependencies
bun install
# Type check
bun run typecheck
# Build
bun run buildMIT
| Back | FazBrowse Home | New Git URL |