aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Arcangeli <stevearc@stevearc.com>2024-07-07 18:27:01 -0700
committerSteven Arcangeli <stevearc@stevearc.com>2024-08-15 22:01:56 -0700
commit4e97712607bfdcadc097823339599e5bf05f97f9 (patch)
tree6ce8719dc02e83fd3c9a138d4f1d1716017d7c91
parent8b5e13c1af3211f5bb5e091992aba8629312e514 (diff)
doc: remove recipe for auto-detecting slow formatters
There are no significant downsides to using format_after_save. Users that are concerned about slow formatters should just use that for all of their formatters. We shouldn't be encouraging anything of this complexity.
-rw-r--r--README.md1
-rw-r--r--doc/recipes.md30
2 files changed, 0 insertions, 31 deletions
diff --git a/README.md b/README.md
index 8d9de18..ac69ec1 100644
--- a/README.md
+++ b/README.md
@@ -435,7 +435,6 @@ require("conform").formatters.shfmt = {
- [Format command](doc/recipes.md#format-command)
- [Autoformat with extra features](doc/recipes.md#autoformat-with-extra-features)
- [Command to toggle format-on-save](doc/recipes.md#command-to-toggle-format-on-save)
-- [Automatically run slow formatters async](doc/recipes.md#automatically-run-slow-formatters-async)
- [Lazy loading with lazy.nvim](doc/recipes.md#lazy-loading-with-lazynvim)
- [Leave visual mode after range format](doc/recipes.md#leave-visual-mode-after-range-format)
- [Run the first available formatter followed by more formatters](doc/recipes.md#run-the-first-available-formatter-followed-by-more-formatters)
diff --git a/doc/recipes.md b/doc/recipes.md
index 3c230b3..fe7bbd2 100644
--- a/doc/recipes.md
+++ b/doc/recipes.md
@@ -5,7 +5,6 @@
- [Format command](#format-command)
- [Autoformat with extra features](#autoformat-with-extra-features)
- [Command to toggle format-on-save](#command-to-toggle-format-on-save)
-- [Automatically run slow formatters async](#automatically-run-slow-formatters-async)
- [Lazy loading with lazy.nvim](#lazy-loading-with-lazynvim)
- [Leave visual mode after range format](#leave-visual-mode-after-range-format)
- [Run the first available formatter followed by more formatters](#run-the-first-available-formatter-followed-by-more-formatters)
@@ -108,35 +107,6 @@ end, {
})
```
-## Automatically run slow formatters async
-
-This snippet will automatically detect which formatters take too long to run synchronously and will run them async on save instead.
-
-```lua
-local slow_format_filetypes = {}
-require("conform").setup({
- format_on_save = function(bufnr)
- if slow_format_filetypes[vim.bo[bufnr].filetype] then
- return
- end
- local function on_format(err)
- if err and err:match("timeout$") then
- slow_format_filetypes[vim.bo[bufnr].filetype] = true
- end
- end
-
- return { timeout_ms = 200, lsp_format = "fallback" }, on_format
- end,
-
- format_after_save = function(bufnr)
- if not slow_format_filetypes[vim.bo[bufnr].filetype] then
- return
- end
- return { lsp_format = "fallback" }
- end,
-})
-```
-
## Lazy loading with lazy.nvim
Here is the recommended config for lazy-loading using lazy.nvim