Skip to content
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

Rewrite with JuliaSyntax #870

Merged
merged 190 commits into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
190 commits
Select commit Hold shift + click to select a range
2ae0b79
use JuliaSyntax for document + state
domluna Jun 12, 2024
7d0b8ca
CSTParser is bad at this part
domluna Jun 12, 2024
1b08eae
wip
domluna Jun 13, 2024
6bdf813
same api
domluna Jun 13, 2024
8f0304f
wip
domluna Jun 13, 2024
c43e3c6
first format working
domluna Jun 13, 2024
53372fe
rm DataStructures
domluna Jun 13, 2024
ed2e49f
options
domluna Jun 13, 2024
e4e1f6a
good progress
domluna Jun 20, 2024
4c591bc
works
domluna Jun 20, 2024
96d19f6
ok
domluna Jun 20, 2024
1b44e2f
Disable for now
domluna Jun 20, 2024
2d40789
fixes
domluna Jun 20, 2024
46858a5
progress - unicode is being an issue
domluna Jul 11, 2024
aaebc3a
ok
domluna Jul 11, 2024
17d74a3
ok
domluna Jul 11, 2024
da9e5a7
more tests pass
domluna Jul 11, 2024
ca4a006
ok i think it's time to use julia syntax for more now all tests pass …
domluna Jul 11, 2024
bf159c6
k
domluna Jul 11, 2024
cb66d31
precompile
domluna Jul 12, 2024
d28bc25
hmmm
domluna Jul 13, 2024
c639d09
progress
domluna Jul 18, 2024
6bceea8
wip
domluna Jul 20, 2024
cecf129
wip
domluna Jul 24, 2024
9abe66d
wip
domluna Jul 27, 2024
579df51
fmt
domluna Jul 27, 2024
13138f7
wio
domluna Jul 30, 2024
75ad069
lineage
domluna Jul 30, 2024
a189721
lfg
domluna Aug 3, 2024
d9cef80
wip
domluna Aug 3, 2024
1b7b18b
coming together
domluna Aug 6, 2024
56438dc
dwadaw
domluna Aug 7, 2024
8a794e5
wow
domluna Aug 8, 2024
acec3ca
parameters working better
domluna Aug 8, 2024
55fb748
more tests passing
domluna Aug 8, 2024
4895726
almost got initial tests passing
domluna Aug 11, 2024
bcb95d2
wip
domluna Aug 14, 2024
42f5d7c
let passing
domluna Aug 14, 2024
e188036
format
domluna Aug 14, 2024
87279ae
ok
domluna Aug 15, 2024
57c58c2
more tests passing
domluna Aug 16, 2024
97ee718
fmt
domluna Aug 16, 2024
ffe0049
fix
domluna Aug 16, 2024
3f2e95d
foo
domluna Aug 19, 2024
ebec966
format
domluna Aug 19, 2024
56aa9c7
more stuff working
domluna Aug 22, 2024
4c92d9f
wip
domluna Aug 26, 2024
faa33cc
wip
domluna Aug 26, 2024
8ff776b
almost there
domluna Sep 4, 2024
2171eba
fmt
domluna Sep 4, 2024
57640ed
hmmmm
domluna Sep 5, 2024
bd086ae
looking good
domluna Sep 5, 2024
96447c6
almost
domluna Sep 6, 2024
bb81ecc
tests pass
domluna Sep 6, 2024
9b889bb
save
domluna Sep 6, 2024
e8282bc
add warning to skip file if it's a parse error
domluna Sep 6, 2024
19efdf3
ok
domluna Sep 6, 2024
7be9135
ok
domluna Sep 6, 2024
eab2f3c
ok
domluna Sep 6, 2024
d944305
progress
domluna Sep 6, 2024
0745dc1
ok
domluna Sep 6, 2024
4bb78ee
another binary shortcircuit test
domluna Sep 6, 2024
1d6a40f
ok
domluna Sep 6, 2024
ecb2ecf
blue
domluna Sep 6, 2024
8f0585c
test
domluna Sep 6, 2024
89b8806
ok
domluna Sep 6, 2024
8b480a6
passes
domluna Sep 6, 2024
d5ad6c4
pass
domluna Sep 6, 2024
052d5ca
fix
domluna Sep 6, 2024
d864364
kwargs fix
domluna Sep 7, 2024
6887095
wip
domluna Sep 7, 2024
702ab0a
src
domluna Sep 7, 2024
9f9cf47
ok
domluna Sep 7, 2024
32c8bdc
ok
domluna Sep 7, 2024
f33e69e
lazy op
domluna Sep 7, 2024
e93b50d
more fixes
domluna Sep 8, 2024
8ffed72
standalone binary
domluna Sep 8, 2024
fe48cc3
comment out
domluna Sep 8, 2024
408d075
jfmt src
domluna Sep 8, 2024
480f406
for
domluna Sep 8, 2024
4ecbf70
format
domluna Sep 8, 2024
25b4806
another test
domluna Sep 8, 2024
1512a18
kw
domluna Sep 8, 2024
4788d87
simplify
domluna Sep 8, 2024
aa3e70b
parameters
domluna Sep 9, 2024
665c4a1
Cleanup
domluna Sep 9, 2024
44f0621
src done
domluna Sep 9, 2024
12831a7
another fix
domluna Sep 9, 2024
1301554
fmt
domluna Sep 9, 2024
c4a4efd
a
domluna Sep 9, 2024
12897f8
fixes
domluna Sep 9, 2024
ef062f3
fmt
domluna Sep 9, 2024
4913e50
fmt test files
domluna Sep 9, 2024
6b5459a
works
domluna Sep 9, 2024
2199a43
rm line
domluna Sep 9, 2024
26c1ccb
fix
domluna Sep 9, 2024
71c6ddd
ok
domluna Sep 9, 2024
90fdde6
ok
domluna Sep 9, 2024
1732c66
precompile
domluna Sep 9, 2024
d6f6d67
conflicts
domluna Sep 9, 2024
b64548b
merged from master
domluna Sep 9, 2024
5eeee87
ok
domluna Sep 9, 2024
ce3a75c
ok
domluna Sep 9, 2024
d77d678
ok
domluna Sep 9, 2024
e16037e
wip
domluna Sep 10, 2024
ba635d7
updates docs
domluna Sep 10, 2024
9a0cf12
fmt
domluna Sep 10, 2024
0c399bd
int/uint
domluna Sep 11, 2024
9f9e594
methods
domluna Sep 12, 2024
d5b5341
version check
domluna Sep 12, 2024
13c6666
version checks
domluna Sep 12, 2024
629bab8
fix
domluna Sep 12, 2024
3776cc6
fmt
domluna Sep 12, 2024
d6884cf
test
domluna Sep 13, 2024
c64e356
ok
domluna Sep 14, 2024
45ae9ef
format
domluna Sep 15, 2024
357e987
ok
domluna Sep 15, 2024
dd195d6
ok
domluna Sep 15, 2024
fda7df8
fixes
domluna Sep 15, 2024
29dfcfa
using jet
domluna Sep 16, 2024
19bda40
jet
domluna Sep 17, 2024
4d2bbf0
fmt
domluna Sep 17, 2024
5e624a8
wip
domluna Sep 17, 2024
7f5fe18
nospecialize
domluna Sep 17, 2024
8220679
ok
domluna Sep 17, 2024
98cb46b
more stuff
domluna Sep 17, 2024
229b928
ok
domluna Sep 17, 2024
3f94943
reduce precompilation time by a decent amount
domluna Sep 17, 2024
18474fb
remove kwargs
domluna Sep 17, 2024
0672412
rename
domluna Sep 17, 2024
1010e17
ok
domluna Sep 17, 2024
2387c03
cleanup
domluna Sep 17, 2024
cb45b48
ok
domluna Sep 17, 2024
05de6ae
precompile
domluna Sep 17, 2024
c6e1c20
progress
domluna Sep 17, 2024
5601474
allow hash eq comments to be placed whereever
domluna Sep 18, 2024
2a68eda
fix
domluna Sep 18, 2024
b6747d1
ok
domluna Sep 18, 2024
1f94147
try this
domluna Sep 18, 2024
88fdeb8
stuff
domluna Sep 18, 2024
14e726f
this too
domluna Sep 18, 2024
898225c
more
domluna Sep 18, 2024
0a2323f
ok
domluna Sep 19, 2024
c7bb3b0
shouldn't go crazy with @nospecialize
domluna Sep 21, 2024
b345209
get rid of precompietools for now
domluna Sep 22, 2024
0627088
seems to be working
domluna Sep 23, 2024
9e443f0
ok
domluna Sep 23, 2024
4030111
seems good
domluna Sep 23, 2024
bd32510
hmm
domluna Sep 23, 2024
86c0814
jet
domluna Sep 23, 2024
fec9d58
hmm
domluna Sep 23, 2024
70a0f52
fmt
domluna Sep 23, 2024
1ee5600
Merge remote-tracking branch 'origin/master' into dl/js-save
domluna Sep 23, 2024
845b989
allocs
domluna Sep 23, 2024
f770109
update
domluna Sep 23, 2024
cf843f2
type stable
domluna Sep 24, 2024
87cd506
kwdef
domluna Sep 24, 2024
1968a5f
ok
domluna Sep 25, 2024
677fcae
ok
domluna Sep 25, 2024
9e20b13
-1 -> 0
domluna Sep 25, 2024
fbca9bd
ok
domluna Sep 25, 2024
bdd712d
style update
domluna Sep 25, 2024
ffaee91
another format change
domluna Sep 25, 2024
b593c83
fix short-circuit to if pass ?
domluna Sep 25, 2024
159410a
format works
domluna Sep 25, 2024
9d6b392
ok
domluna Sep 25, 2024
aa28dba
update
domluna Sep 25, 2024
76d4f66
ok
domluna Sep 25, 2024
7b38ab1
docs update
domluna Sep 26, 2024
6ed6a89
simplify
domluna Sep 26, 2024
8741467
fix
domluna Sep 26, 2024
aad880e
format
domluna Sep 26, 2024
bf82f7f
this seems to be it
domluna Sep 26, 2024
cf4e058
keep semicolons in quote/begin blocks
domluna Oct 6, 2024
c5fe00b
some updates
domluna Oct 7, 2024
115d76f
format
domluna Oct 7, 2024
e655f87
improve runtime of strings and docstring formatting
domluna Oct 7, 2024
b574a93
remove @nospecialize
domluna Oct 7, 2024
f6fd4e9
reduce compilation time
domluna Oct 9, 2024
5ae44db
greater workload
domluna Oct 9, 2024
69cbc43
rm old format.jl file
domluna Oct 9, 2024
d8f7a6c
workload
domluna Oct 9, 2024
0139205
minor edit
domluna Oct 9, 2024
66f0292
more precompilation stuff
domluna Oct 9, 2024
a4f3057
format
domluna Oct 9, 2024
2466e13
fix conflicts
domluna Oct 10, 2024
ec9dfd9
fix test
domluna Oct 10, 2024
e038b06
1.10 is the new LTS
domluna Oct 11, 2024
60d0ed7
tuple blocks
domluna Oct 13, 2024
93bb805
format
domluna Oct 13, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .JuliaFormatter.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
remove_extra_newlines = true
always_for_in = true
conditional_to_if = true
separate_kwargs_with_semicolon = true
short_to_long_function_def = true
5 changes: 1 addition & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,8 @@ jobs:
strategy:
matrix:
version:
- '1.6'
- '1.7'
- '1.8'
- '1.9'
- '1.10'
- '1.11'
# - 'nightly'
arch: [x64, x86]
os: [ubuntu-latest, windows-latest, macos-13]
Expand Down
12 changes: 4 additions & 8 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,26 +1,22 @@
name = "JuliaFormatter"
uuid = "98e50ef6-434e-11e9-1051-2b60c6c9e899"
authors = ["Dominique Luna <[email protected]>"]
version = "1.0.62"
version = "2.0.0"

