Open madtrick opened 1 year ago
Hey @madtrick sorry for the late reply. Honestly it's really hard to tell. What I'd recommend is taking a very minimal config where you don't have any other plugins installed and only start with nvim-metals. Then see if you still have the issue. Start slowing adding plugins back in to see if there is maybe some interaction between plugins that isn't playing nicely.
Since I've gotten no more info I'm going to go ahead and close. Feel free to report back if you're still having this issue and I can open back up.
Hey @ckipp01 apologies for not getting back to you earlier. For now I switched to VSCode to do some Scala. Will report back once I get back to nvim, if I keep having this issue.
I am also facing the same issue. If the .scalafmt file is not present, current buffer is almost useless as you cant see anything...
local lsp_group = vim.api.nvim_create_augroup("lsp", { clear = true })
return {
"scalameta/nvim-metals",
ft = { "scala", "sbt", "sc" },
config = function()
local metals_config = require("metals").bare_config()
metals_config.settings = {
showImplicitArguments = true,
excludedPackages = { "akka.actor.typed.javadsl", "com.github.swagger.akka.javadsl" },
}
metals_config.on_attach = function(client, bufnr)
require("plugins.lsp.keys").setup(client, bufnr)
vim.api.nvim_create_autocmd("CursorHold", {
callback = vim.lsp.buf.document_highlight,
buffer = bufnr,
group = lsp_group,
})
vim.api.nvim_create_autocmd("CursorMoved", {
callback = vim.lsp.buf.clear_references,
buffer = bufnr,
group = lsp_group,
})
vim.api.nvim_create_autocmd({ "BufEnter", "CursorHold", "InsertLeave" }, {
callback = vim.lsp.codelens.refresh,
buffer = bufnr,
group = lsp_group,
})
end
metals_config.capabilities = require("cmp_nvim_lsp").default_capabilities()
local nvim_metals_group = vim.api.nvim_create_augroup("nvim-metals", { clear = true })
vim.api.nvim_create_autocmd("FileType", {
pattern = { "scala", "sbt", "java" },
callback = function()
require("metals").initialize_or_attach(metals_config)
end,
group = nvim_metals_group,
})
end,
}
my config for metals.
I am also facing the same issue. If the .scalafmt file is not present, current buffer is almost useless as you cant see anything...
Hey @chetankokil, could you expand a bit more on this? When this window pops up it should give you three options to choose between. Is there a reason you're unable to select any of the 3 options, or what is happening in your case?
hey @ckipp01 when the window shows up, its not auto focused, is the first thing and the other thing is whatever you do, you cant even manually focus on that window. basically forcing one to close the buffer or possibly the window.
Probably the best way to reproduce is to have a project without .scalafmt file and then opening in with lazyvim.
I'm facing the same problem. Any UI other than neovim's native UI stops responding in the same context.
I tried with these two plugins:
@ckipp01 here's an example
With dressing.nvim enable:
https://github.com/scalameta/nvim-metals/assets/22376151/0f4d3932-071e-4a58-98ea-b498f6ae835a
With dressing.nvim disable:
https://github.com/scalameta/nvim-metals/assets/22376151/d22956be-2f0f-48f0-a326-4ec8831018d5
Thanks @phrmendes . how did you disable dressing.nvim just for scala project ?
So thanks a lot for the videos! I'm still having a hard time reproducing this. The funny thing is that I also use dressing and don't have any issues with this:
https://github.com/scalameta/nvim-metals/assets/13974112/4c483fdf-1cc4-4174-9160-8875905c781c
Are you able to try and create a minimal standalone config that only has nvim-metals and dressing and see if that has the same behavior? There could be some odd interaction going with another plugin that is causing this.
I'll go ahead and reopen this since multiple people in here seem to be hitting on this.
i had this problem as well. Here's some more info as to how i resolved it:
1) i used the kitty terminal and the issue where when the popup came up about scalafmt, it would be in the center front of my nvim but would not be clickable or interactable. The only way i was able to remove it was to close the window if i was in tmux or close my terminal program entirely (on another attempt, I realized that I was able to enter into normal mode to quit neovim to get out of it instead). This happened regardless if I was ssh'd into another instance or via local, as long as it was in kitty terminal.
I tried this in the default macos terminal and got the same problem as well. I did not attempt to try to find if other terminals had this issue as well.
As recommended during my debugging, i disabled all my plugins. I am also using the lazyvim nvim editor (lazyvim.org).
When i disabled { import = "lazyvim.plugins.extras.lang.scala" }
under lazy.lua
, the popup does not appear and all works fine (except the fact that all scala assistnace is also disabled). With the plugin re-enabled, the popup appears when scalafmt is not available on save and it causes the buffer to become unusable.
2) i noticed in your video (@ckipp01 ), that you used wezterm. I installed that and reran the above tests and the scalafmt popup was interactiveable and closeable from the bare minimal config all the way to re-enabling all my original plugins.
OS: macOS 14.4 NVIM: v0.9.5 nvim-metals commit: 4f9bf0c821092f20dd34c1a4ea5b07b0500ff089
Edit:
I was able to give this a try on windows terminal (OS: windows 11), and the same issue occured where the floating popup is not interactable.
However, on ubuntu 23.04, default terminal, the floating popup was interactable.
I tried using windows terminal, and ssh'd into the ubuntu instance, same test, and the window is interactable. maybe its more on an OS level?
I'm also having the same issue. I'm on linux with customized st term.
Having same issue:
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 20.04.6 LTS
Release: 20.04
Codename: focal
NVIM info:
NVIM v0.9.5
Build type: Release
LuaJIT 2.1.1692716794
system vimrc file: "$VIM/sysinit.vim"
fall-back for $VIM: "/__w/neovim/neovim/build/nvim.AppDir/usr/share/nvim"
Run :checkhealth for more info
And I am using built-in ubuntu terminal. I have the same issue with Iterm2 on MAC as well with the same nvim configs.
I have the same issue on neovim nightly using telescope-ui-select
NVIM v0.10.0-dev-4461+gca735c755-Homebrew
Build type: Release
LuaJIT 2.1.1713773202
system vimrc file: "$VIM/sysinit.vim"
fall-back for $VIM: "/opt/homebrew/Cellar/neovim/HEAD-ca735c7/share/nvim"
I've tried to reproduce using minimal.lua with the following lazy config
lazy.setup({
{
"nvim-lua/telescope.nvim",
dependencies = {
"nvim-telescope/telescope-ui-select.nvim",
},
config = function()
local telescope = require("telescope")
local themes = require("telescope.themes")
telescope.setup({
extensions = {
["ui-select"] = themes.get_cursor(),
},
})
telescope.load_extension("ui-select")
end
},
{
"scalameta/nvim-metals",
dependencies = { "nvim-lua/plenary.nvim", },
ft = { "scala", "sbt", "java" },
opts = function()
local metals_config = require("metals").bare_config()
metals_config.settings = {
showImplicitArguments = true,
excludedPackages = { "akka.actor.typed.javadsl", "com.github.swagger.akka.javadsl" },
}
return metals_config
end,
config = function(self, metals_config)
local nvim_metals_group = vim.api.nvim_create_augroup("nvim-metals", { clear = true })
vim.api.nvim_create_autocmd("FileType", {
pattern = self.ft,
callback = function()
require("metals").initialize_or_attach(metals_config)
end,
group = nvim_metals_group,
})
end
}
}, { root = data_path, state = data_path .. '/lazy-state.json', lockfile = data_path .. '/lazy-lock.json' })
This seems to work and I don't get the unresponsive window behaviour anymore so will try and narrow down what part of my config could be causing the problem.
I have the same issue on Neovim v0.10.0 on Mac using Wezterm, I got to reproduce the issue using the plugins:
This is my init.lua
local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim'
if not vim.loop.fs_stat(lazypath) then
local lazyrepo = 'https://github.com/folke/lazy.nvim.git'
vim.fn.system { 'git', 'clone', '--filter=blob:none', '--branch=stable', lazyrepo, lazypath }
end ---@diagnostic disable-next-line: undefined-field
vim.opt.rtp:prepend(lazypath)
require('lazy').setup {
{
'nvim-telescope/telescope.nvim',
event = 'VimEnter',
branch = '0.1.x',
dependencies = {
'nvim-lua/plenary.nvim',
{ 'nvim-telescope/telescope-ui-select.nvim' },
},
config = function()
require('telescope').setup {
extensions = {
['ui-select'] = {
require('telescope.themes').get_dropdown(),
},
},
}
pcall(require('telescope').load_extension, 'ui-select')
end,
},
{
'scalameta/nvim-metals',
dependencies = {
'nvim-lua/plenary.nvim',
},
ft = { 'scala', 'sbt' },
opts = function()
local metals_config = require('metals').bare_config()
metals_config.settings = {
showImplicitArguments = true,
}
metals_config.on_attach = function() end
return metals_config
end,
config = function(self, metals_config)
local nvim_metals_group = vim.api.nvim_create_augroup('nvim-metals', { clear = true })
vim.api.nvim_create_autocmd('FileType', {
pattern = self.ft,
callback = function()
require('metals').initialize_or_attach(metals_config)
end,
group = nvim_metals_group,
})
end,
},
{
'stevearc/conform.nvim',
opts = {
format_on_save = function(bufnr)
return {
lsp_fallback = true,
}
end,
},
},
So if I try to save a change to any file on a scala project that doesn't have scalafmt.conf the popup appears but Neovim is in insert mode and there is no way to interact with the popup (as others have shown in this thread).
For now, to circumvent this issue I am running :lua vim.lsp.buf.format()
before saving, this shows the popup but this time, I can interact with it.
I'm experiencing the same problem when opening project without scalafmt.conf.
I'm on MacOS Sonoma 14.0 NVIM v0.10.0 Build type: Release LuaJIT 2.1.1713484068
Using Lazy and Iterm2.
Also happens on Alacritty with tmux
Seeing this as well using LazyVim and iTerm2
It seems triggering a format on save brings up the floating window which hangs until an LSP timeout reported ("Warning [LSP][metals] timeout") and the buffer drops down into insert mode.
A workaround is to trigger :lua vim.lsp.buf.format()
manually (or via the LazyVim template mapping of leader, c, f) When triggered manually,the timeout still happens, but the hover window stays open and eventually unfreezes allowing interaction and creation of a default .scalafmt.conf file.
Seeing this as well using LazyVim and iTerm2
It seems triggering a format on save brings up the floating window which hangs until an LSP timeout reported ("Warning [LSP][metals] timeout") and the buffer drops down into insert mode.
A workaround is to trigger
:lua vim.lsp.buf.format()
manually (or via the LazyVim template mapping of leader, c, f) When triggered manually,the timeout still happens, but the hover window stays open and eventually unfreezes allowing interaction and creation of a default .scalafmt.conf file.
I'm also dealing with this problem and this workaround worked for me.
My neovim config: https://github.com/Psuedoo/kickstart.nvim/
Same here, lazy and wezterm.
Describe the bug
I recently installed
nvim-metals
(withlazy.vim
). Here's my config:Now, after saving a
scala
file, there's a brief moment where neovim is unresponsive after which a popup shows atimeout
message and an overlay window shows a warning aboutscalafmt
. My biggest issue at the time is that I can't find a way to take an action on that window. I can't select any of the options (can't even focus on it and change the selected option) and can't close it.This might not be an issue with
nvim-metals
itself but you might be able to point me into the right direction 🙂Expected behavior
scala
fileOperating system
macOS
Version of Metals
v1.1.0
Commit of nvim-metals
6692a65