Skip to content

How to format buffer on save (AstroNvim) #641

Closed Answered by nabiu256
nabiu256 asked this question in Q&A
Discussion options

You must be logged in to vote

neither rustaceanvim, lspconfig or mason implement format on save. It must be another plugin, like lsp-zero.

You're right! Hadn't noticed that it was AstroNvim that was configuring the format on save feature (I'm a bit rusty when it comes to nvim config).

For anyone that might find themselves in my situation, simply use AstroNvim's on_attach function in rustaceanvim's config, like so:

on_attach = function(client, bufnr)
  local astrolsp = require "astrolsp"

  -- Run AstroNvim default `on_attach` function to get regular LSP config
  astrolsp.on_attach(client, bufnr)
     
  -- other config...

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by nabiu256
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants