{"id":21880727,"url":"https://github.com/elders/vse-formatdocumentonsave","last_synced_at":"2025-05-10T22:52:19.043Z","repository":{"id":11465945,"uuid":"13931300","full_name":"Elders/VSE-FormatDocumentOnSave","owner":"Elders","description":"Visual Studio - Format Document on Save","archived":false,"fork":false,"pushed_at":"2024-08-01T09:47:19.000Z","size":143,"stargazers_count":123,"open_issues_count":9,"forks_count":23,"subscribers_count":17,"default_branch":"master","last_synced_at":"2025-05-10T22:52:13.726Z","etag":null,"topics":["c-sharp","code-formatter","document","formatter","formatting","visual-studio"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Elders.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"mynkow"}},"created_at":"2013-10-28T16:21:11.000Z","updated_at":"2025-04-12T06:24:26.000Z","dependencies_parsed_at":"2024-12-18T17:10:41.407Z","dependency_job_id":"2800d5c1-4540-4a8e-893f-7d2913c722fc","html_url":"https://github.com/Elders/VSE-FormatDocumentOnSave","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Elders%2FVSE-FormatDocumentOnSave","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Elders%2FVSE-FormatDocumentOnSave/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Elders%2FVSE-FormatDocumentOnSave/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Elders%2FVSE-FormatDocumentOnSave/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Elders","download_url":"https://codeload.github.com/Elders/VSE-FormatDocumentOnSave/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253492615,"owners_count":21916964,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c-sharp","code-formatter","document","formatter","formatting","visual-studio"],"created_at":"2024-11-28T09:15:46.455Z","updated_at":"2025-05-10T22:52:19.026Z","avatar_url":"https://github.com/Elders.png","language":"C#","funding_links":["https://github.com/sponsors/mynkow"],"categories":[],"sub_categories":[],"readme":"VSE-FormatDocumentOnSave\n========================\nEnables auto formatting of the code when you save a file. Visual Studio supports auto formatting of the code with the CTRL+E,D or CTRL+E,F key shortcuts but with this extension the command `Edit.FormatDocument` is executed on Save.\n\n# Versions\nUp until now the extension supported older versions of Visual Studio (2012-2019). \nSince Visual Studio 2022 there are a lot of breaking changes in the VSIX SDK and it is really hard to support older versions of Visual Studio. For that reason the extension is split into two:\n\n## Visual Studio 2022\nGoing forward this will be the version which will be supported and maintained. If possible, future versions of Visual Studio will be supported within this package.  \nhttps://marketplace.visualstudio.com/items?itemName=mynkow.FormatDocumentOnSave\n\n## Visual Studio 2012-2019\nhttps://marketplace.visualstudio.com/items?itemName=mynkow.FormatDocumentOnSaveLegacy\n\n# Configuration\nThere are 5 settings which you could configure:\n* Command\n* Allowed extensions\n* Denied Extensions\n* Enable\n* Enable in Debug\n\n### Command\nThis is the Visual Studio command which will be invoked when a document is saved. For multiple values you could use `space` separated list.\n##### Default\n`Edit.FormatDocument`\n##### CodeCleanup\nMany people were asking how to execute a CodeCleanup on save. It is possible to replace the default command with `Analyze.RunDefaultCodeCleanupOnSolution` which executes all the commands configured in the default profile.\n\nnote: In rare occasions VisualStudio2019 enters in a infinite loop. A restart or extension reinstall helps. If you know how to reproduce this bug please log an issue.\n\n### Allowed extensions\nSpecifies all file extensions where the `command` is allowed to be executed. For multiple values you could use `space` separated list.\n##### Default\n`allowed_extensions = .*`\n\n### Denied extensions\nSpecifies all file extensions where the `command` is NOT allowed to be executed. For multiple values you could use `space` separated list.\n##### Default\n`denied_extensions = `\n\n### Debug mode\nBy default the plugin is disabled in debug mode. You could explicitly configure to have the extension enabled while in a debug session.\n##### Default\n`enable_in_debug = false`\n\n# Examples\n## Scenario 1\n- `allowed_extensions = .*`\n- `denied_extensions = .cs` \n\n**Result:** All documents will be formatted because we explicitly specified that all extensions will be formatted using `allowed_extensions = .*`.\n\n## Scenario 2\n- `allowed_extensions = `\n- `denied_extensions = .js` \n\n**Result:** All documents will be formatted except those with `.js` extension\n\n## Scenario 3\n- `allowed_extensions = `\n- `denied_extensions = .*` \n\n**Result:** No documents will be formatted\n\n## Scenario 4\n- `allowed_extensions = .cs`\n- `denied_extensions = .*` \n\n**Result:** Only documents with `.cs` extension will be formatted\n\n## Scenario 5\n- `allowed_extensions = .cs`\n- `denied_extensions =` \n\n**Result:** All documents will be formatted because nothing is denied\n\n## Scenario 6\n- `allowed_extensions = .cs`\n- `denied_extensions = .cs` \n\n**Result:** All documents will be formatted because there is a conflict \n\n# Visual Studio\nYou can configure these settings from the Visual Studio Options menu\n\n# Format Config\n\nCreate a `.formatconfig` file in the root of your project \n\nNote: If you have a `.formatconfig` file, the VS options are ignored!\n\n## Example\n```\nroot = true\n\n[*.*]\nenable = true\ncommand = Edit.FormatDocument\nallowed_extensions = \ndenied_extensions = .js .html\n```\n\n## Example with multiple commands\n```\nroot = true\n\n[*.*]\n\ncommand = Edit.FormatDocument Edit.FormatDocument\nallowed_extensions = \ndenied_extensions = .js .html\n```\n\n## Disable the extension\nIf you wish to temporarily disable to extension you could press CapsLock.  \nBy default the extension is disabled while in a debug session. You could change that from the configuration.\nYou can enable or disable the extension in the configuration, or disable in a `.formatconfig` file.\n\n# Contribute\nTo setup development environment follow the steps:\n\n* Install `Visual Studio SDK` from Visual Studio Installer\nhttps://prnt.sc/umv2ak\n\n* Clone the project\n\n* Configure debug \nOpen project properties and go to the `Debug` tab. Select `Start external program:` and enter the path to your Visual Studio exe. For example `C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\Common7\\IDE\\devenv.exe`. In the `Command line arguments:` type `/rootsuffix Exp`\nhttps://prnt.sc/umv47r\n\n* Debug\nWhen you press `F5` a new instance of Visual Studio will open. From there you need to load an exising solution, file or create a new one. When you press `ctrl` + `s` it will trigger break points you have set in the initial Visual Studio instance.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felders%2Fvse-formatdocumentonsave","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felders%2Fvse-formatdocumentonsave","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felders%2Fvse-formatdocumentonsave/lists"}