Skip to content

olisikh/scala-hints.nvim

Repository files navigation

scala-hints.nvim

Opinionated Neovim diagnostics + quickfix code actions for ZIO, Cats-Effect (IO/Resource), and Cats tagless-final (F[_]) Scala code.

Demo

Demo

Features

  • 90 Treesitter patterns detecting common effect code smells with idiomatic replacements
    • 35 ZIO patterns
    • 40 Cats-Effect patterns
    • 15 Cats tagless-final patterns
  • Native diagnostics & code actions via vim.diagnostic.set() and LSP handler
  • Metals-aware — type verification ensures replacements only apply to actual effect types
  • Evidence-gated — tagless-final patterns verify typeclass bounds in enclosing def signatures
  • Configurable severity — set each pattern as HINT, INFO, WARN, ERROR, or OFF

Requirements

Installation

lazy.nvim:

{
  'olisikh/scala-hints.nvim',
  opts = {},
  dependencies = {
    'nvim-lua/plenary.nvim',
    'scalameta/nvim-metals',
  },
}

Usage

  1. Open a Scala file with Metals running
  2. Diagnostics appear automatically (default: HINT severity)
  3. Apply fixes via :lua vim.lsp.buf.code_action() or your keymap

Commands

Command Description
:ScalaHintsApplyBuffer Apply all fixes in the current buffer

Configuration

require('scala-hints').setup({
  diagnostics = {
    default_severity = 'HINT',
    overrides = {
      ['zio/zip_left_value'] = 'OFF',
      ['zio/zio_die'] = 'WARN',
    },
  },
})

See Configuration for all options.

Documentation

Full documentation is available on the Wiki:

Troubleshooting

  • No diagnostics? Wait for Metals to initialize (MetalsReady / MetalsInitialized)
  • Diagnostics disappear after undo? Reopen the buffer or save to refresh

Contributing

See AGENTS.md for architecture details and the pattern addition guide.

References

About

Neovim plugin that helps writing better Scala FP code

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published