compiler-cli
compiler-core
src
javascript
language_server
···
96
96
.find_map(|function| function.find_statement(byte_index))
97
97
}
98
98
99
99
-
pub fn count_definitions(&self) -> usize {
99
99
+
pub fn definitions_len(&self) -> usize {
100
100
let TypedDefinitions {
101
101
imports,
102
102
constants,
···
7
7
pub type Task(a) = fn() -> Promise(a)
8
8
9
9
----- TYPESCRIPT DEFINITIONS
10
10
-
export type Task = () => Promise$<any>;
11
11
-
12
10
export type Promise$<I> = any;
11
11
+
12
12
+
export type Task = () => Promise$<any>;
···
349
349
fn definitions(&mut self, imports: &mut Imports<'_>) -> Vec<Document<'a>> {
350
350
let mut documents = vec![];
351
351
352
352
-
for type_alias in &self.module.definitions.type_aliases {
353
353
-
if let Some(document) = self.type_alias(type_alias) {
354
354
-
documents.push(document);
355
355
-
}
356
356
-
}
357
357
-
358
352
for custom_type in &self.module.definitions.custom_types {
359
353
if let Some(mut new_documents) = self.custom_type_definition(custom_type, imports) {
360
354
documents.append(&mut new_documents);
355
355
+
}
356
356
+
}
357
357
+
358
358
+
for type_alias in &self.module.definitions.type_aliases {
359
359
+
if let Some(document) = self.type_alias(type_alias) {
360
360
+
documents.push(document);
361
361
}
362
362
}
363
363
···
1827
1827
module_name: &EcoString,
1828
1828
constructor_name: &EcoString,
1829
1829
) {
1830
1830
-
self.unqualified_constructor = (self.module.ast.definitions.imports)
1830
1830
+
self.unqualified_constructor = self
1831
1831
+
.module
1832
1832
+
.ast
1833
1833
+
.definitions
1834
1834
+
.imports
1831
1835
.iter()
1832
1836
.filter(|import| import.module == *module_name)
1833
1837
.find_map(|import| {
···
1847
1851
1848
1852
fn get_module_import_from_type_constructor(&mut self, constructor_name: &EcoString) {
1849
1853
self.unqualified_constructor =
1850
1850
-
(self.module.ast.definitions.imports)
1854
1854
+
self.module
1855
1855
+
.ast
1856
1856
+
.definitions
1857
1857
+
.imports
1851
1858
.iter()
1852
1859
.find_map(|import| {
1853
1860
if let Some(ty) = import
···
7582
7589
/// unqualified values it's importing. Sorted by SrcSpan location.
7583
7590
///
7584
7591
fn imported_values(&self, import_location: SrcSpan) -> Vec<SrcSpan> {
7585
7585
-
(self.module.ast.definitions.imports)
7592
7592
+
self.module
7593
7593
+
.ast
7594
7594
+
.definitions
7595
7595
+
.imports
7586
7596
.iter()
7587
7597
.find(|import| import.location.contains(import_location.start))
7588
7598
.map(|import| {
···
7603
7613
return vec![];
7604
7614
}
7605
7615
7606
7606
-
let unused_imports = (self.module.ast.type_info.warnings.iter())
7616
7616
+
let unused_imports = self
7617
7617
+
.module
7618
7618
+
.ast
7619
7619
+
.type_info
7620
7620
+
.warnings
7621
7621
+
.iter()
7607
7622
.filter_map(|warning| match warning {
7608
7623
type_::Warning::UnusedImportedValue { location, .. } => {
7609
7624
Some(UnusedImport::ValueOrType(*location))
···
32
32
.chain(custom_types.iter().map(|custom_type| custom_type.location))
33
33
.chain(type_aliases.iter().map(|type_alias| type_alias.location))
34
34
.chain(functions.iter().map(|function| function.location))
35
35
-
.filter(|location| location.lt(&first_import.location))
36
36
-
.peekable()
37
37
-
.peek()
38
38
-
.is_none();
35
35
+
.all(|location| location >= first_import.location);
39
36
40
37
if import_is_first_definition {
41
38
Some(src_span_to_lsp_range(first_import.location, line_numbers).start)
···
30
30
if current_position == position {
31
31
underline_empty = false;
32
32
underline.push('↑');
33
33
-
} else if start.le(¤t_position) && current_position.lt(&end) {
33
33
+
} else if start <= current_position && current_position < end {
34
34
underline_empty = false;
35
35
underline.push('▔');
36
36
} else {
···
57
57
if Some(current_position) == position {
58
58
underline_empty = false;
59
59
underline.push('↑');
60
60
-
} else if start.le(¤t_position) && current_position.lt(&end) {
60
60
+
} else if start <= ¤t_position && current_position < *end {
61
61
underline_empty = false;
62
62
underline.push('▔');
63
63
} else {