Comments (3)
There isn't currently a way to tell CSharpier which files to format and with which formatter, but I do have a branch where I have csproj/xml formatting mostly done and will need to figure it out.
For now though it will be easy to change the hardcoded ".cs" checks in the cli to ".cs/.csx".
Changing the extensions should also happen, but is probably less important.
from csharpier.
That's my bad, I assumed csx were just regular c# code and only tested that way. From my googling it looks like Roslyn can still parse it into a syntax tree, so it should be straightforward for me to get working, it just won't be the two line change that I hoped.
from csharpier.
Hi, thanks @belav but now there is another problem, can this issue be open again or should I open a new issue?
If I try to run Csharpier in my file, the following error appears:
❯ dotnet csharpier ./main.csx
Warning ./main.csx - Failed to compile so was not formatted.
(1,1): error CS1024: Preprocessor directive expected
(3,2): error CS8097: #load is only allowed in scripts
Formatted 1 files in 266ms.
As I can see, CSharpier cannot process files with the #!/usr/bin/env dotnet-script
and the #load
directive.
This is an example file:
#!/usr/bin/env dotnet-script
#load "other.csx"
WriteLine("Hello World");
If I remove those lines, CSharpier works as expected.
There are no errors with those lines. #!/usr/bin/env dotnet-script
is required so I can run the script directly and the #load
directive is used to load additional scripts.
UPDATE
Looks like using any directive doesn't work. #r
directive also fails:
// Example
#r "nuget: AngleSharp, 1.1.0"
❯ dotnet csharpier ./scrapper.csx
Warning ./scrapper.csx - Failed to compile so was not formatted.
(2,2): error CS7011: #r is only allowed in scripts
(3,2): error CS7011: #r is only allowed in scripts
from csharpier.
Related Issues (20)
- using static System.* usings not ordered before other static usings like using System.* ones
- Spacing after StyleCop.Analyzers file header
- CSharper does not recognize class primary constructor HOT 2
- Spread (in collection expression) are not formatted
- Using aliases sorting is not always the same depending on the input order
- Extra indent when call method on RawStringLiteral HOT 1
- Add more options to CodeFormatterOptions HOT 1
- editorconfig dotnet_sort_system_directives_first = false ignored HOT 2
- VSCode extension support local csharpier install HOT 2
- Visual Studio stopped responding for 9 seconds. Disabling the extension CSharpier 1.5.1 might help. HOT 8
- CSharpier can not support slice[] grama, HOT 3
- Avoid wrapping method arguments including a block-bodied lambda HOT 3
- CSharpier unable to run dotnet commands HOT 17
- Extra newline in switch case statement with curly braces HOT 1
- Support VSCode Format on Save Modifications Only Mode HOT 1
- Cannot format project containing editorconfig
- Rider - dotnet not found HOT 2
- Issue Formatting Region HOT 4
- Docs use C# instead of CS for code-blocks HOT 1
- Formatting doesn't work with multiple project files in a folder HOT 6
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 csharpier.