diff --git a/CHANGELOG.md b/CHANGELOG.md index 22794672..f9f4f916 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,11 +13,15 @@ and this project attempts to adhere to [Semantic Versioning](https://semver.org/ ### Removed - for now removed features ### Fixed - for any bug fixes ### Security - in case of vulnerabilities -[${version}]: https://github.com/joshuadavidthomas/django-bird/releases/tag/v${version} +[${version}]: https://github.com/joshuadavidthomas/django-language-server/releases/tag/v${version} --> ## [Unreleased] +### Changed + +- Bumped Rust toolchain from 1.88 to 1.90 + ## [5.2.0] ### Added diff --git a/crates/djls-ide/src/completions.rs b/crates/djls-ide/src/completions.rs index 80d54896..12e6fe8a 100644 --- a/crates/djls-ide/src/completions.rs +++ b/crates/djls-ide/src/completions.rs @@ -386,40 +386,40 @@ fn generate_tag_name_completions( // First, check if we should suggest end tags // If partial starts with "end", prioritize end tags - if partial.starts_with("end") && tag_specs.is_some() { - let specs = tag_specs.unwrap(); - - // Add all end tags that match the partial - for (opener_name, spec) in specs { - if let Some(end_tag) = &spec.end_tag { - if end_tag.name.starts_with(partial) { - // Create a completion for the end tag - let mut insert_text = String::new(); - if needs_space { - insert_text.push(' '); - } - insert_text.push_str(&end_tag.name); + if partial.starts_with("end") { + if let Some(specs) = tag_specs { + // Add all end tags that match the partial + for (opener_name, spec) in specs { + if let Some(end_tag) = &spec.end_tag { + if end_tag.name.starts_with(partial) { + // Create a completion for the end tag + let mut insert_text = String::new(); + if needs_space { + insert_text.push(' '); + } + insert_text.push_str(&end_tag.name); - // Add closing based on what's already present - match closing { - ClosingBrace::PartialClose | ClosingBrace::None => { - insert_text.push_str(" %}"); + // Add closing based on what's already present + match closing { + ClosingBrace::PartialClose | ClosingBrace::None => { + insert_text.push_str(" %}"); + } + ClosingBrace::FullClose => {} // No closing needed } - ClosingBrace::FullClose => {} // No closing needed - } - completions.push(lsp_types::CompletionItem { - label: end_tag.name.to_string(), - kind: Some(lsp_types::CompletionItemKind::KEYWORD), - detail: Some(format!("End tag for {opener_name}")), - text_edit: Some(tower_lsp_server::lsp_types::CompletionTextEdit::Edit( - lsp_types::TextEdit::new(replacement_range, insert_text.clone()), - )), - insert_text_format: Some(lsp_types::InsertTextFormat::PLAIN_TEXT), - filter_text: Some(end_tag.name.to_string()), - sort_text: Some(format!("0_{}", end_tag.name.as_ref())), // Priority sort - ..Default::default() - }); + completions.push(lsp_types::CompletionItem { + label: end_tag.name.to_string(), + kind: Some(lsp_types::CompletionItemKind::KEYWORD), + detail: Some(format!("End tag for {opener_name}")), + text_edit: Some(tower_lsp_server::lsp_types::CompletionTextEdit::Edit( + lsp_types::TextEdit::new(replacement_range, insert_text.clone()), + )), + insert_text_format: Some(lsp_types::InsertTextFormat::PLAIN_TEXT), + filter_text: Some(end_tag.name.to_string()), + sort_text: Some(format!("0_{}", end_tag.name.as_ref())), // Priority sort + ..Default::default() + }); + } } } } diff --git a/crates/djls-project/src/django.rs b/crates/djls-project/src/django.rs index 87a6acc4..28ff542c 100644 --- a/crates/djls-project/src/django.rs +++ b/crates/djls-project/src/django.rs @@ -29,8 +29,8 @@ pub fn django_available(db: &dyn ProjectDb, project: Project) -> bool { /// Get the Django settings module name for the current project. /// -/// Returns the settings_module_override from project, or inspector result, -/// or DJANGO_SETTINGS_MODULE env var, or attempts to detect it. +/// Returns the `settings_module_override` from project, or inspector result, +/// or `DJANGO_SETTINGS_MODULE` env var, or attempts to detect it. #[salsa::tracked] pub fn django_settings_module(db: &dyn ProjectDb, project: Project) -> Option { // Check project override first diff --git a/crates/djls-project/src/django/templatetags.rs b/crates/djls-project/src/django/templatetags.rs index 9f731bab..92c7c56f 100644 --- a/crates/djls-project/src/django/templatetags.rs +++ b/crates/djls-project/src/django/templatetags.rs @@ -12,7 +12,7 @@ use crate::Project; /// Get template tags for the current project by querying the inspector. /// /// This tracked function calls the inspector to retrieve Django template tags -/// and parses the JSON response into a TemplateTags struct. +/// and parses the JSON response into a `TemplateTags` struct. #[salsa::tracked] pub fn get_templatetags(db: &dyn ProjectDb, _project: Project) -> Option { let json_str = inspector_run(db, Query::Templatetags)?; diff --git a/crates/djls-project/src/inspector/queries.rs b/crates/djls-project/src/inspector/queries.rs index e74b385c..7d4b29a9 100644 --- a/crates/djls-project/src/inspector/queries.rs +++ b/crates/djls-project/src/inspector/queries.rs @@ -13,6 +13,7 @@ pub enum Query { #[derive(Serialize, Deserialize)] #[allow(clippy::struct_field_names)] +#[allow(dead_code)] pub struct PythonEnvironmentQueryData { pub sys_base_prefix: Utf8PathBuf, pub sys_executable: Utf8PathBuf, @@ -24,6 +25,7 @@ pub struct PythonEnvironmentQueryData { #[derive(Serialize, Deserialize)] #[serde(rename_all = "lowercase")] +#[allow(dead_code)] pub enum VersionReleaseLevel { Alpha, Beta, @@ -32,11 +34,13 @@ pub enum VersionReleaseLevel { } #[derive(Serialize, Deserialize)] +#[allow(dead_code)] pub struct TemplateTagQueryData { pub templatetags: Vec, } #[derive(Serialize, Deserialize)] +#[allow(dead_code)] pub struct TemplateTag { pub name: String, pub module: String, diff --git a/crates/djls-project/src/python.rs b/crates/djls-project/src/python.rs index e9c1f6b3..00e642d7 100644 --- a/crates/djls-project/src/python.rs +++ b/crates/djls-project/src/python.rs @@ -209,7 +209,7 @@ impl fmt::Display for PythonEnvironment { /// /// This Salsa tracked function discovers the Python environment based on: /// 1. Explicit venv path from project config -/// 2. VIRTUAL_ENV environment variable +/// 2. `VIRTUAL_ENV` environment variable /// 3. Common venv directories in project root (.venv, venv, env, .env) /// 4. System Python as fallback #[salsa::tracked] @@ -607,7 +607,7 @@ mod tests { use super::*; use crate::inspector::pool::InspectorPool; - /// Test implementation of ProjectDb for unit tests + /// Test implementation of `ProjectDb` for unit tests #[salsa::db] #[derive(Clone)] struct TestDatabase { diff --git a/crates/djls-semantic/src/blocks/snapshot.rs b/crates/djls-semantic/src/blocks/snapshot.rs index 1471f200..fd53c597 100644 --- a/crates/djls-semantic/src/blocks/snapshot.rs +++ b/crates/djls-semantic/src/blocks/snapshot.rs @@ -11,6 +11,7 @@ use super::tree::BlockTree; // TODO: centralize salsa struct snapshots so this mess can be shared #[derive(Serialize)] +#[allow(dead_code)] pub struct BlockTreeSnapshot { roots: Vec, root_ids: Vec, @@ -143,6 +144,7 @@ impl From<&BlockTree> for BlockTreeSnapshot { #[derive(Serialize)] #[serde(tag = "kind")] +#[allow(dead_code)] pub enum BlockSnapshot { Container { container_span: Span, @@ -156,6 +158,7 @@ pub enum BlockSnapshot { #[derive(Serialize)] #[serde(tag = "node")] +#[allow(dead_code)] pub enum BlockNodeSnapshot { Branch { block_id: u32, diff --git a/crates/djls-semantic/src/blocks/tree.rs b/crates/djls-semantic/src/blocks/tree.rs index b9a6754c..635defb1 100644 --- a/crates/djls-semantic/src/blocks/tree.rs +++ b/crates/djls-semantic/src/blocks/tree.rs @@ -17,6 +17,7 @@ impl BlockTree { } } + #[allow(dead_code)] pub fn roots(&self) -> &Vec { &self.roots } @@ -25,6 +26,7 @@ impl BlockTree { &mut self.roots } + #[allow(dead_code)] pub fn blocks(&self) -> &Blocks { &self.blocks } diff --git a/crates/djls-semantic/src/lib.rs b/crates/djls-semantic/src/lib.rs index e0e7b23b..7a8206c0 100644 --- a/crates/djls-semantic/src/lib.rs +++ b/crates/djls-semantic/src/lib.rs @@ -16,7 +16,7 @@ pub use templatetags::TagSpecs; /// Validate a Django template node list and return validation errors. /// -/// This function runs the TagValidator on the parsed node list to check for: +/// This function runs the `TagValidator` on the parsed node list to check for: /// - Unclosed block tags /// - Mismatched tag pairs /// - Orphaned intermediate tags diff --git a/rust-toolchain.toml b/rust-toolchain.toml index c95c9057..73328e05 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,2 +1,2 @@ [toolchain] -channel = "1.88" +channel = "1.90"