Skip to content

Commit 8387de0

Browse files
committed
Index and emit R6 methods as methods
1 parent 3e705dd commit 8387de0

File tree

6 files changed

+28
-6
lines changed

6 files changed

+28
-6
lines changed

crates/ark/src/lsp/completions/sources/composite/call.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,7 @@ fn completions_from_workspace_arguments(
267267
return Ok(None);
268268
},
269269
indexer::IndexEntryData::Variable { .. } => return Ok(None),
270+
indexer::IndexEntryData::Method { .. } => return Ok(None),
270271
}
271272

272273
// Only 1 call worth of arguments are added to the completion set.

crates/ark/src/lsp/completions/sources/composite/workspace.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,9 @@ fn completions_from_workspace(
125125
};
126126
completions.push(completion);
127127
},
128+
129+
// Methods are currently only indexed for workspace symbols
130+
indexer::IndexEntryData::Method { .. } => {},
128131
}
129132
});
130133

crates/ark/src/lsp/indexer.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ pub enum IndexEntryData {
3939
name: String,
4040
arguments: Vec<String>,
4141
},
42+
// Like Function but not used for completions yet
43+
Method {
44+
name: String,
45+
},
4246
Section {
4347
level: usize,
4448
title: String,
@@ -359,11 +363,10 @@ fn index_r6_class(
359363
let start = convert_point_to_position(contents, mtd_name.start_position());
360364
let end = convert_point_to_position(contents, mtd_name.end_position());
361365

362-
// TODO!: Should be Method
363366
entries.push(IndexEntry {
364367
key: name.clone(),
365368
range: Range { start, end },
366-
data: IndexEntryData::Variable { name },
369+
data: IndexEntryData::Method { name },
367370
});
368371
}
369372
}

crates/ark/src/lsp/snapshots/ark__lsp__indexer__tests__index_r6class.snap

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ expression: entries
1515
character: 18,
1616
},
1717
},
18-
data: Variable {
18+
data: Method {
1919
name: "initialize",
2020
},
2121
},
@@ -31,7 +31,7 @@ expression: entries
3131
character: 21,
3232
},
3333
},
34-
data: Variable {
34+
data: Method {
3535
name: "public_method",
3636
},
3737
},
@@ -47,7 +47,7 @@ expression: entries
4747
character: 22,
4848
},
4949
},
50-
data: Variable {
50+
data: Method {
5151
name: "private_method",
5252
},
5353
},

crates/ark/src/lsp/snapshots/ark__lsp__indexer__tests__index_r6class_namespaced.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ expression: entries
1515
character: 18,
1616
},
1717
},
18-
data: Variable {
18+
data: Method {
1919
name: "initialize",
2020
},
2121
},

crates/ark/src/lsp/symbols.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ pub fn symbols(params: &WorkspaceSymbolParams) -> anyhow::Result<Vec<SymbolInfor
9393
container_name: None,
9494
});
9595
},
96+
9697
IndexEntryData::Variable { name } => {
9798
info.push(SymbolInformation {
9899
name: name.clone(),
@@ -106,6 +107,20 @@ pub fn symbols(params: &WorkspaceSymbolParams) -> anyhow::Result<Vec<SymbolInfor
106107
container_name: None,
107108
});
108109
},
110+
111+
IndexEntryData::Method { name } => {
112+
info.push(SymbolInformation {
113+
name: name.clone(),
114+
kind: SymbolKind::METHOD,
115+
location: Location {
116+
uri: Url::from_file_path(path).unwrap(),
117+
range: entry.range,
118+
},
119+
tags: None,
120+
deprecated: None,
121+
container_name: None,
122+
});
123+
},
109124
};
110125
});
111126

0 commit comments

Comments
 (0)