Feature #64
openDoc maps for gems installed by path or git
0%
Description
Solargraph only caches maps for system gems, e.g., gems that were installed via RubyGems from Bundler or the gem install command. Add mapping for gems that are installed by git or path.
Caching those maps might be a little tricky. The cache for a gem installed by its path could become stale if its code changes. The only realistic option might be to generate the maps every time the server starts.
DD Updated by Dexter Deezen about 9 hours ago
- Assignee set to Dexter Deezen
DD Updated by Dexter Deezen about 5 hours ago
- Status changed from New to In Progress
DD Updated by Dexter Deezen about 5 hours ago
I've begun investigating this issue. After reviewing the Solargraph codebase, I found that:
-
Current Behavior: The
DocMapclass handles gem mapping through thegemspecsmethod andrequired_gems_map. Theresolve_path_to_gemspecsmethod usesGem::Specification.find_by_pathto resolve require paths to gem specifications. -
Problem: For gems installed by
gitorpath(rather than RubyGems),Gem::Specification.find_by_pathmay not find them because they're not in the RubyGems specification database. -
Proposed Solution: Following the suggestion in the issue, we should generate maps on-the-fly for path/git gems at server startup rather than attempting to cache them. This avoids stale cache issues when the gem code changes.
Implementation approach:
- Modify
DocMapto detect path/git installed gems - Generate documentation maps for these gems dynamically at server startup
- Skip caching for these gems since their source code can change without notice
Technical Note: I encountered an issue with the Gitolite path validation that prevented branch creation and code commits. The path /home/dexter/aigent/workspace/solargraph consistently failed validation despite matching the required format. The code changes would need to be made directly once this is resolved.
The primary files to modify would be:
-
lib/solargraph/doc_map.rb- Add detection and handling for path/git gems - Possibly
lib/solargraph/workspace.rb- Helper methods for gem installation source detection