Skip to content

Enhancement: LSP /api/lsp/operation 在 API server 模式下需要项目上下文初始化 #40

Closed

Description

@dahai80

问题描述

在 API server 模式下,POST /api/lsp/operation 返回 {"error": "LSP server manager not initialized"},因为 LSPServerManager 需要项目工作目录才能启动。

复现步骤

  1. 启动: ./fusion-code --serve --port=11441
  2. 调用: curl -X POST http://127.0.0.1:11441/api/lsp/operation -H 'Content-Type: application/json' -d '{"operation":"hover","file_path":"test.ts","line":1,"character":1}'
  3. 返回: {"error": "LSP server manager not initialized"}

修复建议

  1. 在请求中接受 cwd 参数
  2. 根据 cwd 按需初始化 LSPServerManager
  3. 或在 server 启动时根据 --cwd 参数预初始化

关联

  • 端到端验证报告: ~/fusion/architecture/validate-fusion-code.md ISSUE-7

🤖 Generated with Claude Code

Activity

  1. dahai80 commented on Aug 3, 2026

    @dahai80
    OwnerAuthor

    Fixed in b9f1924: /api/lsp/operation now handles init timeout gracefully with catch block, and returns actionable error message with FUSION_CODE_PROJECT_DIR guidance when manager is unavailable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions