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

Chore/revert remove change to include comment prefix in list results #327

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions src/lib/buffer/buffer.v
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,6 @@ pub struct Match {
pub:
file_path string
pos Pos
pub mut:
contents string
}

Expand All @@ -443,6 +442,7 @@ mut:
const forward_slash = "/".runes()[0]
const star = "*".runes()[0]

// TODO(tauraamui) [07/03/2025]: need to implement some attribute or tag to exclude comments from the matcher
pub fn (mut iter PatternMatchIteratorFromLinesList) next() ?Match {
if iter.idx >= iter.data_ref.len {
iter.done = true
Expand Down Expand Up @@ -472,15 +472,13 @@ pub fn (mut iter PatternMatchIteratorFromLinesList) next() ?Match {
forward_slash {
if i - 1 >= 0 {
if line_to_search[i - 1] == forward_slash {
found_match.contents = line_to_search[i - 1..].string()
return found_match
}
}
}
star {
if i - 1 >= 0 {
if line_to_search[i - 1] == forward_slash {
found_match.contents = line_to_search[i - 1..].string()
return found_match
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/lib/buffer/buffer_test.v
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ fn test_buffer_load_from_path_and_iterate_over_pattern_matches() {
found_match_count += 1
assert found_match == Match{
pos: Pos{ x: 3, y: 1 }
contents: "// TODO(tauraamui) [30/01/25]: this line has a comment to find"
contents: "TODO(tauraamui) [30/01/25]: this line has a comment to find"
}
}

Expand Down Expand Up @@ -109,7 +109,7 @@ fn test_buffer_load_from_path_and_iterate_over_pattern_matches_excluding_matches
assert found_matches.len == 1
assert found_matches[0] == Match{
pos: Pos{ x: 3, y: 1 }
contents: "// TODO(tauraamui) [30/01/25]: this line has a comment to find"
contents: "TODO(tauraamui) [30/01/25]: this line has a comment to find"
}
assert iteration_count == 6
}
Expand Down
4 changes: 2 additions & 2 deletions src/lilly_test.v
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

module main
import lib.clipboardv2
import lib.workspace

Check warning on line 17 in src/lilly_test.v

View workflow job for this annotation

GitHub Actions / unit_tests

module 'workspace (src.lib.workspace)' is imported but never used
import lib.buffer

@[heap]
Expand All @@ -31,7 +31,7 @@

fn test_lilly_open_file_loads_into_file_buffer_and_buffer_view_maps() {
mut clip := clipboardv2.new()
mut lilly := Lilly{

Check notice on line 34 in src/lilly_test.v

View workflow job for this annotation

GitHub Actions / unit_tests

interface field `Lilly.view` must be initialized
clipboard: mut clip
}

Expand All @@ -55,7 +55,7 @@

fn test_lilly_open_file_loads_into_file_buffer_and_buffer_view_maps_if_done_twice_does_not_create_extra_instances() {
mut clip := clipboardv2.new()
mut lilly := Lilly{

Check notice on line 58 in src/lilly_test.v

View workflow job for this annotation

GitHub Actions / unit_tests

interface field `Lilly.view` must be initialized
clipboard: mut clip
}

Expand Down Expand Up @@ -106,7 +106,7 @@
] }
}

mut lilly := Lilly{

Check notice on line 109 in src/lilly_test.v

View workflow job for this annotation

GitHub Actions / unit_tests

interface field `Lilly.view` must be initialized
line_reader: mock_fs.read_lines
is_binary_file: fn (p string) bool { return false }
resolve_workspace_files: fn () []string {
Expand Down Expand Up @@ -135,11 +135,11 @@

assert lilly.resolve_todo_comments_matches() == [
buffer.Match{
contents: "// TODO(tauraamui) [26/02/2025]: become a real boy, I mean file!"
contents: "TODO(tauraamui) [26/02/2025]: become a real boy, I mean file!"
file_path: "loaded-test-file.txt", pos: buffer.Pos{ x: 3, y: 0 }
},
buffer.Match{
contents: "// TODO(tauraamui) [26/02/2025]: finish writing lin.."
contents: "TODO(tauraamui) [26/02/2025]: finish writing lin.."
file_path: "unopened-file-as-yet.txt", pos: buffer.Pos{ x: 35, y: 1 }
}
]
Expand Down Expand Up @@ -199,7 +199,7 @@
}

fn test_lilly_resolve_inactive_file_buffer_paths() {
mut lilly := Lilly{}

Check notice on line 202 in src/lilly_test.v

View workflow job for this annotation

GitHub Actions / unit_tests

interface field `Lilly.view` must be initialized

mut m_line_reader := MockLineReader{
line_data: ["This is a fake document that doesn't exist on disk anywhere"]
Expand Down
Loading