Reduce the size of the match string in TextMatches data table#4874
Reduce the size of the match string in TextMatches data table#4874
TextMatches data table#4874Conversation
When a pattern is matched against a very long line, the result in the data table is now truncated to include at most 50 characters before and 50 characters after the match of that line.
|
|
||
| TreeVisitor<?, ExecutionContext> visitor = new TreeVisitor<Tree, ExecutionContext>() { | ||
|
|
||
| static final int CONTEXT_SIZE = 50; |
There was a problem hiding this comment.
Perhaps this should be configurable? Sometimes you might want long matches
There was a problem hiding this comment.
I the context size is now optional configurable. The default is 0 leading to just the matched text in the Datatable.
With -1 the truncate can be deactivated and the full text is in the Datatable, as on main currently for whoever uses this.
|
Is it necessary to have the Search marker inside the Match text in the Datatable? if we add StartMatch and EndMatch we could have the same data without the strange looking EDIT: this would break existing logic and looks like not a good idea at this point. |
# Conflicts: # rewrite-core/src/test/java/org/openrewrite/text/FindTest.java
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
|
Copying the failure here: new test expectation not updated it seems. |
|
Please keep an eye out for downstream changes needed after these types of changes as well: |

When a pattern is matched against a very long line, the result in the data table is now truncated to include at most 50 characters before and 50 characters after the match of that line.