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

Initial stage of JuliaSyntax #848

Draft
wants to merge 13 commits into
base: master
Choose a base branch
from
Draft

Initial stage of JuliaSyntax #848

wants to merge 13 commits into from

Conversation

domluna
Copy link
Owner

@domluna domluna commented Jun 20, 2024

Initial stage for integrating JuliaSyntax. In this part I want to generate the Document using JuliaSyntax instead of the Tokenize package.

Current improvements:

  • If the format fails it will pinpoint the exact location. Right now this is hit or miss.
  • Format skips work better.
  • Remove DataStructures package

I might actually just remove CSTParser completely since that might be easier but we'll see

Comment on lines +134 to +137
s.on && write(io, repeat(" ", max(nodes[i+1].indent, 0)))
s.line_offset = nodes[i+1].indent
elseif !skip_indent(nodes[i+1])
write(io, ws)
s.on && write(io, ws)
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was a bug but I'm not sure it ever was an issue.

src/print.jl Outdated
Comment on lines 24 to 26
if l1 <= nlines && output[end] == '\n'
output = output[1:prevind(output, end)]
end
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NotCode nodes will add newlines so we need to remove these for now

Comment on lines +2 to +15
# using PrecompileTools
# @setup_workload begin
# dir = joinpath(@__DIR__,"..", "..")
# str = raw"""
# @noinline require_complete(m::Matching) =
# m.inv_match === nothing && throw(ArgumentError("Backwards matching not defined. `complete` the matching first."))
# """
# @compile_workload begin
# format(dir)
# for style = [DefaultStyle(), BlueStyle(), SciMLStyle(), YASStyle(), MinimalStyle()]
# format_text(str, style)
# end
# end
# end
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

disabled until this works

Comment on lines 153 to 154
# -1 signifies everything afterwards "#! format: off"
# will not formatted.
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this comment is no longer applicable

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.

None yet

1 participant