You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on May 28, 2025. It is now read-only.
// Limit diagnostic to the first few characters in the file. This matches how VS Code
29
29
// renders it with the full span, but on other editors, and is less invasive.
30
+
let fixes = fixes(ctx, file_id);
31
+
// FIXME: This is a hack for the vscode extension to notice whether there is an autofix or not before having to resolve diagnostics.
32
+
// This is to prevent project linking popups from appearing when there is an autofix. https://github.com/rust-lang/rust-analyzer/issues/14523
33
+
let message = if fixes.is_none(){
34
+
"file not included in crate hierarchy"
35
+
}else{
36
+
"file not included in module tree"
37
+
};
38
+
30
39
let range = ctx.sema.db.parse(file_id).syntax_node().text_range();
31
-
// FIXME: This is wrong if one of the first three characters is not ascii: `//Ы`.
32
-
let range = range.intersect(TextRange::up_to(TextSize::of("..."))).unwrap_or(range);
40
+
let range = FileLoader::file_text(ctx.sema.db, file_id)
41
+
.char_indices()
42
+
.take(3)
43
+
.last()
44
+
.map(|(i, _)| i)
45
+
.map(|i| TextRange::up_to(i.try_into().unwrap()))
46
+
.unwrap_or(range);
33
47
34
48
acc.push(
35
-
Diagnostic::new("unlinked-file","file not included in module tree", range)
0 commit comments