Search code examples
scalavimscala-metals

Manually trigger Scala Metals build import in (n)vim


As per the title, how can I manually trigger the build import query from Scala Metals in (n)vim?

Metals usually queries upon writing changes to build.sbt or related files, but when I decide to cancel to query (empty entry) or write again before the previous import is done, it fails to query again. So, I'd like to be able to manually trigger a build import. But how?


Solution

  • Assuming that you're using coc-metals (deprecated, no longer maintained)

    :CocCommand metals.build-import
    

    And in nvim-metals:

    :MetalsImportBuild