Skip to content

Define a format style and format all files using JuliaFormatter.jl #17

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

Merged
merged 5 commits into from
Nov 4, 2022

Conversation

mroavi
Copy link
Collaborator

@mroavi mroavi commented Nov 4, 2022

Adds a .JuliaFormatter.toml file to define the format style.
Formats all files using this style.

@mroavi mroavi requested a review from GiggleLiu November 4, 2022 10:40
@GiggleLiu
Copy link
Member

GiggleLiu commented Nov 4, 2022

Looks great! Never used JuliaFormattter, can you comment a bit on how to run the formatter?

@GiggleLiu GiggleLiu merged commit 955c49d into main Nov 4, 2022
@mroavi
Copy link
Collaborator Author

mroavi commented Nov 4, 2022

JuliaFormatter.jl is the formatter used by LanguageServer.jl. This means that you can use it from VsCode (as shown here) or from Neovim using its LSP client. You can also use it standalone like this:

julia> using JuliaFormatter

# Recursively formats all Julia files in the current directory
julia> format(".")

# Formats an individual file
julia> format_file("foo.jl")

# Formats a string (contents of a Julia file)
julia> format_text(str)

# Formats all files in the package directory of a `Module`
julia> format(FooPackage)

see the docs for more details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants