feat: add basic diagnostic support for TODO comments

This commit is contained in:
Josh Thomas 2025-01-07 11:46:55 -06:00
parent 00b8849189
commit 1d1f4f6c0f
3 changed files with 44 additions and 5 deletions

View file

@ -0,0 +1,28 @@
use tower_lsp::lsp_types::*;
use crate::documents::TextDocument;
pub struct Diagnostics;
impl Diagnostics {
pub fn generate_for_document(document: &TextDocument) -> Vec<Diagnostic> {
let mut diagnostics = Vec::new();
// TODO: Add actual diagnostic logic here
// For now, let's just add a placeholder diagnostic
if document.get_text().contains("TODO") {
diagnostics.push(Diagnostic {
range: Range {
start: Position { line: 0, character: 0 },
end: Position { line: 0, character: 5 },
},
severity: Some(DiagnosticSeverity::INFORMATION),
code: Some(NumberOrString::String("django.todo".to_string())),
source: Some("Django LSP".to_string()),
message: "Found TODO comment".to_string(),
..Default::default()
});
}
diagnostics
}
}