Comments (5)
I have noticed something similar too, namely when trying to auto format on save, it isn't formatting. Guessing this is related?
yes, probably, that's how I noticed it too. I think it's common to have code like this
-- Autoformatting on save
if client.supports_method(“textDocument/formatting”) then
vim.api.nvim_create_autocmd(“BufWritePre”, {
buffer = bufnr,
callback = function()
vim.lsp.buf.format({ bufnr = bufnr })
end,
})
end
which runs in the lsps on_attach. Thats is currently not working. As a workaround I removed the check
if client.supports_method(“textDocument/formatting”) then
for flutter/dart.
from flutter-tools.nvim.
I have noticed something similar too, namely when trying to auto format on save, it isn't formatting. Guessing this is related?
from flutter-tools.nvim.
Close the opened flutter buffer, and reopen it.
Then all the supports_method check will pass, and inlay_hint will show correctly.
It's weird, but works.
from flutter-tools.nvim.
I think this is related to neovim/neovim#23681, now document formatting, code actions, and inlay hints have the property dynamicRegistration=true
. If I set it to false
here https://github.com/akinsho/flutter-tools.nvim/blob/990a1349c29f7d474a0cd51355aba773ccc9deea/lua/flutter-tools/lsp/init.lua#L95 or in local config then client.supports_method(“textDocument/formatting”)
returns true. But I am not sure what is the correct fix here...
from flutter-tools.nvim.
I investigated this a bit more, here is more information about the problem: neovim/neovim#24229
It is not enough now to check capabilities on LspAttach
, it may return false
, but then the capability may be registered dynamically and the next check will return true
.
Workarounds for this may be to switch back to static registration:
flutter_tools.setup {
lsp = {
capabilities = {
textDocument = { formatting = { dynamicRegistration = false } },
},
}
Or do additional check in client/registerCapability
handler:
local orig_handler = vim.lsp.handlers["client/registerCapability"]
vim.lsp.handlers["client/registerCapability"] = function(err, result, ctx)
local orig_result = orig_handler(err, result, ctx)
-- do something
return orig_result
end
As this is not a plugin bug I will close this issue.
from flutter-tools.nvim.
Related Issues (20)
- [BUG] lsp code actions not loading in nvim 0.10 HOT 1
- lsp-dart vs flutter-tools HOT 3
- LSP Inlay Hints HOT 2
- [Feature] Pre-run callback in `setup_project{}`
- [BUG] Closing Tags/labesl not working/displaying HOT 2
- How disable view type value HOT 1
- [BUG] "error drawing label" when cut a large block of code HOT 7
- [Question] Newlines in autocompletion? HOT 2
- [Help/Feature Request] Select a default device + launch configuration to not select them on every FlutterRun HOT 4
- Feature Request: FlutterEmulators: Please show ERROR in messages if fail to start emulator
- [BUG] Buffer is not 'modifiable' HOT 1
- [BUG] multiple development certificates cant be selected
- [Feature Request] Show and load emulators installed with Genymotion HOT 1
- [BUG] Can't spawn Dart LSP HOT 8
- Can i open dev_log with new tab kitty or :FlutterDevLogToggle ? HOT 1
- Dart library 'dart:ui' is not available on this platform HOT 2
- [BUG] flatten() requires a list-like table HOT 1
- [Question] Is there way to open the flutter run on new tab instead of creating a split window? HOT 2
- [BUG] Flutter project recognition not reliable HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flutter-tools.nvim.