-
Notifications
You must be signed in to change notification settings - Fork 101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add JuliaFormatter plugin #412
Conversation
Codecov Report
@@ Coverage Diff @@
## master #412 +/- ##
==========================================
- Coverage 94.45% 93.56% -0.89%
==========================================
Files 22 23 +1
Lines 667 684 +17
==========================================
+ Hits 630 640 +10
- Misses 37 44 +7
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apart from changing the default, i think this looks great! please could you also increment the version number in Project.toml? thanks!
This is ready! |
src/plugins/juliaformatter.jl
Outdated
|
||
function view(p::JuliaFormatter, t::Template, pkg::AbstractString) | ||
d = Dict{String,String}() | ||
if p.style == "nostyle" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not use nothing
for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because it is not a String
, and for the interactive menu it seemed easier if all the entries were strings
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how about just the empty string ""
?
Also solves #328 For now the BlueStyle plugin is separate from the JuliaFormatter one, perhaps we should deprecate it and add a generic code style badge based on the JuliaFormatter style? |
thanks, again! |
You're welcome! Good for merging? |
src/PkgTemplates.jl
Outdated
@@ -33,6 +33,7 @@ export | |||
Git, | |||
GitHubActions, | |||
GitLabCI, | |||
JuliaFormatter, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one problem with this that i just thought of, is that if JuliaFormatter.jl is loaded (e.g. in startup.jl
), then we'll see
julia> using PkgTemplates
WARNING: using PkgTemplates.JuliaFormatter in module Main conflicts with an existing identifier.
...do people put JuliaFormatter in their startup?
Do you think this is an issue?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not a regular JuliaFormatter user so i've no idea if this name conflict is going to be a common issue for users
but there's only one formatter for Julia... so i wonder if we should just name this plugin Formatter
(or JuliaFormat
or some such) to avoid the name conflict?
(I guess we don't have this issue with Documenter
as it's usually only loaded in a separate docs/
env)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think renaming to Formatter is a good idea, I have JuliaFormatter in my startup
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done in the next commit
Not sure how to deprecate the BlueStyle badge? Can probably be done in a separate PR |
if you bump the version we can make a release straight away :) |
Done! |
Only bumped the patch version because I believe the change is nonbreaking
https://pkgdocs.julialang.org/v1/compatibility/#compat-pre-1.0 |
Add a JuliaFormatter plugin which takes a
style
keyword argument and constructs a.JuliaFormatter.toml
file using only the style choice (it's up to the user to customize it further).This sets the style of automatic formatting for JuliaFormatter.jl, and thus also for the VSCode extension.
Solves #324