[deps]
CSTParser = "00ebfdb7-1f24-5e51-bd34-a7502290713f"
CommonMark = "a80b9123-70ca-4bc0-993e-6e3bcb318db6"
DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
Glob = "c27321d9-0574-5035-807b-f59d2c89b15c"
JuliaSyntax = "70703baa-626e-46a2-a12c-08ffd08c73b4"
PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a"
TOML = "fa267f1f-6049-4f14-aa54-33bafae1ed76"
Tokenize = "0796e94c-ce3b-5d07-9a54-7f471281c624"

[compat]
CSTParser = "^3.4.2"
CommonMark = "0.5, 0.6, 0.7, 0.8"
DataStructures = "0.17, 0.18"
Glob = "1.3"
JuliaSyntax = "^0.4.10"
PrecompileTools = "1"
TOML = "1"
Tokenize = "^0.5.16"
julia = "1.0"
julia = "1.10"

[extras]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Expand Down
107 changes: 0 additions & 107 deletions bin/format.jl

This file was deleted.

7 changes: 3 additions & 4 deletions docs/make.jl
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using Documenter, JuliaFormatter

makedocs(
makedocs(;
sitename = "JuliaFormatter",
format = Documenter.HTML(prettyurls = get(ENV, "CI", nothing) == "true"),
format = Documenter.HTML(; prettyurls = get(ENV, "CI", nothing) == "true"),
modules = [JuliaFormatter],
pages = [
"Introduction" => "index.md",
Expand All @@ -11,7 +11,6 @@ makedocs(
"Skipping Formatting" => "skipping_formatting.md",
"Syntax Transforms" => "transforms.md",
"Custom Alignment" => "custom_alignment.md",
"Custom Styles" => "custom_styles.md",
"YAS Style" => "yas_style.md",
"Blue Style" => "blue_style.md",
"SciML Style" => "sciml_style.md",
Expand All @@ -21,4 +20,4 @@ makedocs(
warnonly = true,
)

deploydocs(repo = "github.com/domluna/JuliaFormatter.jl.git", push_preview = true)
deploydocs(; repo = "github.com/domluna/JuliaFormatter.jl.git", push_preview = true)
24 changes: 13 additions & 11 deletions docs/src/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,23 @@ margin = 100

then files under `somedir` will be formatted with 2 spaces indentation and the maximum line length 100.

!!! warning "Custom Style"
## Non Default Style

Currently the configuration file doesn't support user-defined [Custom Styles](@ref).
For the time being, we only provide specs for [YAS Style](@ref), [Blue Style](@ref) and [SciML Style](@ref) in configuration file.
In order to use YAS style instead of the default style, you can just specify:
If you would use another style, such as `YASStyle` you can write this in your configuration like so:

> .JuliaFormatter.toml
```toml
style = "yas"
```

Styles choices are:

- "default" (default choice if nothing is specified)
- "yas"
- "blue"
- "sciml"
- "minimal"

```toml
...
style = "yas"
...
```

In the same way as above, you can specify `style = "blue"` to use Blue style.

## Search Rule

Expand Down
66 changes: 0 additions & 66 deletions docs/src/custom_styles.md

This file was deleted.

28 changes: 19 additions & 9 deletions docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -527,18 +527,28 @@ end
You can convert short circuit expressions to the equivalent if expression.

```julia
b0 && foo()
b1 || bar()
```
function foo(a, b)
a || return "bar"

respectively become
"hello"

```julia
if b0
foo()
b && return "ooo"
end
if !b1
bar()

BECOMES

function foo(a, b)
if !(a)
return "bar"
end

"hello"

if b
return "ooo"
else
false
end
end
```

Expand Down
Loading
Loading