summaryrefslogtreecommitdiff
path: root/lua/lang/scala.lua
diff options
context:
space:
mode:
authorChristian Chiarulli <[email protected]>2021-07-24 21:17:11 -0400
committerGitHub <[email protected]>2021-07-24 21:17:11 -0400
commit98f8a77819670ce6012216e01885c135a6d3a289 (patch)
treeb655da889c33e0eb89251878783700a8cd014a27 /lua/lang/scala.lua
parent0884dcd84670bc097c34253e983d2cde9c209dfa (diff)
New contract (#1080)
Changes to the global config object O is now lvim user_plugins is now plugins user_autocommands is now autocommands No more lang specific plugins Null-ls has replaced both formatter.nvim and nvim-lint
Diffstat (limited to 'lua/lang/scala.lua')
-rw-r--r--lua/lang/scala.lua80
1 files changed, 0 insertions, 80 deletions
diff --git a/lua/lang/scala.lua b/lua/lang/scala.lua
deleted file mode 100644
index 081c74bf..00000000
--- a/lua/lang/scala.lua
+++ /dev/null
@@ -1,80 +0,0 @@
-local M = {}
-
-M.config = function()
- O.lang.scala = {
- metals = {
- active = false,
- server_version = "0.10.5",
- excluded_packages = {},
- show_implicit_arguments = false,
- show_inferred_type = true,
- status_bar_provider = false,
- },
- formatter = {
- exe = "scalafmt",
- args = { "--stdin" },
- stdin = true,
- },
- }
-end
-
-M.format = function()
- O.formatters.filetype["scala"] = {
- function()
- return {
- exe = O.lang.scala.formatter.exe,
- args = O.lang.scala.formatter.args,
- stdin = O.lang.scala.formatter.stdin,
- }
- end,
- }
- O.formatters.filetype["sbt"] = O.formatters.filetype["scala"]
- -- To understand sbt files on stdin, scalafmt needs to assume any old filename
- -- that ends in .sbt. Using a dummy filename instead of the actual one is
- -- required to support buffers of sbt filetype without the extension.
- O.formatters.filetype["sbt"].args = { "--stdin", "--assume-filename", "foo.sbt" }
-
- require("formatter.config").set_defaults {
- logging = false,
- filetype = O.formatters.filetype,
- }
-end
-
-M.lint = function()
- -- TODO: implement linters (if applicable)
- return "No linters configured!"
-end
-
-M.lsp = function()
- -- enable metal server integration
- if O.lang.scala.metals.active then
- vim.g["metals_server_version"] = O.lang.scala.metals.server_version
- -- https://github.com/scalameta/nvim-metals#prerequisites
- vim.opt_global.shortmess:remove("F"):append "c"
- local metals_config = require("metals").bare_config
- metals_config.on_attach = function()
- require("completion").on_attach()
- end
- metals_config.handlers["textDocument/publishDiagnostics"] =
- vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
- virtual_text = {
- prefix = "",
- },
- })
- metals_config.settings = {
- showImplicitArguments = O.lang.scala.metals.show_implicit_arguments,
- showInferredType = O.lang.scala.metals.show_inferred_type,
- excludedPackages = O.lang.scala.metals.excluded_packages,
- }
- metals_config.init_options.statusBarProvider = O.lang.scala.metals.status_bar_provider
- require "lsp"
- require("metals").initialize_or_attach(metals_config)
- end
-end
-
-M.dap = function()
- -- TODO: implement dap
- return "No DAP configured!"
-end
-
-return M