mirror of
https://github.com/anomalyco/opencode.git
synced 2026-02-01 22:48:16 +00:00
docs: fix documentation issues (#11435)
Co-authored-by: damaozi <1811866786@qq.com>
This commit is contained in:
@@ -100,7 +100,7 @@ const TIPS = [
|
||||
'Set {highlight}"formatter": false{/highlight} in config to disable all auto-formatting',
|
||||
"Define custom formatter commands with file extensions in config",
|
||||
"OpenCode uses LSP servers for intelligent code analysis",
|
||||
"Create {highlight}.ts{/highlight} files in {highlight}.opencode/tool/{/highlight} to define new LLM tools",
|
||||
"Create {highlight}.ts{/highlight} files in {highlight}.opencode/tools/{/highlight} to define new LLM tools",
|
||||
"Tool definitions can invoke scripts written in Python, Go, etc",
|
||||
"Add {highlight}.ts{/highlight} files to {highlight}.opencode/plugin/{/highlight} for event hooks",
|
||||
"Use plugins to send OS notifications when sessions complete",
|
||||
|
||||
@@ -87,6 +87,50 @@ Let's look at some examples.
|
||||
|
||||
---
|
||||
|
||||
### Environment variables
|
||||
|
||||
Use the `env` property to set environment variables when starting the LSP server:
|
||||
|
||||
```json title="opencode.json" {5-7}
|
||||
{
|
||||
"$schema": "https://opencode.ai/config.json",
|
||||
"lsp": {
|
||||
"rust": {
|
||||
"env": {
|
||||
"RUST_LOG": "debug"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Initialization options
|
||||
|
||||
Use the `initialization` property to pass initialization options to the LSP server. These are server-specific settings sent during the LSP `initialize` request:
|
||||
|
||||
```json title="opencode.json" {5-9}
|
||||
{
|
||||
"$schema": "https://opencode.ai/config.json",
|
||||
"lsp": {
|
||||
"typescript": {
|
||||
"initialization": {
|
||||
"preferences": {
|
||||
"importModuleSpecifierPreference": "relative"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
:::note
|
||||
Initialization options vary by LSP server. Check your LSP server's documentation for available options.
|
||||
:::
|
||||
|
||||
---
|
||||
|
||||
### Disabling LSP servers
|
||||
|
||||
To disable **all** LSP servers globally, set `lsp` to `false`:
|
||||
|
||||
@@ -1222,6 +1222,10 @@ To use Kimi K2 from Moonshot AI:
|
||||
|
||||
You can configure opencode to use local models through Ollama.
|
||||
|
||||
:::tip
|
||||
Ollama can automatically configure itself for OpenCode. See the [Ollama integration docs](https://docs.ollama.com/integrations/opencode) for details.
|
||||
:::
|
||||
|
||||
```json title="opencode.json" "ollama" {5, 6, 8, 10-14}
|
||||
{
|
||||
"$schema": "https://opencode.ai/config.json",
|
||||
|
||||
Reference in New Issue
Block a user