fix: resolve clippy warnings in lsp module
- Replace map_or(false, ...) with is_none_or(... !=) - Replace explicit auto-derefs (&*Static) with auto-deref (&Static) - Refactor range-indexed loop to iterator with enumerate + skip/take - Suppress deprecated root_path field with allow(deprecated) docs: update README and REQUIREMENTS for streamd lsp - Add streamd lsp to commands table in README - Add Editor Integration section with Zed, Neovim, VS Code snippets - Add R25 LSP requirements (R25a–R25e) to REQUIREMENTS.md
This commit is contained in:
parent
50c592a641
commit
b224620212
3 changed files with 129 additions and 6 deletions
|
|
@ -418,7 +418,7 @@ impl Backend {
|
|||
.unwrap_or(chrono_tz::UTC);
|
||||
|
||||
let config =
|
||||
merge_repository_configuration(&*BasicTimesheetConfiguration, &*TaskConfiguration);
|
||||
merge_repository_configuration(&BasicTimesheetConfiguration, &TaskConfiguration);
|
||||
|
||||
Some(Arc::new(LspState {
|
||||
config,
|
||||
|
|
@ -437,6 +437,7 @@ impl Backend {
|
|||
#[tower_lsp::async_trait]
|
||||
impl LanguageServer for Backend {
|
||||
async fn initialize(&self, params: InitializeParams) -> Result<InitializeResult> {
|
||||
#[allow(deprecated)]
|
||||
let root: Option<PathBuf> = params
|
||||
.root_uri
|
||||
.as_ref()
|
||||
|
|
@ -691,8 +692,13 @@ impl LanguageServer for Backend {
|
|||
let start_line = params.range.start.line as usize;
|
||||
let end_line = params.range.end.line as usize;
|
||||
|
||||
for line_idx in start_line..=end_line.min(lines.len().saturating_sub(1)) {
|
||||
let line = &lines[line_idx];
|
||||
let range_end = end_line.min(lines.len().saturating_sub(1));
|
||||
for (line_idx, line) in lines
|
||||
.iter()
|
||||
.enumerate()
|
||||
.skip(start_line)
|
||||
.take(range_end.saturating_sub(start_line) + 1)
|
||||
{
|
||||
if line.contains("@Task") && !line.contains("@Done") {
|
||||
let new_line = line.replacen("@Task", "@Task @Done", 1);
|
||||
let mut changes: std::collections::HashMap<Url, Vec<TextEdit>> =
|
||||
|
|
@ -745,7 +751,7 @@ impl LanguageServer for Backend {
|
|||
.filter_map(|e| e.ok())
|
||||
{
|
||||
let path = entry.path();
|
||||
if !path.extension().map_or(false, |e| e == "md") {
|
||||
if path.extension().is_none_or(|e| e != "md") {
|
||||
continue;
|
||||
}
|
||||
let uri = match Url::from_file_path(path) {
|
||||
|
|
@ -809,7 +815,7 @@ impl LanguageServer for Backend {
|
|||
.filter_map(|e| e.ok())
|
||||
{
|
||||
let path = entry.path();
|
||||
if !path.extension().map_or(false, |e| e == "md") {
|
||||
if path.extension().is_none_or(|e| e != "md") {
|
||||
continue;
|
||||
}
|
||||
let file_uri = match Url::from_file_path(path) {
|
||||
|
|
@ -893,7 +899,7 @@ impl LanguageServer for Backend {
|
|||
.filter_map(|e| e.ok())
|
||||
{
|
||||
let path = entry.path();
|
||||
if !path.extension().map_or(false, |e| e == "md") {
|
||||
if path.extension().is_none_or(|e| e != "md") {
|
||||
continue;
|
||||
}
|
||||
let file_uri = match Url::from_file_path(path) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue