silicon.nvim
silicon.nvim copied to clipboard
Add comprehensive tree-sitter highlighting with Neovim parser integration
Working on integrating with nvim-treesitter parsers as requested in feedback.
Progress
- [x] Analyze current tree-sitter implementation that uses static parser dependencies
- [x] Research nvim-treesitter parser integration approach
- [x] Modify tree-sitter implementation to use nvim-treesitter's installed parsers dynamically
- [x] Make tree-sitter language parsers optional dependencies in Cargo.toml
- [x] Add feature flags:
builtin-parsers(default) andnvim-treesitter-only - [x] Use conditional compilation to reduce dependency footprint when needed
- [x] Update parser loading logic to check for nvim-treesitter availability first
- [x] Add helpful error messages when parsers are missing
- [x] Test both feature configurations (builtin and nvim-treesitter-only)
- [x] Update documentation with new integration options
- [ ] Reply to the user's comment
Changes Made
Cargo.toml
- Made all tree-sitter language parsers optional dependencies
- Added
builtin-parsersfeature (enabled by default) that includes all static parsers - Added
nvim-treesitter-onlyfeature for users who want to rely entirely on nvim-treesitter - Reduced dependency footprint when using
--no-default-features
Tree-sitter Integration
- Added
check_nvim_treesitter_parser()to verify parser availability in nvim-treesitter - Modified
load_nvim_treesitter_parser()to check nvim-treesitter first, then fallback to static parsers - Used conditional compilation (
#[cfg(feature = "...")]) to only include static parsers when enabled - Improved error messages that guide users to install parsers via
:TSInstallor enable features
Documentation
- Updated README.md with comprehensive nvim-treesitter integration documentation
- Documented both build options: default (builtin-parsers) and nvim-treesitter-only
- Added supported languages list and error message explanations
- Included build instructions for different configurations
Benefits
-
Reduced Dependencies: Users can now build without static parsers using
--no-default-features - nvim-treesitter Integration: Checks if parsers are available in user's nvim-treesitter installation
- Smart Fallbacks: Uses static parsers when nvim-treesitter is unavailable
- Better Error Messages: Clear guidance on how to install missing parsers
- Backward Compatibility: Default behavior unchanged (includes builtin parsers)
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.