refactor: Reorder imports and format function signatures in documents.rs

This commit is contained in:
Josh Thomas 2025-01-07 12:01:48 -06:00 committed by Josh (aider)
parent 8395a02832
commit 4415d6abfe

View file

@ -1,13 +1,13 @@
use crate::diagnostics::Diagnostics;
use anyhow::{anyhow, Result}; use anyhow::{anyhow, Result};
use djls_project::TemplateTags; use djls_project::TemplateTags;
use std::collections::HashMap; use std::collections::HashMap;
use tower_lsp::lsp_types::{ use tower_lsp::lsp_types::{
DidOpenTextDocumentParams, DidChangeTextDocumentParams, DidCloseTextDocumentParams, CompletionItem, CompletionItemKind, CompletionResponse, DidChangeTextDocumentParams,
CompletionItem, CompletionItemKind, CompletionResponse, Documentation, InsertTextFormat, DidCloseTextDocumentParams, DidOpenTextDocumentParams, Documentation, InsertTextFormat,
MarkupContent, MarkupKind, Position, Range, Url, MarkupContent, MarkupKind, Position, Range, Url,
}; };
use tower_lsp::Client; use tower_lsp::Client;
use crate::diagnostics::Diagnostics;
#[derive(Debug)] #[derive(Debug)]
pub struct Store { pub struct Store {
@ -23,7 +23,11 @@ impl Store {
} }
} }
pub fn handle_did_open(&mut self, params: DidOpenTextDocumentParams, client: &Client) -> Result<()> { pub fn handle_did_open(
&mut self,
params: DidOpenTextDocumentParams,
client: &Client,
) -> Result<()> {
let uri = params.text_document.uri.clone(); // Clone the URI here let uri = params.text_document.uri.clone(); // Clone the URI here
let document = TextDocument::new( let document = TextDocument::new(
uri.to_string(), // Use the cloned URI uri.to_string(), // Use the cloned URI
@ -48,7 +52,11 @@ impl Store {
} }
} }
pub fn handle_did_change(&mut self, params: DidChangeTextDocumentParams, client: &Client) -> Result<()> { pub fn handle_did_change(
&mut self,
params: DidChangeTextDocumentParams,
client: &Client,
) -> Result<()> {
let uri = params.text_document.uri.as_str().to_string(); let uri = params.text_document.uri.as_str().to_string();
let version = params.text_document.version; let version = params.text_document.version;