Handle a "go to definition" request. Returns `Some(Location)` when the symbol under the cursor can be resolved to a file and a position inside that file, or `None` when resolution fails at any step.
(
&self,
uri: &str,
content: &str,
position: Position,
)
| 34 | /// resolved to a file and a position inside that file, or `None` when |
| 35 | /// resolution fails at any step. |
| 36 | pub(crate) fn resolve_definition( |
| 37 | &self, |
| 38 | uri: &str, |
| 39 | content: &str, |
| 40 | position: Position, |
| 41 | ) -> Vec<Location> { |
| 42 | // Consult precomputed symbol map (retries one byte earlier for |
| 43 | // end-of-token edge cases). |
| 44 | let symbol = self.lookup_symbol_at_position(uri, content, position); |
| 45 | if let Some(ref s) = symbol |
| 46 | && let Some(resolved) = |
| 47 | self.resolve_from_symbol(&s.kind, uri, content, position, s.start) |
| 48 | { |
| 49 | return resolved; |
| 50 | } |
| 51 | |
| 52 | // Laravel config fallback: declaration sites in config/*.php |
| 53 | if let Some(loc) = |
| 54 | laravel::resolve_config_key_definition_fallback(self, uri, content, position) |
| 55 | { |
| 56 | return vec![loc]; |
| 57 | } |
| 58 | |
| 59 | // env() fallback: not yet indexed in the symbol map. |
| 60 | laravel::resolve_env_definition(self, content, position) |
| 61 | .into_iter() |
| 62 | .collect() |
| 63 | } |
| 64 | |
| 65 | /// Look up the symbol at the given byte offset in the precomputed |
| 66 | /// symbol map for `uri`. |
no test coverage detected