Skip to content

Commit 51756b0

Browse files
committed
Fix a hangup bug
1 parent 7d56390 commit 51756b0

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
### 🐛 Fixed
2222
- **Enum Variable Parameter Issue**: Fixed a crash issue when checking enum variable as parameter
23+
- **Circle Doc Class Issue**: Fixed a bug that caused the language server to hang when
2324

2425
## [0.8.1] - 2025-6-14
2526

crates/emmylua_code_analysis/src/diagnostic/checker/circle_doc_class.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
use std::collections::HashSet;
2+
13
use emmylua_parser::{LuaAstNode, LuaAstToken, LuaDocTagClass};
24
use rowan::TextRange;
35

@@ -37,9 +39,14 @@ fn check_doc_tag_class(
3739
let name = class_decl.get_full_name();
3840

3941
let mut queue = Vec::new();
42+
let mut visited = HashSet::new();
4043

4144
queue.push(class_decl.get_id());
4245
while let Some(current_id) = queue.pop() {
46+
if !visited.insert(current_id.clone()) {
47+
continue;
48+
}
49+
4350
let super_types = type_index.get_super_types(&current_id);
4451
if let Some(super_types) = super_types {
4552
for super_type in super_types {
@@ -54,7 +61,10 @@ fn check_doc_tag_class(
5461
);
5562
return Some(());
5663
}
57-
queue.push(super_type_id.clone());
64+
65+
if !visited.contains(super_type_id) {
66+
queue.push(super_type_id.clone());
67+
}
5868
}
5969
_ => {}
6070
}

0 commit comments

Comments
 (0)