Try to offer Throwable-only class completions after `throw new`. Restricts to Throwable descendants only — no constants or functions. Returns `None` when the cursor is not in a `throw new` context or when no completions could be produced.
(
&self,
content: &str,
position: Position,
ctx: &FileContext,
uri: &str,
)
| 1142 | /// Returns `None` when the cursor is not in a `throw new` context or |
| 1143 | /// when no completions could be produced. |
| 1144 | fn try_throw_new_completion( |
| 1145 | &self, |
| 1146 | content: &str, |
| 1147 | position: Position, |
| 1148 | ctx: &FileContext, |
| 1149 | uri: &str, |
| 1150 | ) -> Option<CompletionResponse> { |
| 1151 | let partial = Self::extract_partial_class_name(content, position)?; |
| 1152 | if !Self::is_throw_new_context(content, position) { |
| 1153 | return None; |
| 1154 | } |
| 1155 | let (class_items, class_incomplete) = |
| 1156 | self.build_catch_class_name_completions(ctx, &partial, content, true, position, uri); |
| 1157 | if class_items.is_empty() { |
| 1158 | None |
| 1159 | } else { |
| 1160 | let items = if paren_follows_cursor(content, position) { |
| 1161 | strip_snippet_parens(class_items) |
| 1162 | } else { |
| 1163 | class_items |
| 1164 | }; |
| 1165 | Some(CompletionResponse::List(CompletionList { |
| 1166 | is_incomplete: class_incomplete, |
| 1167 | items, |
| 1168 | })) |
| 1169 | } |
| 1170 | } |
| 1171 | |
| 1172 | // ─── Strategy: class / constant / function completion ──────────────── |
| 1173 |
no test coverage detected