Skip to content

Commit 3b2f735

Browse files
committed
fix: log more
1 parent 5d0c8e6 commit 3b2f735

File tree

4 files changed

+28
-17
lines changed

4 files changed

+28
-17
lines changed

Diff for: crates/pgt_lsp/src/handlers/code_actions.rs

+2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ use pgt_workspace::features::code_actions::{
99
CodeActionKind, CodeActionsParams, CommandActionCategory, ExecuteStatementParams,
1010
};
1111

12+
#[tracing::instrument(level = "debug", skip(session), err)]
1213
pub fn get_actions(
1314
session: &Session,
1415
params: lsp_types::CodeActionParams,
@@ -71,6 +72,7 @@ pub fn command_id(command: &CommandActionCategory) -> String {
7172
}
7273
}
7374

75+
#[tracing::instrument(level = "debug", skip(session), err)]
7476
pub async fn execute_command(
7577
session: &Session,
7678
params: ExecuteCommandParams,

Diff for: crates/pgt_lsp/src/handlers/completions.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,7 @@ use anyhow::Result;
33
use pgt_workspace::{WorkspaceError, features::completions::GetCompletionsParams};
44
use tower_lsp::lsp_types::{self, CompletionItem, CompletionItemLabelDetails};
55

6-
#[tracing::instrument(level = "debug", skip_all, fields(
7-
url = params.text_document_position.text_document.uri.as_str(),
8-
character = params.text_document_position.position.character,
9-
line = params.text_document_position.position.line
10-
), err)]
6+
#[tracing::instrument(level = "debug", skip(session), err)]
117
pub fn get_completions(
128
session: &Session,
139
params: lsp_types::CompletionParams,

Diff for: crates/pgt_lsp/src/handlers/text_document.rs

+3-12
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,7 @@ use tower_lsp::lsp_types;
1010
use tracing::error;
1111

1212
/// Handler for `textDocument/didOpen` LSP notification
13-
#[tracing::instrument(level = "info", skip_all, fields(
14-
url = params.text_document.uri.as_str(),
15-
version = params.text_document.version
16-
), err)]
13+
#[tracing::instrument(level = "debug", skip(session), err)]
1714
pub(crate) async fn did_open(
1815
session: &Session,
1916
params: lsp_types::DidOpenTextDocumentParams,
@@ -41,11 +38,7 @@ pub(crate) async fn did_open(
4138
}
4239

4340
// Handler for `textDocument/didChange` LSP notification
44-
#[tracing::instrument(level = "debug", skip_all, fields(
45-
uri = params.text_document.uri.as_str(),
46-
version = params.text_document.version,
47-
num_content_changes = params.content_changes.len()
48-
), err)]
41+
#[tracing::instrument(level = "debug", skip(session), err)]
4942
pub(crate) async fn did_change(
5043
session: &Session,
5144
params: lsp_types::DidChangeTextDocumentParams,
@@ -97,9 +90,7 @@ pub(crate) async fn did_change(
9790
}
9891

9992
/// Handler for `textDocument/didClose` LSP notification
100-
#[tracing::instrument(level = "info", skip_all, fields(
101-
url = params.text_document.uri.as_str(),
102-
), err)]
93+
#[tracing::instrument(level = "debug", skip(session), err)]
10394
pub(crate) async fn did_close(
10495
session: &Session,
10596
params: lsp_types::DidCloseTextDocumentParams,

Diff for: crates/pgt_workspace/src/workspace/server/change.rs

+22
Original file line numberDiff line numberDiff line change
@@ -807,6 +807,28 @@ mod tests {
807807
assert_document_integrity(&d);
808808
}
809809

810+
#[test]
811+
fn issue_303() {
812+
let path = PgTPath::new("test.sql");
813+
let input = "create table \"test\"";
814+
815+
let mut d = Document::new(PgTPath::new("test.sql"), input.to_string(), 0);
816+
817+
assert_eq!(d.positions.len(), 1);
818+
819+
let change = ChangeFileParams {
820+
path: path.clone(),
821+
version: 1,
822+
changes: vec![ChangeParams {
823+
text: "".to_string(),
824+
range: Some(TextRange::new(18.into(), 19.into())),
825+
}],
826+
};
827+
828+
assert_eq!(d.content, "create table \"test");
829+
assert_document_integrity(&d);
830+
}
831+
810832
#[test]
811833
fn across_statements() {
812834
let path = PgTPath::new("test.sql");

0 commit comments

Comments
 (0)