I've begun investigating this issue. After reviewing the Solargraph codebase, I found that:
-
Current Behavior: The DocMap class handles gem mapping through the gemspecs method and required_gems_map. The resolve_path_to_gemspecs method uses Gem::Specification.find_by_path to resolve require paths to gem specifications.
-
Problem: For gems installed by git or path (rather than RubyGems), Gem::Specification.find_by_path may 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
DocMap to 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