Repository navigation
Conversation
|
Hi @rgunindi, thanks for working on this and opening the PR! It will take me a few days before I have an opportunity to take a more in-depth look at this, but wanted to let you know it's on my radar. |
|
Thanks for letting me know! I'll be around whenever you have the time to dive into it. Have a great week, @dklilley |
|
Hi @gauravsavadi, thanks for the update! I really appreciate you and @dklilley taking the time to look into the PR. I’ll keep an eye out for any feedback or questions. Thanks again! |
|
Hello @rgunindi , At a high level, this seems to be tackling two workflows - one with MATLAB connected, and one without. Our first thought is to split this PR apart at those seams. Is that something you can do? Only first focus on the MATLAB connected case, and review that. Then, we can see if there is a need for the offline case. |
- Add HoverSupportProvider handling textDocument/hover requests - Dynamically query MATLAB documentation via MVM and getHover handler when connected - Format raw MATLAB help text into structured Markdown with syntax highlighting and argument lists - Register hoverProvider capability in Language Server - Add unit tests for HoverSupportProvider and HoverMarkdownUtils
288ff93 to
bbe7448
Compare
|
@gauravsavadi Yes, that makes sense. I’ve removed the offline part from the PR, so the PR now focuses only on the MATLAB-connected workflow. |
|
Thanks for the updated commit, @rgunindi ! A few issues that I think we can improve here: 1. Try to reuse the approach for Go to Definition
You might need to expose a few functions that aren't today, but that should be fine, if it means you're reusing existing algorithms. 2.
|
|
Thanks for the feedback! I'll take a closer look at everything and work on the improvements before updating the PR. |

Summary
Add comprehensive, high-performance LSP Hover (
textDocument/hover) support tomatlab-language-serveracross all LSP clients (VS Code, Helix, Neovim, Emacs, etc.).Key Features
Multi-Tier Dynamic Hover Resolution (
HoverSupportProvider):help(topic)viamatlabls.handlers.hover.getHover.~/.cache/matlabls/matlab_docs.dbusing Node 22 nativenode:sqlite(zero third-party npm dependencies).Structured Markdown Formatter (
HoverMarkdownUtils):helptext into clean, high-fidelity Markdown.matlabsyntax blocks.Hybrid Background Indexing Architecture (
DocumentationIndexer):matlab.indexDocumentationsetting and--indexDocumentationCLI option ('onMissing'[default],'never','always').matlabls.indexDocumentationworkspace command for manual / on-demand triggers.tools/indexer/index_docs.js&tools/indexer/worker.m) automatically scaling worker pool to host CPU cores with quiet/headless mode.Testing & Verification:
HoverSupportProvider,HoverMarkdownUtils,DocumentationIndexer, andExecuteCommandProvider.npm test).npm run package) and strict linting.Motivation: Why is this needed?
Currently,
matlab-language-serverdoes not implement LSP Hover (textDocument/hover). Developers editing MATLAB code in modern editors (Helix, Neovim, VS Code, Emacs, Sublime) are left without inline function signatures, argument definitions, or documentation.Furthermore, connecting to MATLAB via the Language Server (
matlabConnectionTiming = "onStart"or"onDemand") spawns a full MATLAB runtime process (consuming 1.5 GB – 3 GB of RAM, locking license seats, taking 15–30 seconds to boot, and draining battery). Because of this overhead, many developers explicitly configure:Under this lightweight configuration—or in headless/remote environments (SSH, containers, CI)—developers previously had no documentation access whatsoever.
There was a critical need for an offline-first, zero-overhead, sub-millisecond Hover documentation engine that delivers rich, authentic MATLAB documentation without requiring a running MATLAB GUI/daemon.
Solution: How did we solve it?
Currently,
matlab-language-serverdoes not implement LSP Hover (textDocument/hover). Developers editing MATLAB code outside the official MATLAB desktop are left without inline signatures, argument descriptions, or function docs.To query documentation dynamically via MATLAB:
Under this lightweight configuration, developers previously had no documentation access whatsoever.
There was a critical need to decouple documentation from the live MATLAB runtime lifecycle, providing an offline-first, zero-overhead, sub-millisecond Hover documentation engine that eliminates the need to keep MATLAB running in the background.
We implemented a comprehensive, multi-tier Hover architecture with an offline SQLite cache and parallel multi-core indexer:
Sub-Millisecond Offline SQLite Lookup (~0.05ms):
node:sqlite(DatabaseSync), requiring zero third-party npm dependencies.~/.cache/matlabls/matlab_docs.dbinstantly with virtually 0 MB RAM footprint and 0% idle CPU usage.Zero Hardcoding — 100% Data-Driven Extraction:
helpfuncbycat.xml) via an automated parallel indexer.High-Performance Multi-Core Parallel Indexer (
tools/indexer/index_docs.js):Multi-Tier Fallback Hierarchy:
help(topic)viamatlabls.handlers.hover.getHover.never), retrieves authentic documentation in <0.1ms.High-Fidelity Markdown Formatter (
HoverMarkdownUtils):helptext into structured Markdown.matlabblocks.Non-Blocking Hybrid Lifecycle (
DocumentationIndexer):matlab.indexDocumentationsetting and--indexDocumentationCLI option ('onMissing'[default],'never','always').matlabls.indexDocumentationfor on-demand re-indexing.Verification (Proof of Work)
First-indexing:


After indexing:
Key Changes Summary
src/providers/hover/HoverSupportProvider.ts: Multi-tier hover provider (MVM feval, SQLite, workspace files, local variables).src/providers/hover/HoverMarkdownUtils.ts: Authentic MATLAB help-to-Markdown parser.src/indexing/DocumentationIndexer.ts: Background non-blocking indexer service with setting callbacks.src/lifecycle/ConfigurationManager.ts&src/utils/CliUtils.ts: AddedindexDocumentationconfiguration and CLI option.src/providers/lspCommands/ExecuteCommandProvider.ts: Addedmatlabls.indexDocumentationcommand.tools/indexer/index_docs.js&tools/indexer/worker.m: Dynamic multi-core parallel indexer.matlab/+matlabls/+handlers/+hover/getHover.m: MVM engine help evaluator.tests/: 281 passing tests (100% test suite pass rate).