This neovim plugin serves two purposes:
- It provides a library that you can
require
and 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.
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.
- 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 |
local scaladex = require'scaladex'
search(search_term, targeted_platform, scala_version)
: searches scaladex for the term you want to search for.targeted_platform
defaults to "JVM" andscala_version
defaults to2.13
when 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 scaladexorganization
is the github organizationrepository
is the project/repository name within the organization
-- search for 'cats'
scaladex.search('cats')
-- get details of 'cats' library
scaladex.get_project('typelevel', 'cats')
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
git clone git@github.com:softinio/scaladex.nvim.git
cd scaladex.nvim
nvim --cmd "set rtp+=$(pwd)"
- add some unit tests
- make rest calls async using plenary
- add support for
scala-cli
- add support for
maven
andgradle
- cache search history and add telescope option to browse history
- add ability to choose platform
- add ability to choose older versions of a library