jsonette/completion.rs
1/*
2 * Copyright (c) 2026 DevEtte.
3 *
4 * This project is dual-licensed under both the MIT License and the
5 * Apache License, Version 2.0 (the "License"). You may not use this
6 * file except in compliance with one of these licenses.
7 *
8 * You may obtain a copy of the Licenses at:
9 * - MIT: https://opensource.org
10 * - Apache 2.0: http://apache.org
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18
19//! JSONPath auto-completion and suggestion engine.
20
21use crate::json_node::JsonNode;
22use crate::types::CompletionItem;
23
24/// Provides autocomplete suggestions for a JSONPath prefix given the current document state.
25///
26/// # Arguments
27///
28/// * `node` - A reference to the parsed root `JsonNode` context.
29/// * `path_prefix` - The incomplete JSONPath prefix string slice typed by the user.
30///
31/// # Returns
32///
33/// A list of `CompletionItem` candidates suitable for autocomplete suggestions.
34pub fn completions_at(node: &JsonNode, path_prefix: &str) -> Vec<CompletionItem> {
35 todo!("Autocomplete suggestion logic will be implemented in subsequent issues")
36}
37
38#[cfg(test)]
39mod stub_tests {
40 use super::*;
41 use crate::parser::parse;
42
43 #[test]
44 #[should_panic(expected = "not yet implemented")]
45 fn test_completions_at_is_stub() {
46 let node = parse("{}").unwrap();
47 completions_at(&node, "$.");
48 }
49}