feat: LSP client integration with diagnostics, definitions, and references

This commit is contained in:
Sisyphus
2026-04-01 21:34:36 +09:00
parent 821199640a
commit 12182d8b3c
12 changed files with 1287 additions and 25 deletions

View File

@@ -91,10 +91,7 @@ impl GlobalToolRegistry {
Ok(Self { plugin_tools })
}
pub fn normalize_allowed_tools(
&self,
values: &[String],
) -> Result<Option<BTreeSet<String>>, String> {
pub fn normalize_allowed_tools(&self, values: &[String]) -> Result<Option<BTreeSet<String>>, String> {
if values.is_empty() {
return Ok(None);
}
@@ -103,11 +100,7 @@ impl GlobalToolRegistry {
let canonical_names = builtin_specs
.iter()
.map(|spec| spec.name.to_string())
.chain(
self.plugin_tools
.iter()
.map(|tool| tool.definition().name.clone()),
)
.chain(self.plugin_tools.iter().map(|tool| tool.definition().name.clone()))
.collect::<Vec<_>>();
let mut name_map = canonical_names
.iter()
@@ -158,8 +151,7 @@ impl GlobalToolRegistry {
.plugin_tools
.iter()
.filter(|tool| {
allowed_tools
.is_none_or(|allowed| allowed.contains(tool.definition().name.as_str()))
allowed_tools.is_none_or(|allowed| allowed.contains(tool.definition().name.as_str()))
})
.map(|tool| ToolDefinition {
name: tool.definition().name.clone(),
@@ -182,8 +174,7 @@ impl GlobalToolRegistry {
.plugin_tools
.iter()
.filter(|tool| {
allowed_tools
.is_none_or(|allowed| allowed.contains(tool.definition().name.as_str()))
allowed_tools.is_none_or(|allowed| allowed.contains(tool.definition().name.as_str()))
})
.map(|tool| {
(
@@ -3458,6 +3449,9 @@ mod tests {
#[test]
fn skill_loads_local_skill_prompt() {
let _guard = env_lock()
.lock()
.unwrap_or_else(std::sync::PoisonError::into_inner);
let result = execute_tool(
"Skill",
&json!({