Skip to content

Commit 90e6604

Browse files
committed
Fix typos
Update docstring
1 parent e06e5d1 commit 90e6604

File tree

3 files changed

+10
-11
lines changed

3 files changed

+10
-11
lines changed

crates/ark/src/lsp/diagnostics.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,7 @@ pub struct DiagnosticContext<'a> {
6666
pub library: &'a Library,
6767

6868
/// The symbols exported by packages loaded via `library()` calls in this
69-
/// document. Currently global. TODO: Store individual exports in a BTreeMap
70-
/// sorted by position in the source?
69+
/// document. Currently global.
7170
pub library_symbols: BTreeMap<Point, HashSet<String>>,
7271

7372
// Whether or not we're inside of a formula.
@@ -84,7 +83,7 @@ impl Default for DiagnosticsConfig {
8483
}
8584

8685
impl<'a> DiagnosticContext<'a> {
87-
pub fn new(contents: &'a Rope, library: &'a crate::lsp::inputs::library::Library) -> Self {
86+
pub fn new(contents: &'a Rope, library: &'a Library) -> Self {
8887
Self {
8988
contents,
9089
document_symbols: Vec::new(),
@@ -103,21 +102,20 @@ impl<'a> DiagnosticContext<'a> {
103102
symbols.insert(name.to_string(), location);
104103
}
105104

106-
// First, check document symbols.
107105
pub fn has_definition(&self, name: &str, start_position: Point) -> bool {
106+
// Check document symbols
108107
for symbols in &self.document_symbols {
109108
if symbols.contains_key(name) {
110109
return true;
111110
}
112111
}
113112

114-
// Then, check workspace symbols.
113+
// Check workspace symbols
115114
if self.workspace_symbols.contains(name) {
116115
return true;
117116
}
118117

119-
// Finally, check package symbols from `library()` calls.
120-
// Check all symbols exported by `library()` before the given position.
118+
// Check all symbols exported by `library()` calls before the given position
121119
for (library_position, exports) in self.library_symbols.iter() {
122120
if *library_position > start_position {
123121
break;
@@ -127,7 +125,7 @@ impl<'a> DiagnosticContext<'a> {
127125
}
128126
}
129127

130-
// Finally, check session symbols.
128+
// Finally, check session symbols
131129
self.session_symbols.contains(name)
132130
}
133131
}

crates/ark/src/lsp/diagnostics_syntax.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,10 +309,11 @@ mod tests {
309309
use crate::lsp::diagnostics::DiagnosticContext;
310310
use crate::lsp::diagnostics_syntax::syntax_diagnostics;
311311
use crate::lsp::documents::Document;
312+
use crate::lsp::inputs::library::Library;
312313

313314
fn text_diagnostics(text: &str) -> Vec<Diagnostic> {
314315
let document = Document::new(text, None);
315-
let library = crate::lsp::inputs::library::Library::default();
316+
let library = Library::default();
316317
let context = DiagnosticContext::new(&document.contents, &library);
317318
let diagnostics = syntax_diagnostics(document.ast.root_node(), &context).unwrap();
318319
diagnostics

crates/ark/src/lsp/inputs/package.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ use crate::lsp::inputs::package_namespace::Namespace;
1414
/// Represents an R package and its metadata relevant for static analysis.
1515
#[derive(Clone, Debug)]
1616
pub struct Package {
17-
/// Path to the directory that contains `DESCRIPTION`. Could be an installed
18-
/// package, or a package source.
17+
/// Path to the directory that contains `DESCRIPTION` and `NAMESPACE`. Can
18+
/// be an installed package or a package source.
1919
pub path: PathBuf,
2020

2121
pub description: Description,

0 commit comments

Comments
 (0)