patch-prolog-lsp 0.4.9
“Language Server Protocol implementation for patch-prolog (`plgl`)”
Rust test marker or harnessimports crate::buffer::parse_best_effort
SHA-2562c4a49af4dfe55a2158a7081d3f15cd98ca80ab32279ef1d974b6393e9ff6d8b
MaleculeMd₂(In₄Pa)
Evidence
12:60… haracters
13//! (alphanumeric + underscore).
14
15use std::collections::BTreeSet;
16
17use plg_frontend::stdlib_predicates;
18use plg_shared::builtins::{atom_names, functor_names};
19use tower_lsp::lsp_types::{CompletionItem, CompletionItemKind, Position};
20
21use crate::buffer::{parse_best_effort, position_to_byte_offset, predicate_indicator};
22
23pub fn compute(content: &str, position: Position) -> Vec<CompletionItem> {
24 let prefix = current_word_prefix(content, position);
25
26 // …
140:13… rap_or(before.len());
141 before[prefix_start..].to_string()
142}
143
144#[cfg(test)]
145mod tests {
146 use super::*;
147
148 fn pos(line: u32, col: u32) -> Position {
⋯4 lines
153 }
154
155 #[test]
156 fn prefix_at_end_of_word() {
157 assert_eq!(current_word_prefix("foo\nmem", pos(1, 3)), "mem");
⋯4 lines
148:43… ::compute(&doc.content, position, &uri))
149 }))
150 }
151}
152
153#[tokio::main(flavor = "current_thread")]
154async fn main() {
155 // `--version` / `-V`: print and exit before claiming stdio for the
156 / …
15:22… is a structural-text problem (line-aware "does this
16//! line start a clause for `<name>`?") that's both faster and more tolerant
17//! of mid-edit buffers without it.
18
19use plg_frontend::stdlib_predicates;
20use plg_shared::BUILTINS;
21use tower_lsp::lsp_types::{GotoDefinitionResponse, Location, Position, Range, Url};
22
23use crate::buffer::word_at_position;
24
25pub fn compute(content: &str, position: Position, uri: &Url) -> Option<GotoDefinitionResponse> {
26 let name = word_at_posit …
109:17… r => panic!("expected Scalar, got {other:?}"),
110 }
111 }
112
113 #[test]
114 fn finds_single_compound_definition() {
115 let src = "violation(F, sensitive_field) :- field(F).\n";
116 let resp …
Showing the top 5 files — 1 more file (22 regions) not shown.
No evidence locations were recorded for this file. Raw result