@@ -84,7 +84,7 @@ impl Default for DiagnosticsConfig {
84
84
}
85
85
86
86
impl < ' a > DiagnosticContext < ' a > {
87
- pub fn new ( contents : & ' a Rope , library : & ' a crate :: lsp :: inputs :: library :: Library ) -> Self {
87
+ pub fn new ( contents : & ' a Rope , library : & ' a Library ) -> Self {
88
88
Self {
89
89
contents,
90
90
document_symbols : Vec :: new ( ) ,
@@ -103,21 +103,20 @@ impl<'a> DiagnosticContext<'a> {
103
103
symbols. insert ( name. to_string ( ) , location) ;
104
104
}
105
105
106
- // First, check document symbols.
107
106
pub fn has_definition ( & self , name : & str , start_position : Point ) -> bool {
107
+ // Check document symbols
108
108
for symbols in & self . document_symbols {
109
109
if symbols. contains_key ( name) {
110
110
return true ;
111
111
}
112
112
}
113
113
114
- // Then, check workspace symbols.
114
+ // Check workspace symbols
115
115
if self . workspace_symbols . contains ( name) {
116
116
return true ;
117
117
}
118
118
119
- // Finally, check package symbols from `library()` calls.
120
- // Check all symbols exported by `library()` before the given position.
119
+ // Check all symbols exported by `library()` calls before the given position
121
120
for ( library_position, exports) in self . library_symbols . iter ( ) {
122
121
if * library_position > start_position {
123
122
break ;
@@ -127,7 +126,7 @@ impl<'a> DiagnosticContext<'a> {
127
126
}
128
127
}
129
128
130
- // Finally, check session symbols.
129
+ // Finally, check session symbols
131
130
self . session_symbols . contains ( name)
132
131
}
133
132
}
0 commit comments