Kotlin Implementation Lens

Show implementation count above Kotlin interfaces.
✨ Features
- 🔍 Visual CodeLens above every Kotlin interface showing "👁️ implementations"
- 📊 Click to navigate - Opens a quick pick with all implementations
- ⚡ Fast search using grep for instant results
- 🏗️ Multi-module support - Works perfectly with Gradle multi-module projects
- 💾 Smart caching - Results are cached for better performance
📸 Screenshots
Interface with CodeLens
👁️ implementations ← Click here!
interface UserRepository {
suspend fun findById(id: UUID): User?
suspend fun save(user: User): User
}
Quick Pick with Implementations
┌─────────────────────────────────────────────────────┐
│ Select implementation of UserRepository │
├─────────────────────────────────────────────────────┤
│ ⚫ UserRepositoryImpl │
│ in repository/UserRepositoryImpl.kt │
│ Line 29: ) : UserRepository { │
└─────────────────────────────────────────────────────┘
🚀 Usage
Method 1: CodeLens (Recommended)
- Open any Kotlin file with an interface
- Look above the
interface
keyword
- Click on "👁️ implementations"
- Select the implementation from the list
- Navigate automatically to the class!
Method 2: Command Palette
- Press
Cmd+Shift+P
(Mac) or Ctrl+Shift+P
(Windows/Linux)
- Type: "Kotlin: Show Implementations"
- Enter the interface name
- Select from the list
📋 Requirements
- VSCode: 1.60.0 or higher
- Kotlin files:
.kt
extension
- Project structure: Works best with Gradle multi-module projects
- Search tool:
grep
(pre-installed on macOS/Linux, Git Bash on Windows)
⚙️ How It Works
CodeLens Provider
The extension registers a CodeLens provider that:
- Scans all Kotlin files for
interface
declarations
- Shows a clickable lens above each interface
- On click, searches for implementations using pattern:
) : InterfaceName
Search Strategy
grep -rn ") : InterfaceName" --include="*.kt" application/src core/src
This pattern matches Kotlin implementation syntax:
class MyRepositoryImpl(
private val dependency: Dependency
) : MyRepository { // ← Found by grep!
// implementation
}
- First search: ~50-200ms (depending on project size)
- Cached results: Instant
- Multi-module: Searches only in
application/src
and core/src
directories
🎨 Configuration
Currently, the extension works out-of-the-box with sensible defaults. Future versions will include:
- Configurable search directories
- Custom search patterns
- CodeLens appearance customization
🔧 Commands
Command |
Description |
Kotlin: Show Implementations |
Manually search for implementations |
Kotlin: Clear Implementation Lens Cache |
Clear cached search results |
🐛 Troubleshooting
CodeLens not showing?
- Make sure you're viewing a
.kt
file
- Check that the file contains
interface
declarations
- Reload window:
Cmd+Shift+P
→ "Reload Window"
"No implementations found"?
- Verify the implementation exists
- Check that it uses Kotlin syntax:
) : InterfaceName {
- Ensure implementation is in
application/src
or core/src
- Try clearing cache:
Cmd+Shift+P
→ "Kotlin: Clear Implementation Lens Cache"
Extension not loading?
- Check VSCode/Cursor version (must be 1.60+)
- View Extension Host logs:
Cmd+Shift+P
→ "Developer: Show Logs" → "Extension Host"
- Look for errors related to
kotlin-implementation-lens
📦 Installation
From Marketplace (Coming Soon)
- Open Extensions:
Cmd+Shift+X
- Search: "Kotlin Implementation Lens"
- Click "Install"
Manual Installation
- Download
.vsix
file from releases
- Open Extensions:
Cmd+Shift+X
- Click
...
→ "Install from VSIX..."
- Select downloaded file
From Source
cd ~/.vscode/extensions/
git clone https://github.com/fabioods/kotlin-implementation-lens.git
cd kotlin-implementation-lens
npm install
🤝 Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Development Setup
# Clone the repository
git clone https://github.com/fabioods/kotlin-implementation-lens.git
cd kotlin-implementation-lens
# Install dependencies
npm install
# Open in VSCode
code .
# Press F5 to launch Extension Development Host
📝 Changelog
See CHANGELOG.md for release history.
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
🙏 Acknowledgments
- Built for the Kotlin community
- Special thanks to all contributors
🔗 Links
💡 Tips & Tricks
Keyboard Shortcut
Add a custom keybinding for quick access:
{
"key": "cmd+shift+i",
"command": "kotlin-implementation-lens.showImplementations"
}
Task Integration
Create a VSCode task for terminal-based search:
{
"label": "Find Kotlin Implementations",
"type": "shell",
"command": "grep -rn ') : ${input:interfaceName}' --include='*.kt' ."
}
🌟 Star History
If you find this extension useful, please consider giving it a ⭐ on GitHub!
Made with ❤️ for the Kotlin community