-
Notifications
You must be signed in to change notification settings - Fork 182
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
Optimize the --numeric
feature for line/region re-indentation in editors
#1609
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gpetiot
force-pushed
the
split-format-indent
branch
from
March 8, 2021 12:44
e021474
to
9c65da5
Compare
This was referenced Mar 8, 2021
gpetiot
force-pushed
the
split-format-indent
branch
4 times, most recently
from
March 23, 2021 09:28
a6aa4cc
to
6bb1d15
Compare
gpetiot
force-pushed
the
split-format-indent
branch
4 times, most recently
from
March 30, 2021 13:20
9f491fc
to
56a34fb
Compare
gpetiot
force-pushed
the
split-format-indent
branch
4 times, most recently
from
April 2, 2021 13:22
16a5fd4
to
7283330
Compare
This one is finally ready for review @emillon @Julow, and ready to be tested @charlesetc @olydis |
gpetiot
force-pushed
the
split-format-indent
branch
2 times, most recently
from
April 9, 2021 12:36
03b1b6f
to
84c8c46
Compare
gpetiot
force-pushed
the
split-format-indent
branch
from
April 22, 2021 10:35
84c8c46
to
c422db9
Compare
gpetiot
changed the title
Line/region indentation feature for emacs
Slicing optimization for line/region indentation feature for emacs
Apr 22, 2021
gpetiot
force-pushed
the
split-format-indent
branch
from
June 1, 2021 09:49
c422db9
to
da890fe
Compare
gpetiot
force-pushed
the
split-format-indent
branch
from
June 24, 2021 12:49
da890fe
to
20b36a9
Compare
gpetiot
force-pushed
the
split-format-indent
branch
2 times, most recently
from
August 4, 2021 17:34
817670e
to
04a75bc
Compare
gpetiot
force-pushed
the
split-format-indent
branch
from
September 1, 2021 09:32
04a75bc
to
9f0d8e0
Compare
gpetiot
force-pushed
the
split-format-indent
branch
from
October 28, 2021 13:09
9f0d8e0
to
3449dba
Compare
gpetiot
force-pushed
the
split-format-indent
branch
2 times, most recently
from
January 18, 2022 13:14
cf065a3
to
cec76b6
Compare
gpetiot
force-pushed
the
split-format-indent
branch
from
January 28, 2022 11:06
cec76b6
to
267622e
Compare
gpetiot
force-pushed
the
split-format-indent
branch
from
January 28, 2022 11:09
267622e
to
6cb94d1
Compare
gpetiot
changed the title
Slicing optimization for line/region indentation feature for emacs
Optimize the Jan 28, 2022
--numeric
feature for line/region re-indentation in editors
This is too ad-hoc. Should use a legit parser instead. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Wait for #1639 to be merged so the slicing optimization can be reviewed independently!This is a reboot of #1207, as the time overhead made the feature clunky, and inspired by #1484 to reduce the time overhead.
We don't need to parse invalid files outside of this feature, so the
--format-invalid-files
option has been removed. Instead, this PR defines a new--numeric=X-Y
option that should have the same semantic as--numeric --lines=X-Y
inocp-indent
.The idea is:
if the program is too big (exceeds a number of lines) (as parsing the whole file would be too time consuming):
menhir
recovery parsing), or the original source (if both previously failed)ocamlformat
[1]ocp-indent
API to produce an indentationif the program is not too big:
menhir
recovery parsing)ocamlformat
[1]ocp-indent
API to produce an indentationNotes:
[1] this does not return optimal results when multiple lines are made into one when formatted, for example "let x =\n a\nin\n ...." will be formatted as a single line "let x = a in\n ..." so this implementation cannot detect this and will return the same indentation for the 3 lines, which will not look good),
ocp-indent
is called on this range of lines to improve the indentation.cc @charlesetc @olydis @emillon