Skip to content

Commit 78ee40e

Browse files
committed
chore: bump dependencies and release 0.12.8 with if chaining
1 parent 68e02da commit 78ee40e

File tree

7 files changed

+124
-117
lines changed

7 files changed

+124
-117
lines changed

Cargo.lock

Lines changed: 28 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "protols"
33
description = "Language server for proto3 files"
4-
version = "0.12.7"
4+
version = "0.12.8"
55
edition = "2024"
66
license = "MIT"
77
homepage = "https://github.com/coder3101/protols"
@@ -12,23 +12,23 @@ keywords = ["lsp", "proto"]
1212
exclude = ["assets/*", "sample/*"]
1313

1414
[dependencies]
15-
async-lsp = { version = "0.2.2", features = ["tokio"] }
16-
futures = "0.3.31"
17-
tokio = { version = "1.38.0", features = ["time", "full"] }
18-
tokio-util = { version = "0.7.11", features = ["compat"] }
19-
tower = "0.5.2"
20-
tracing = "0.1.40"
21-
tracing-subscriber = "0.3.18"
22-
tree-sitter = "0.25.2"
23-
tracing-appender = "0.2.3"
24-
tree-sitter-proto = "0.2.0"
25-
walkdir = "2.5.0"
26-
hard-xml = "1.36.0"
27-
tempfile = "3.12.0"
28-
serde = { version = "1.0.209", features = ["derive"] }
29-
basic-toml = "0.1.9"
30-
pkg-config = "0.3.31"
31-
clap = { version = "4.5.5", features = ["derive"] }
15+
async-lsp = { version = "0.2", features = ["tokio"] }
16+
futures = "0.3"
17+
tokio = { version = "1.47", features = ["time", "full"] }
18+
tokio-util = { version = "0.7", features = ["compat"] }
19+
tower = "0.5"
20+
tracing = "0.1"
21+
tracing-subscriber = "0.3"
22+
tree-sitter = "0.25"
23+
tracing-appender = "0.2"
24+
tree-sitter-proto = "0.3"
25+
walkdir = "2.5"
26+
hard-xml = "1.41"
27+
tempfile = "3.21"
28+
serde = { version = "1", features = ["derive"] }
29+
basic-toml = "0.1"
30+
pkg-config = "0.3"
31+
clap = { version = "4.5", features = ["derive"] }
3232

3333
[dev-dependencies]
34-
insta = { version = "1.39.0", features = ["yaml"] }
34+
insta = { version = "1.43", features = ["yaml"] }

