Skip to content

Commit 1fc761e

Browse files
authored
server: cleanup some variable names (#1030)
1 parent 5604d92 commit 1fc761e

14 files changed

Lines changed: 43 additions & 43 deletions

crates/squawk_server/src/dispatch.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ pub(crate) struct RequestDispatcher<'a> {
1414
}
1515

1616
impl<'a> RequestDispatcher<'a> {
17-
pub(crate) fn new(req: lsp_server::Request, system: &'a mut GlobalState) -> Self {
17+
pub(crate) fn new(req: lsp_server::Request, global_state: &'a mut GlobalState) -> Self {
1818
Self {
1919
req: Some(req),
20-
global_state: system,
20+
global_state,
2121
}
2222
}
2323

crates/squawk_server/src/handlers/code_action.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ use crate::global_state::Snapshot;
1212
use crate::lsp_utils;
1313

1414
pub(crate) fn handle_code_action(
15-
system: &Snapshot,
15+
snapshot: &Snapshot,
1616
params: CodeActionParams,
1717
) -> Result<Option<CodeActionResponse>> {
1818
let uri = params.text_document.uri;
1919

2020
let mut actions: CodeActionResponse = vec![];
2121

22-
let db = system.db();
23-
let file = system.file(&uri).unwrap();
22+
let db = snapshot.db();
23+
let file = snapshot.file(&uri).unwrap();
2424
let line_index = line_index(db, file);
2525
let offset = lsp_utils::offset(&line_index, params.range.start).unwrap();
2626

crates/squawk_server/src/handlers/completion.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ use crate::global_state::Snapshot;
77
use crate::lsp_utils;
88

99
pub(crate) fn handle_completion(
10-
system: &Snapshot,
10+
snapshot: &Snapshot,
1111
params: CompletionParams,
1212
) -> Result<Option<CompletionResponse>> {
1313
let uri = params.text_document_position.text_document.uri;
1414
let position = params.text_document_position.position;
1515

16-
let db = system.db();
17-
let file = system.file(&uri).unwrap();
16+
let db = snapshot.db();
17+
let file = snapshot.file(&uri).unwrap();
1818
let line_index = line_index(db, file);
1919

2020
let Some(offset) = lsp_utils::offset(&line_index, position) else {

crates/squawk_server/src/handlers/diagnostic.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ use lsp_types::{
77
use crate::global_state::Snapshot;
88

99
pub(crate) fn handle_document_diagnostic(
10-
system: &Snapshot,
10+
snapshot: &Snapshot,
1111
params: DocumentDiagnosticParams,
1212
) -> Result<DocumentDiagnosticReportResult> {
1313
let uri = params.text_document.uri;
1414

15-
let diagnostics = system
15+
let diagnostics = snapshot
1616
.file(&uri)
17-
.map(|file| crate::lint::lint(system.db(), file))
17+
.map(|file| crate::lint::lint(snapshot.db(), file))
1818
.unwrap_or_default();
1919

2020
Ok(DocumentDiagnosticReportResult::Report(

crates/squawk_server/src/handlers/document_symbol.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ use crate::global_state::Snapshot;
88
use crate::lsp_utils;
99

1010
pub(crate) fn handle_document_symbol(
11-
system: &Snapshot,
11+
snapshot: &Snapshot,
1212
params: DocumentSymbolParams,
1313
) -> Result<Option<DocumentSymbolResponse>> {
1414
let uri = params.text_document.uri;
1515

16-
let db = system.db();
17-
let file = system.file(&uri).unwrap();
16+
let db = snapshot.db();
17+
let file = snapshot.file(&uri).unwrap();
1818
let line_index = line_index(db, file);
1919

2020
let symbols = document_symbols(db, file);

crates/squawk_server/src/handlers/folding_range.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ use crate::global_state::Snapshot;
77
use crate::lsp_utils;
88

99
pub(crate) fn handle_folding_range(
10-
system: &Snapshot,
10+
snapshot: &Snapshot,
1111
params: FoldingRangeParams,
1212
) -> Result<Option<Vec<FoldingRange>>> {
1313
let uri = params.text_document.uri;
1414

15-
let db = system.db();
16-
let file = system.file(&uri).unwrap();
15+
let db = snapshot.db();
16+
let file = snapshot.file(&uri).unwrap();
1717
let line_idx = line_index(db, file);
1818

1919
let lsp_folds: Vec<FoldingRange> = folding_ranges(db, file)

crates/squawk_server/src/handlers/goto_definition.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ use crate::global_state::Snapshot;
77
use crate::lsp_utils::{self, to_location};
88

99
pub(crate) fn handle_goto_definition(
10-
system: &Snapshot,
10+
snapshot: &Snapshot,
1111
params: GotoDefinitionParams,
1212
) -> Result<Option<GotoDefinitionResponse>> {
1313
let uri = params.text_document_position_params.text_document.uri;
1414
let position = params.text_document_position_params.position;
1515

16-
let db = system.db();
17-
let file = system.file(&uri).unwrap();
16+
let db = snapshot.db();
17+
let file = snapshot.file(&uri).unwrap();
1818
let line_index = line_index(db, file);
1919
let offset = lsp_utils::offset(&line_index, position).unwrap();
2020

@@ -25,7 +25,7 @@ pub(crate) fn handle_goto_definition(
2525
!location.range.contains(offset),
2626
"Our target destination range must not include the source range otherwise go to def won't work in vscode."
2727
);
28-
to_location(db, system, &uri, location)
28+
to_location(snapshot, &uri, location)
2929
})
3030
.collect();
3131

crates/squawk_server/src/handlers/hover.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ use squawk_ide::hover::hover;
66
use crate::global_state::Snapshot;
77
use crate::lsp_utils;
88

9-
pub(crate) fn handle_hover(system: &Snapshot, params: HoverParams) -> Result<Option<Hover>> {
9+
pub(crate) fn handle_hover(snapshot: &Snapshot, params: HoverParams) -> Result<Option<Hover>> {
1010
let uri = params.text_document_position_params.text_document.uri;
1111
let position = params.text_document_position_params.position;
1212

13-
let db = system.db();
14-
let file = system.file(&uri).unwrap();
13+
let db = snapshot.db();
14+
let file = snapshot.file(&uri).unwrap();
1515
let line_index = line_index(db, file);
1616
let offset = lsp_utils::offset(&line_index, position).unwrap();
1717

crates/squawk_server/src/handlers/inlay_hints.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ use crate::global_state::Snapshot;
1010
use crate::lsp_utils;
1111

1212
pub(crate) fn handle_inlay_hints(
13-
system: &Snapshot,
13+
snapshot: &Snapshot,
1414
params: InlayHintParams,
1515
) -> Result<Option<Vec<InlayHint>>> {
1616
let uri = params.text_document.uri;
1717

18-
let db = system.db();
19-
let file = system.file(&uri).unwrap();
18+
let db = snapshot.db();
19+
let file = snapshot.file(&uri).unwrap();
2020
let line_index = line_index(db, file);
2121

2222
let hints = inlay_hints(db, file);

crates/squawk_server/src/handlers/references.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ use crate::global_state::Snapshot;
77
use crate::lsp_utils::{self, to_location};
88

99
pub(crate) fn handle_references(
10-
system: &Snapshot,
10+
snapshot: &Snapshot,
1111
params: ReferenceParams,
1212
) -> Result<Option<Vec<Location>>> {
1313
let uri = params.text_document_position.text_document.uri;
1414
let position = params.text_document_position.position;
1515

16-
let db = system.db();
17-
let file = system.file(&uri).unwrap();
16+
let db = snapshot.db();
17+
let file = snapshot.file(&uri).unwrap();
1818
let line_index = line_index(db, file);
1919
let offset = lsp_utils::offset(&line_index, position).unwrap();
2020

@@ -24,7 +24,7 @@ pub(crate) fn handle_references(
2424
let locations: Vec<Location> = refs
2525
.into_iter()
2626
.filter(|loc| include_declaration || !loc.range.contains(offset))
27-
.filter_map(|loc| to_location(db, system, &uri, loc))
27+
.filter_map(|loc| to_location(snapshot, &uri, loc))
2828
.collect();
2929

3030
Ok(Some(locations))

0 commit comments

Comments
 (0)