opencode开启lsp

找到文件路径

# 例如
C:\Users\cancer\.config\opencode\opencode.json

# 增加
"lsp": true 

#  "lsp": true 是开关,省略它 = 完全禁用所有 LSP。 后续的lsp安装交给ai即可

我的配置文件

{
  "$schema": "https://opencode.ai/config.json",
  "plugin": [
    "oh-my-openagent"
  ],
  "lsp": {
    "typescript": {
      "command": [
        "C:\\nvm4w\\nodejs\\node.exe",
        "C:\\Users\\cancer\\AppData\\Roaming\\npm\\node_modules\\typescript-language-server\\lib\\cli.mjs",
        "--stdio"
      ]
    },
    "vue": {
      "command": [
        "C:\\nvm4w\\nodejs\\node.exe",
        "C:\\Users\\cancer\\AppData\\Roaming\\npm\\node_modules\\@vue\\language-server\\bin\\vue-language-server.js",
        "--stdio"
      ]
    }
  },
  "mcp": {
    "ast-grep": {
      "type": "local",
      "command": ["npx", "-y", "@notprolands/ast-grep-mcp"]
    }
  },
  "provider": {
    "omo-claude-46": {
      "models": {
        "claude-sonnet-4.6": {
          "name": "claude-sonnet-4.6"
        }
      },
      "npm": "@ai-sdk/openai-compatible",
      "options": {
        "apiKey": "sk-t3hDbhYfhksvkF0",
        "baseURL": "http://127.0.0.1:8000/v1",
        "setCacheKey": true
      }
    },
    "omo-claude-47": {
      "models": {
        "claude-opus-4.7": {
          "name": "claude-opus-4.7"
        }
      },
      "npm": "@ai-sdk/openai-compatible",
      "options": {
        "apiKey": "sk-t3hDbhYfhn2ZQoJS5ErkF0",
        "baseURL": "http://127.0.0.1:8000/v1",
        "setCacheKey": true
      }
    }
  }
}
posted @ 2026-05-25 22:48  小满三岁啦  阅读(91)  评论(0)    收藏  举报