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

enhance: add limitation on find refs target number #913

Merged
merged 2 commits into from
Nov 24, 2023
Merged
Changes from 1 commit
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
8 changes: 7 additions & 1 deletion kclvm/tools/src/LSP/src/find_refs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,13 @@ pub(crate) fn find_refs_from_def<F: Fn(String) -> Result<(), anyhow::Error>>(
) -> Vec<Location> {
let mut ref_locations = vec![];
for (_, word_index) in &mut *word_index_map.write() {
if let Some(locs) = word_index.get(name.as_str()).cloned() {
if let Some(mut locs) = word_index.get(name.as_str()).cloned() {
Peefy marked this conversation as resolved.
Show resolved Hide resolved
if locs.len() >= 20 {
let _ = logger(format!(
"Found more than 20 matched symbols, only the first 20 will be processed"
));
locs = locs[0..20].to_vec();
}
let matched_locs: Vec<Location> = locs
.into_iter()
.filter(|ref_loc| {
Expand Down
Loading