Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use a tracing subscriber for LSP logging #93

Merged
merged 15 commits into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .github/workflows/test-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,8 @@ jobs:
run: cargo build

- name: Run unit tests
run: cargo test
env:
AIR_LOG_LEVEL: trace
# `--nocapture` to see our own `tracing` logs
# `--test-threads 1` to ensure `tracing` logs aren't interleaved
run: cargo test -- --nocapture --test-threads 1
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use the just alias? I don't mind either way, I guess this is more explicit.

6 changes: 5 additions & 1 deletion .github/workflows/test-mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,8 @@ jobs:
run: cargo build

- name: Run unit tests
run: cargo test
env:
AIR_LOG_LEVEL: trace
# `--nocapture` to see our own `tracing` logs
# `--test-threads 1` to ensure `tracing` logs aren't interleaved
run: cargo test -- --nocapture --test-threads 1
6 changes: 5 additions & 1 deletion .github/workflows/test-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,8 @@ jobs:
run: cargo build

- name: Run unit tests
run: cargo test
env:
AIR_LOG_LEVEL: trace
# `--nocapture` to see our own `tracing` logs
# `--test-threads 1` to ensure `tracing` logs aren't interleaved
run: cargo test -- --nocapture --test-threads 1
185 changes: 184 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,19 +55,21 @@ ignore = "0.4.23"
insta = "1.40.0"
itertools = "0.13.0"
line-index = "0.1.2"
log = "0.4.22"
memchr = "2.7.4"
path-absolutize = "3.1.1"
proc-macro2 = "1.0.86"
serde = { version = "1.0.215", features = ["derive"] }
serde_json = "1.0.132"
struct-field-names-as-array = "0.3.0"
strum = "0.26"
time = "0.3.37"
thiserror = "2.0.5"
tokio = { version = "1.41.1" }
tokio-util = "0.7.12"
# For https://github.com/ebkalderon/tower-lsp/pull/428
tower-lsp = { git = "https://github.com/lionel-/tower-lsp", branch = "bugfix/patches" }
tracing = { version = "0.1.40", default-features = false, features = ["std"] }
tracing-subscriber = "0.3.19"
tree-sitter = "0.23.0"
tree-sitter-r = { git = "https://github.com/r-lib/tree-sitter-r", rev = "a0d3e3307489c3ca54da8c7b5b4e0c5f5fd6953a" }
triomphe = "0.1.14"
Expand Down
4 changes: 3 additions & 1 deletion crates/lsp/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,16 @@ dissimilar.workspace = true
futures.workspace = true
itertools.workspace = true
line_ending.workspace = true
log.workspace = true
memchr.workspace = true
serde.workspace = true
serde_json.workspace = true
struct-field-names-as-array.workspace = true
strum = { workspace = true, features = ["derive"] }
time = { workspace = true }
tokio = { workspace = true, features = ["full"] }
tower-lsp.workspace = true
tracing.workspace = true
tracing-subscriber = { workspace = true, features = ["ansi", "local-time"] }
tree-sitter.workspace = true
tree-sitter-r.workspace = true
triomphe.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion crates/lsp/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ impl From<VscDocumentConfig> for DocumentConfig {
if var == "tabSize" {
x.tab_size
} else {
log::warn!("Unknown indent alias {var}, using default");
tracing::warn!("Unknown indent alias {var}, using default");
2
}
}
Expand Down
4 changes: 2 additions & 2 deletions crates/lsp/src/encoding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ fn convert_character_from_utf16_to_utf8(x: &str, character: usize) -> usize {
}
}

log::error!("Failed to locate UTF-16 offset of {character}. Line: '{x}'.");
tracing::error!("Failed to locate UTF-16 offset of {character}. Line: '{x}'.");
0
}

Expand All @@ -52,7 +52,7 @@ fn convert_character_from_utf8_to_utf16(x: &str, character: usize) -> usize {
Some(x) => x.encode_utf16().count(),
None => {
let n = x.len();
log::error!(
tracing::error!(
"Tried to take UTF-8 character {character}, but only {n} characters exist. Line: '{x}'."
);
0
Expand Down
Loading
Loading