Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitbb60b37

Browse files
committed
fix: add binFindStrategy to rust-analyzer preset
- Add proper binary finding strategy for rust-analyzer- Support common installation paths (~/.cargo/bin, /usr/bin, etc.)- Fix path expansion for home directory (~) in binFinderThis fixes the initialization error when using lsmcp with Rust projects.
1 parent6decdec commitbb60b37

File tree

2 files changed

+22
-6
lines changed

2 files changed

+22
-6
lines changed

‎src/presets/rust-analyzer.ts‎

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,20 @@ import type { Preset } from "../config/schema.ts";
55
*/
66
exportconstrustAnalyzerAdapter:Preset={
77
presetId:"rust-analyzer",
8-
bin:"rust-analyzer",
9-
args:[],
8+
name:"rust-analyzer",
9+
description:"Language Server for Rust",
10+
binFindStrategy:{
11+
strategies:[
12+
// 1. Check global installation (most common for Rust)
13+
{type:"global",names:["rust-analyzer"]},
14+
// 2. Check cargo install location
15+
{type:"path",path:"~/.cargo/bin/rust-analyzer"},
16+
// 3. Check system package manager installations
17+
{type:"path",path:"/usr/bin/rust-analyzer"},
18+
{type:"path",path:"/usr/local/bin/rust-analyzer"},
19+
],
20+
defaultArgs:[],
21+
},
1022
files:["**/*.rs"],
1123
initializationOptions:{
1224
cargo:{

‎src/utils/binFinder.ts‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -196,10 +196,14 @@ export function findBinary(
196196
}
197197

198198
case"path":{
199-
// Use direct path
200-
if(existsSync(item.path)){
201-
mcpDebugWithPrefix("BinFinder",`Found at path:${item.path}`);
202-
return{command:item.path,args:defaultArgs};
199+
// Use direct path (expand ~ for home directory)
200+
constexpandedPath=item.path.replace(
201+
/^~/,
202+
process.env.HOME||process.env.USERPROFILE||"",
203+
);
204+
if(existsSync(expandedPath)){
205+
mcpDebugWithPrefix("BinFinder",`Found at path:${expandedPath}`);
206+
return{command:expandedPath,args:defaultArgs};
203207
}
204208
break;
205209
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp