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

Add possibility to set up highlighten prefix and postfix for snippet #1422

Merged
merged 25 commits into from
May 23, 2023

Conversation

lavrd
Copy link
Contributor

@lavrd lavrd commented Jul 22, 2022

This PR adds a possibility to change highlight prefix and postfix for snippets.

@fulmicoton fulmicoton requested a review from PSeitz July 27, 2022 01:32
src/snippet/mod.rs Outdated Show resolved Hide resolved
src/snippet/mod.rs Outdated Show resolved Hide resolved
Copy link
Collaborator

@fulmicoton fulmicoton left a comment

Choose a reason for hiding this comment

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

See comments

@fulmicoton fulmicoton force-pushed the main branch 2 times, most recently from e550a98 to 84e0c75 Compare September 2, 2022 03:01
@lavrd lavrd requested review from fulmicoton and removed request for PSeitz September 4, 2022 08:11
@lavrd
Copy link
Contributor Author

lavrd commented Sep 4, 2022

Thank you for review! Did these fixes and reduced test.

@lavrd
Copy link
Contributor Author

lavrd commented Jan 9, 2023

@fulmicoton hi, what the status with this feature?

@lavrd
Copy link
Contributor Author

lavrd commented May 5, 2023

@PSeitz hey, can you help with review, please?

@codecov-commenter
Copy link

codecov-commenter commented May 6, 2023

Codecov Report

Merging #1422 (80d764e) into main (0eafbaa) will increase coverage by 0.01%.
The diff coverage is 100.00%.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

@@            Coverage Diff             @@
##             main    #1422      +/-   ##
==========================================
+ Coverage   94.47%   94.48%   +0.01%     
==========================================
  Files         319      319              
  Lines       59404    59460      +56     
==========================================
+ Hits        56119    56178      +59     
+ Misses       3285     3282       -3     
Impacted Files Coverage Δ
src/snippet/mod.rs 95.16% <100.00%> (+1.59%) ⬆️

... and 6 files with indirect coverage changes

@@ -101,6 +115,12 @@ impl Snippet {
pub fn highlighted(&self) -> &[Range<usize>] {
&self.highlighted
}

/// Sets highlighted prefix and postfix.
pub fn set_highlighted_elements(&mut self, prefix: &str, postfix: &str) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
pub fn set_highlighted_elements(&mut self, prefix: &str, postfix: &str) {
pub fn set_snippet_prefix_postfix(&mut self, prefix: &str, postfix: &str) {

@@ -55,17 +58,28 @@ impl FragmentCandidate {
pub struct Snippet {
fragment: String,
highlighted: Vec<Range<usize>>,
highlighting_prefix: String,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
highlighting_prefix: String,
snippet_prefix: String,

@@ -55,17 +58,28 @@ impl FragmentCandidate {
pub struct Snippet {
fragment: String,
highlighted: Vec<Range<usize>>,
highlighting_prefix: String,
highlighting_postfix: String,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
highlighting_postfix: String,
snippet_postfix: String,

@lavrd lavrd requested a review from PSeitz May 21, 2023 08:00
@PSeitz PSeitz merged commit 8cf26da into quickwit-oss:main May 23, 2023
@PSeitz
Copy link
Contributor

PSeitz commented May 23, 2023

@lavrd Thanks!

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.

4 participants