Ignore certain lines when styling#560
Merged
Merged
Conversation
This was referenced Oct 22, 2019
Closed
Closed
lorenzwalthert
commented
Oct 30, 2019
| @@ -0,0 +1,119 @@ | |||
| #' Add positional information of token to next terminal | |||
Collaborator
Author
There was a problem hiding this comment.
Say in documentation that this function modifies env_current.
f4a0ca6 to
36083e0
Compare
36083e0 to
210c293
Compare
210c293 to
38f8c25
Compare
This file contains hidden or 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
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.
Closes #365 as well as it's duplicates #533 and #542, following the #365 (comment). Here is a short example of how to use it, it works both for segments as well as inline:
Taken from the outline in #365, this PR implements the functionality as follows:
Here is how to make sure this code does not get styled:
Before parse data is nested, we find the stylerignore tags and add a column
stylerignore to the parse data which is false for all token except the
tokens that fall between two stylerignore tags.
After code is turned into nested parse data and spaces and newlines are
computed (must be between terminals, not between any token as currently done with
default_style_guilde_attributes()edit: Because we need the position of tokens relative to other terminals, not tokens in general when serializing, we must dodefault_style_guilde_attributes()twice in total now). We store the lag_spaces andlag_newline attributes for all terminal tokens that are marked as
stylerignore in the environment env_current.
We proceed as usual with appyling transformers and flattening out the parse
table.
Right before we serialize the parse table, we replace lag_newlines, lag_spaces
and tokens, text with the initial values for all tokens that were marked as
stylerignore. Then we serialize.