mirror of
https://github.com/joshuadavidthomas/django-language-server.git
synced 2025-09-13 13:56:25 +00:00
feat: add basic diagnostic support for TODO comments
This commit is contained in:
parent
00b8849189
commit
1d1f4f6c0f
3 changed files with 44 additions and 5 deletions
28
crates/djls-server/src/diagnostics.rs
Normal file
28
crates/djls-server/src/diagnostics.rs
Normal 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
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue