# "Go to Definition" works for project files but not stdlib files?

**URL:** <https://forum.modular.com/t/go-to-definition-works-for-project-files-but-not-stdlib-files/3512>\
**Category:** LSP\
**Created:** [September 20, 2026, 1:55am UTC](https://forum.modular.com/t/go-to-definition-works-for-project-files-but-not-stdlib-files/3512 "2026-09-20T01:55:52Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![derickdowney](https://sea1.discourse-cdn.com/flex001/user_avatar/forum.modular.com/derickdowney/32/1287_2.png) [@derickdowney](https://forum.modular.com/u/derickdowney)\
**Post date:** [September 20, 2026, 1:55am UTC](https://forum.modular.com/t/go-to-definition-works-for-project-files-but-not-stdlib-files/3512/1 "2026-09-20T01:55:52Z")

</div>

Hello! I’m using the “mojo-lsp-server” with Neovim 0.12. If I define a struct within my pixi project, then I use that struct in another file and run the `:lua vim.lsp.buf.definition()` command, it jumps me to the .mojo file where I defined that struct. However no matter what I do, when I try to go to the definition of any standard library structs or functions, it says “No locations found”.

When I run “mojo-lsp-server --help”, I can see there’s an argument for:

> -I - Append directory to the search path list used to resolve imported modules in a document

It makes sense that, since the pixi package manager only installs a couple binaries and NOT the entire Mojo source code, the LSP server would require me to pass in the location for the source code. So I’ve updated my Neovim LSP config to add an `-I` that points to a `modular/Mojo/stdlib` location on my computer, as well as `modular/Mojo/stdlib/std` and other locations while experimenting… however nothing I’ve tried works. Anytime I “go to definition” on an `Int` or `String` or ` random.seed()` or anything, I get “No locations found”

Does anyone have any advice for how to get my LSP’s “go to definition” to jump to files within the Modular repo’s source code?

---

<div class="post-metadata">

**Author:** ![melodyogonna](https://sea1.discourse-cdn.com/flex001/user_avatar/forum.modular.com/melodyogonna/32/33_2.png) [@melodyogonna](https://forum.modular.com/u/melodyogonna)\
**Post date:** [September 20, 2026, 8:55pm UTC](https://forum.modular.com/t/go-to-definition-works-for-project-files-but-not-stdlib-files/3512/2 "2026-09-20T20:55:59Z")

</div>

Mojo stdlib is precompiled and shipped without the source - I don’t see how passing location arguments should help here.  
I myself also think this should be supported; in languages I’ve worked with (Python, Go), I’m used to looking at stdlib api definitions as well.

---

<div class="post-metadata">

**Author:** ![mseritan](https://sea1.discourse-cdn.com/flex001/user_avatar/forum.modular.com/mseritan/32/130_2.png) [@mseritan](https://forum.modular.com/u/mseritan)\
**Post date:** [September 24, 2026, 12:16pm UTC](https://forum.modular.com/t/go-to-definition-works-for-project-files-but-not-stdlib-files/3512/3 "2026-09-24T12:16:39Z")

</div>

I tried to -I to the local checkout of the Modular repo, pointing to the stdlib and max folders but it didn’t help.

---

<div class="post-metadata">

**Author:** ![ahajha](https://avatars.discourse-cdn.com/v4/letter/a/cdc98d/32.png) [@ahajha](https://forum.modular.com/u/ahajha)\
**Post date:** [September 28, 2026, 11:00am UTC](https://forum.modular.com/t/go-to-definition-works-for-project-files-but-not-stdlib-files/3512/4 "2026-09-28T11:00:00Z")

</div>

There are two issues here, we should definitely fix both.

The first is that as mentioned, we only ship `std.mojoc`. I think there’s a good route where we can ship the `std` source files as part of the `mojo` package (still leaving it out of `mojo-compiler` to keep things lean).

The second is that the LSP uses the same import resolution order as the compiler, so it prefers a `.mojoc` file if it can get one. We need to change that order in the LSP so that it prefers source.

As a temporary hack: If you modify your local venv to remove the prebuilt std and place the sources in instead (or use -I to a local checkout, double check that it’s the exact same version), I think that should work. Though not sure if the compiler would be happy, at the very least it would increase compile times.
