Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

How LSP builds its hover

The server never runs M2, so hover docs have to come from somewhere else.

Builtins come from an index extracted once from Macaulay2’s own documentation and compiled into the server. Every function, type and method has a Markdown page there, plus its signatures and return types (which also feed the type checker). On hover, the signature is narrowed down to the method that’s actually being called.

Your code gets:

  • the inferred type and what the thing is (local, global, method, option, …)
  • the methods you installed on it
  • your doc comment, if there is one; see Inline docs

So a function you wrote two minutes ago already has a useful hover, and adding one comment line above it makes it as good as a builtin’s.