-
Notifications
You must be signed in to change notification settings - Fork 12.5k
Description
Description
Problem
When OpenCode is started in a nested Elixir app inside a git monorepo, ElixirLS appears to attach to the git root instead of the opened app root.
That breaks Elixir navigation in the subproject:
document-symbolsreturns[]for valid.exfiles- some runs time out during ElixirLS
initialize - sessions keep the correct
directory, but the resolved project root stays the monorepo root
Why this looks like the root cause
I started OpenCode in a nested Mix app:
opencode /path/to/monorepo/apps/example_appBut the local API still resolves the current project to the git root:
curl -s http://127.0.0.1:4099/project/current{
"id": "<project-id>",
"worktree": "/path/to/monorepo",
"vcs": "git"
}At the same time, sessions keep the nested app as their directory:
curl -s 'http://127.0.0.1:4099/experimental/session?directory=/path/to/monorepo/apps/example_app&roots=true'Example response shape:
{
"directory": "/path/to/monorepo/apps/example_app",
"project": {
"worktree": "/path/to/monorepo"
}
}So OpenCode distinguishes directory from project.worktree, but ElixirLS appears to follow the git-root project.
Expected behavior
If I open:
opencode /path/to/monorepo/apps/example_appthen ElixirLS should attach to:
/path/to/monorepo/apps/example_app
or at least to the nearest ancestor containing mix.exs, not to:
/path/to/monorepo
Actual behavior
For valid Elixir files inside the nested app:
opencode debug lsp document-symbols file:///path/to/monorepo/apps/example_app/lib/example_app/application.exreturns:
[]And:
opencode debug lsp diagnostics /path/to/monorepo/apps/example_app/lib/example_app/application.exreturns:
{
"/path/to/monorepo/apps/example_app/lib/example_app/application.ex": []
}Environment
- OpenCode
1.2.24 - macOS
- Elixir
1.15.6-otp-26 - Erlang
26.1.2
Notes
The nested app itself is valid:
- it has its own
mix.exs - it has its own
.tool-versions - it already has
.elixir_ls/
This looks like an OpenCode workspace/project-root issue rather than an ElixirLS project setup issue.
Plugins
No response
OpenCode version
1.2.24
Steps to reproduce
Minimal reproduction
Repo shape:
/path/to/monorepo/.git/path/to/monorepo/apps/example_app/mix.exs
Commands:
opencode /path/to/monorepo/apps/example_app
opencode debug lsp document-symbols file:///path/to/monorepo/apps/example_app/lib/example_app/application.exScreenshot and/or share link
No response
Operating System
macOS
Terminal
cmux