scaladex.nvim
scaladex.nvim copied to clipboard
Neovim and Telescope plugin to search the scaladex index
scaladex.nvim
This neovim plugin serves two purposes:
- It provides a library that you can
requireand query the scaladex index - A Telescope extension that allows you to search the scaladex index and add a dependency to your project or look at the dependencies page on scaladex.
Requirements
Supports
Installation
Using packer:
Add the following to your init.lua:
use { 'nvim-telescope/telescope.nvim', requires = { { 'nvim-lua/popup.nvim' }, { 'nvim-lua/plenary.nvim' } } }
use { 'softinio/scaladex.nvim' }
Require the extension:
require('telescope').load_extension('scaladex')
Add a mapping to open search box:
vim.api.nvim_set_keymap('n', '<leader>si', [[<cmd>lua require('telescope').extensions.scaladex.scaladex.search()<cr>]], { noremap = true, silent = true })
Sample PR updating my config.
Usage
Telescope
- Open search (if above mapping set that would be your
<leader>key andsi) - Enter package you are searching for and press enter, e.g.
cats - Select artifact
- From the results panel select the one you are interested in, then:
| Keyboard | What it does |
|---|---|
<C-s> |
Opens the browser, scaladex page for the package you selected |
<C-R> (i.e. enter) |
Copies to your clipboard what you need to add to your build file to add dependency to your project |
Use as a Library
To import library
local scaladex = require'scaladex'
Functions available
search(search_term, targeted_platform, scala_version): searches scaladex for the term you want to search for.targeted_platformdefaults to "JVM" andscala_versiondefaults to2.13when not provided with function call.- Returns a list of possible projects matching your
search_term
- Returns a list of possible projects matching your
get_project(organization, repository)- returns all details of a specific project from scaladexorganizationis the github organizationrepositoryis the project/repository name within the organization
Examples
Search
-- search for 'cats'
scaladex.search('cats')
Get Project
-- get details of 'cats' library
scaladex.get_project('typelevel', 'cats')
Demo and Video Tutorial on using scaladex.nvim
Support and Help
Have a question or want to discuss anything related to this project? Start a Discussion
Have a problem, a bug or a feature request? Make an issue or PR welcome
Development
git clone [email protected]:softinio/scaladex.nvim.git
cd scaladex.nvim
nvim --cmd "set rtp+=$(pwd)"
To Do
- [ ] add some unit tests
- [ ] make rest calls async using plenary
- [ ] add support for
scala-cli - [ ] add support for
mavenandgradle - [ ] cache search history and add telescope option to browse history
- [ ] add ability to choose platform
- [ ] add ability to choose older versions of a library