-
Notifications
You must be signed in to change notification settings - Fork 43
/
efmls-configs.txt
117 lines (88 loc) · 3.88 KB
/
efmls-configs.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
INTRODUCTION *efmls-configs* *efmls*
An unofficial collection of linters and formatters configured for
efm-langserver to work with the builtin nvim-lsp.
Check out |efmls-configs-supported| for a list of supported languages.
TABLE OF CONTENTS
SETUP ......................................... |efmls-configs-setup|
DEFAULT CONFIGURATIONS ..................... |efmls-configs-defaults|
TROUBLESHOOTING ..................... |efmls-configs-troubleshooting|
EFM-LANGSERVER SCHEMA ........................ |efmls-configs-schema|
SUPPORTED LINTERS AND FORMATTERS .......... |efmls-configs-supported|
SETUP *efmls-configs-setup*
To get started, make a `languages` table that define the
linters/formatters for the language. Or use the defaults
provided by this plugin if you don't want to list for
each language.
>lua
-- Register linters and formatters per language
local languages = {
typescript = {
require('efmls-configs.linters.eslint'),
require('efmls-configs.formatters.prettier'),
},
lua = {
require('efmls-configs.formatters.stylua'),
},
}
-- Or use the defaults provided by this plugin
-- check doc/SUPPORTED_LIST.md for all the defaults provided
--
-- local languages = require('efmls-configs.defaults').languages()
local efmls_config = {
filetypes = vim.tbl_keys(languages),
settings = {
rootMarkers = { '.git/' },
languages = languages,
},
init_options = {
documentFormatting = true,
documentRangeFormatting = true,
},
}
require('lspconfig').efm.setup(vim.tbl_extend('force', efmls_config, {
-- Pass your cutom config below like on_attach and capabilities
--
-- on_attach = on_attach,
-- capabilities = capabilities,
}))
<
DEFAULT CONFIGURATIONS *efmls-configs-defaults*
Default configurations are an opt-in feature.
To see all the configurations provided by default go to
https://github.com/creativenull/efmls-configs-nvim/blob/main/doc/SUPPORTED_LIST.md
You can use a list of defaults provided by this plugin, in-case
you don't want to specify configuration for each language.
>lua
local languages = require('efmls-configs.defaults').languages()
<
To extend and add additional tools or to override existing
defaults registered:
>lua
local languages = require('efmls-configs.defaults').languages()
languages = vim.tbl_extend('force', languages, {
-- you custom languages, or overrides
html = {
require('efmls-configs.formatters.prettier')
}
})
<
TROUBLESHOOTING *efmls-configs-issues*
Always run `:checkhealth` to see if there are any issue, when you
get no response from the linter or formatter as you expected.
If you get "no executable found" issues in `:checkhealth`,
this means that the linter or formatter was not found in the provided
filepath. Ensure that it is installed globally or in a valid filepath.
For nodejs/npm, php/composer, ruby/bundler: check if the linter or
formatter is installed in your node_modules (npm), vendor
(composer/bundler) project folder, or installed globally.
MASON *efmls-configs-mason*
If you use mason, then you don't need to add anything extra for
efmls-configs for it to work. But if you are having problems setting
up then check the following:
1. Make sure you call mason `setup()` before efm `setup()`
2. Run `:!which <tool>` to check if the path is provided by mason
EFM-LANGSERVER SCHEMA FILE *efmls-configs-schema*
https://github.com/mattn/efm-langserver/blob/master/schema.json
SUPPORTED LINTERS AND FORMATTERS *efmls-configs-supported*
https://github.com/creativenull/efmls-configs-nvim/blob/main/doc/SUPPORTED_LIST.md
vim:tw=78:ts=8:noet:ft=help:norl: