Skip to content

Commit

Permalink
use JuliaFormatter instead of DocumentFormat
Browse files Browse the repository at this point in the history
  • Loading branch information
pfitzseb committed Aug 2, 2019
1 parent e407af5 commit 22449d5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
3 changes: 2 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
CodeTools = "53a63b46-67e4-5edd-8c66-0af0544a99b9"
CodeTracking = "da1fd8a2-8d9e-5ec2-8556-3022fb5608a2"
DocSeeker = "33d173f1-3be9-53c5-a697-8225b67db89c"
DocumentFormat = "ffa9a821-9c82-50df-894e-fbcef3ed31cd"
HTTP = "cd3eb016-35fb-5094-929b-558a96fad6f3"
Hiccup = "9fb69e20-1954-56bb-a84f-559cc56a8ff7"
InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
JuliaFormatter = "98e50ef6-434e-11e9-1051-2b60c6c9e899"
JuliaInterpreter = "aa1ae85d-cabe-5617-a682-6adf51b2e16a"
Juno = "e5e0dc1b-0480-54bc-9374-aad01c23163d"
LNR = "7c4cb9fa-83a0-5386-9231-d6167c818060"
Expand All @@ -38,6 +38,7 @@ CodeTracking = "^0.5.7"
HTTP = "^0.8"
Hiccup = "^0.2.2"
JSON = "^0.20, ^0.21"
JuliaFormatter = "^0.1.0"
JuliaInterpreter = "^0.6.0"
Juno = "^0.7.0"
Lazy = "^0.13"
Expand Down
10 changes: 4 additions & 6 deletions src/formatter.jl
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
using DocumentFormat: format
using JuliaFormatter: format_text

handle("format") do data
@destruct [text, indent || nothing] = data
@destruct [text, indent || 4, margin || 92] = data

# @TODO: `indent` is here since we can pass it to `format` function once
# DocumentFormat.jl comes to be able to handle options to specify indents,
formattedtext = format(text)
d(:formattedtext => formattedtext)
formattedtext = format_text(text, indent = indent, margin = margin)
Dict(:formattedtext => formattedtext)
end

0 comments on commit 22449d5

Please sign in to comment.