Comments (9)
@BhaaLseN you did the right thing. I just put this repo together recently
from format.
This is available on myget version 3.0.4-prerelease.19171.3 and later
dotnet tool install -g dotnet-format --version 3.0.4-prerelease.19171.3 --add-source https://dotnet.myget.org/F/format/api/v3/index.json
from format.
@JoeRobich or @jinujoseph can you move this to https://github.com/dotnet/format?
from format.
Oh, nice, didn't know there was a repository dedicated to dotnet format
; created the issue on roslyn
since it had other related issues.
Thanks for moving it 👍
from format.
@jmarolf @JoeRobich I was thinking of looking into this, as it's something I could use too. Is the way it's written in the above intended use case the way to move forward? Is a --files
option necessary or would providing paths as arguments to the command be enough?
from format.
Personally, my gut tells me dotnet format Program.cs
should just format Program.cs
without requiring a parameter. dotnet format Sample.csproj
doesn't work and requires the use of -w
/--workspace
, so the parameter-less invocation seems free for grabs (unless this is a limitation of invoking commands using dotnet
).
I'm fine with either though; but I'm not sure if passing filenames as command line will ever run into issues on any of the supported OS (due to length restrictions or whatever).
from format.
@BhaaLseN When thinking long-term, I agree with you. Currently we get some benefits from using the MSBuildWorkspace to enumerate projects and documents as well as saving changes, which requires a project or solution file.
@challen0 I think the easiest path to get this in would be to:
- Require that a workspace (a single project or solution file) be discoverable in the current directory or specified with the
-w
flag (as currently is the case) - Add a
--files
flag that accepts a comma separated list of file paths - Globs are not currently supported
- When processing documents in a project, if
--files
were specified, check that the document path ends with one of the file paths before formatting.
from format.
Pass that file list as command line parameters into dotnet format (or try to pipe them into stdin)
In order to format list of files that I have just committed, I am using the following command before pushing my changes upstream:
dotnet-format --files $(git show --name-only --pretty="" | tr '\n' ',')
(followed by git add . && git commit --amend
)
It would be great if we can pipe the files one by one:
git show --name-only --pretty="" | dotnet-format --files
or simply
git show --name-only --pretty="" | dotnet-format
and/or even: git show --name-only --pretty="" | dotnet-format -
(minus sign in the end implying read-from-stdin)
i.e. without needing to join the list as comma separated and read path from stdin.
from format.
@am11 can you file a new issue for that request? Thanks!
from format.
Related Issues (20)
- --binarylog option broken HOT 3
- Please clarify if this tool is actively supported / worked on HOT 2
- Can I use dotnet format to just generate report and not make the changes to the file. HOT 2
- Issue: Limited Scope for Running the Tool on Changed Files in Pull Requests HOT 1
- running dotnet format on my unity project takes over an hour HOT 2
- .net 8.0.2 Blazor `_imports.razor` & using `IDE0005` HOT 4
- Not detect IDE0290. HOT 1
- IDE0051 format issues with Razor code behind files with SDK 8.0.200 HOT 4
- Questions around Contributing to the Repo HOT 5
- dotnet format is now part of the SDK repo HOT 1
- Wrong indentation when using primary constructor
- Simplify interpolation (IDE0071) - false positive with Enum and FormattableString
- CA1067 on C# record implementing a VB.NET interface
- Does not adhere to language set in `DOTNET_CLI_UI_LANGUAGE`
- Line wrapping and indentation of Collection Literals
- Error Changing document properties is not supported
- CS0534 validation adding wrong code. HOT 1
- pre-commit hook fails: no compatible SDK was found HOT 1
- Feature Request: Support for Excluding Specific Subcommands with --skip in dotnet format
- Can't suppress WHITESPACE warnings HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from format.