src/config/workspace.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,10 @@ impl WorkspaceProtoConfigs {
120120
let wr = ProtolsConfig::default();
121121
let rp = if cfg!(target_os = "windows") {
122122
let mut d = String::from("C");
123-
if let Ok(cdir) = env::current_dir() {
124-
if let Some(drive) = cdir.components().next() {
125-
d = drive.as_os_str().to_string_lossy().to_string()
126-
}
123+
if let Ok(cdir) = env::current_dir()
124+
&& let Some(drive) = cdir.components().next()
125+
{
126+
d = drive.as_os_str().to_string_lossy().to_string()
127127
}
128128
format!("{d}://")
129129
} else {

src/lsp.rs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -415,10 +415,9 @@ impl ProtoLanguageServer {
415415
if let Some(diagnostics) =
416416
self.state
417417
.upsert_file(&uri, content, &ipath, 8, &pconf.config, true)
418+
&& let Err(e) = self.client.publish_diagnostics(diagnostics)
418419
{
419-
if let Err(e) = self.client.publish_diagnostics(diagnostics) {
420-
error!(error=%e, "failed to publish diagnostics")
421-
}
420+
error!(error=%e, "failed to publish diagnostics")
422421
}
423422
ControlFlow::Continue(())
424423
}
@@ -441,10 +440,9 @@ impl ProtoLanguageServer {
441440
if let Some(diagnostics) =
442441
self.state
443442
.upsert_file(&uri, content, &ipath, 8, &pconf.config, true)
443+
&& let Err(e) = self.client.publish_diagnostics(diagnostics)
444444
{
445-
if let Err(e) = self.client.publish_diagnostics(diagnostics) {
446-
error!(error=%e, "failed to publish diagnostics")
447-
}
445+
error!(error=%e, "failed to publish diagnostics")
448446
}
449447
ControlFlow::Continue(())
450448
}
@@ -467,10 +465,9 @@ impl ProtoLanguageServer {
467465
if let Some(diagnostics) =
468466
self.state
469467
.upsert_file(&uri, content, &ipath, 8, &pconf.config, false)
468+
&& let Err(e) = self.client.publish_diagnostics(diagnostics)
470469
{
471-
if let Err(e) = self.client.publish_diagnostics(diagnostics) {
472-
error!(error=%e, "failed to publish diagnostics")
473-
}
470+
error!(error=%e, "failed to publish diagnostics")
474471
}
475472
ControlFlow::Continue(())
476473
}

src/parser/tree.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ impl ParsedTree {
151151
self.tree.root_node().descendant_for_point_range(pos, pos)
152152
}
153153

154-
pub fn find_all_nodes(&self, f: fn(&Node) -> bool) -> Vec<Node> {
154+
pub fn find_all_nodes(&self, f: fn(&Node) -> bool) -> Vec<Node<'_>> {
155155
self.find_all_nodes_from(self.tree.root_node(), f)
156156
}
157157

@@ -160,7 +160,7 @@ impl ParsedTree {
160160
Self::walk_and_filter(&mut cursor, f, false)
161161
}
162162

163-
pub fn find_first_node(&self, f: fn(&Node) -> bool) -> Vec<Node> {
163+
pub fn find_first_node(&self, f: fn(&Node) -> bool) -> Vec<Node<'_>> {
164164
self.find_node_from(self.tree.root_node(), f)
165165
}
166166

@@ -175,7 +175,7 @@ impl ParsedTree {
175175
.map(|n| n.utf8_text(content).expect("utf-8 parse error"))
176176
}
177177

178-
pub fn get_import_node(&self) -> Vec<Node> {
178+
pub fn get_import_node(&self) -> Vec<Node<'_>> {
179179
self.find_all_nodes(NodeKind::is_import_path)
180180
.into_iter()
181181
.filter_map(|n| n.child_by_field_name("path"))

src/protoc.rs

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -54,28 +54,27 @@ impl ProtocDiagnostics {
5454
// Parse protoc error format: file:line:column: message
5555
if let Some((file_info, message)) = line.split_once(": ") {
5656
let parts: Vec<&str> = file_info.split(':').collect();
57-
if parts.len() >= 3 {
58-
if let (Ok(line), Ok(col)) = (parts[1].parse::<u32>(), parts[2].parse::<u32>())
59-
{
60-
let point = Point {
61-
row: (line - 1) as usize,
62-
column: (col - 1) as usize,
63-
};
64-
let diagnostic = Diagnostic {
65-
range: Range {
66-
start: ts_to_lsp_position(&point),
67-
end: ts_to_lsp_position(&Point {
68-
row: point.row,
69-
column: point.column + 1,
70-
}),
71-
},
72-
severity: Some(DiagnosticSeverity::ERROR),
73-
source: Some("protoc".to_string()),
74-
message: message.to_string(),
75-
..Default::default()
76-
};
77-
diagnostics.push(diagnostic);
78-
}
57+
if parts.len() >= 3
58+
&& let (Ok(line), Ok(col)) = (parts[1].parse::<u32>(), parts[2].parse::<u32>())
59+
{
60+
let point = Point {
61+
row: (line - 1) as usize,
62+
column: (col - 1) as usize,
63+
};
64+
let diagnostic = Diagnostic {
65+
range: Range {
66+
start: ts_to_lsp_position(&point),
67+
end: ts_to_lsp_position(&Point {
68+
row: point.row,
69+
column: point.column + 1,
70+
}),
71+
},
72+
severity: Some(DiagnosticSeverity::ERROR),
73+
source: Some("protoc".to_string()),
74+
message: message.to_string(),
75+
..Default::default()
76+
};
77+
diagnostics.push(diagnostic);
7978
}
8079
}
8180
}

0 commit comments

Comments
 (0)