|
2 | 2 |
|
3 | 3 | set -e
|
4 | 4 |
|
5 |
| -"$(dirname "$0")/go_install.sh" github.com/mattn/efm-langserver@latest |
| 5 | +"$(dirname "$0")/go_install.sh" github.com/mattn/efm-langserver@latest && |
| 6 | +CONFIG="$HOME/.config/efm-langserver/config.yaml" && |
| 7 | +if ! [ -e "$CONFIG" ]; then |
| 8 | + mkdir -p "$(dirname "$CONFIG")" && |
| 9 | + { |
| 10 | + # config copied from: |
| 11 | + # https://github.com/mattn/efm-langserver/blob/c7ef2b16238a9561893daa0121769ca37f258356/README.md |
| 12 | + cat <<EFM_CONFIG >"$CONFIG" |
| 13 | +version: 2 |
| 14 | +root-markers: |
| 15 | + - .git/ |
| 16 | +lint-debounce: 1s |
| 17 | +commands: |
| 18 | + - command: notepad |
| 19 | + arguments: |
| 20 | + - ${INPUT} |
| 21 | + title: メモ帳 |
| 22 | +
|
| 23 | +tools: |
| 24 | + any-excitetranslate: &any-excitetranslate |
| 25 | + hover-command: 'excitetranslate' |
| 26 | + hover-stdin: true |
| 27 | +
|
| 28 | + blade-blade-formatter: &blade-blade-formatter |
| 29 | + format-command: 'blade-formatter --stdin' |
| 30 | + format-stdin: true |
| 31 | +
|
| 32 | + css-prettier: &css-prettier |
| 33 | + format-command: './node_modules/.bin/prettier ${--tab-width:tabWidth} ${--single-quote:singleQuote} --parser css' |
| 34 | +
|
| 35 | + csv-csvlint: &csv-csvlint |
| 36 | + lint-command: 'csvlint' |
| 37 | +
|
| 38 | + dockerfile-hadolint: &dockerfile-hadolint |
| 39 | + lint-command: 'hadolint' |
| 40 | + lint-formats: |
| 41 | + - '%f:%l %m' |
| 42 | +
|
| 43 | + eruby-erb: &eruby-erb |
| 44 | + lint-debounce: 2s |
| 45 | + lint-command: 'erb -x -T - | ruby -c' |
| 46 | + lint-stdin: true |
| 47 | + lint-offset: 1 |
| 48 | + format-stdin: true |
| 49 | + format-command: htmlbeautifier |
| 50 | +
|
| 51 | + html-prettier: &html-prettier |
| 52 | + format-command: './node_modules/.bin/prettier ${--tab-width:tabWidth} ${--single-quote:singleQuote} --parser html' |
| 53 | +
|
| 54 | + javascript-eslint: &javascript-eslint |
| 55 | + lint-command: 'eslint -f visualstudio --stdin --stdin-filename ${INPUT}' |
| 56 | + lint-ignore-exit-code: true |
| 57 | + lint-stdin: true |
| 58 | + lint-formats: |
| 59 | + - "%f(%l,%c): %tarning %m" |
| 60 | + - "%f(%l,%c): %rror %m" |
| 61 | +
|
| 62 | + json-fixjson: &json-fixjson |
| 63 | + format-command: 'fixjson' |
| 64 | +
|
| 65 | + json-jq: &json-jq |
| 66 | + lint-command: 'jq .' |
| 67 | +
|
| 68 | + json-prettier: &json-prettier |
| 69 | + format-command: './node_modules/.bin/prettier ${--tab-width:tabWidth} --parser json' |
| 70 | +
|
| 71 | + lua-lua-format: &lua-lua-format |
| 72 | + format-command: 'lua-format -i' |
| 73 | + format-stdin: true |
| 74 | +
|
| 75 | + make-checkmake: &make-checkmake |
| 76 | + lint-command: 'checkmake' |
| 77 | + lint-stdin: true |
| 78 | +
|
| 79 | + markdown-markdownlint: &markdown-markdownlint |
| 80 | + lint-command: 'markdownlint -s -c %USERPROFILE%\.markdownlintrc' |
| 81 | + lint-stdin: true |
| 82 | + lint-formats: |
| 83 | + - '%f:%l %m' |
| 84 | + - '%f:%l:%c %m' |
| 85 | + - '%f: %l: %m' |
| 86 | +
|
| 87 | + markdown-pandoc: &markdown-pandoc |
| 88 | + format-command: 'pandoc -f markdown -t gfm -sp --tab-stop=2' |
| 89 | +
|
| 90 | + mix_credo: &mix_credo |
| 91 | + lint-command: "mix credo suggest --format=flycheck --read-from-stdin ${INPUT}" |
| 92 | + lint-stdin: true |
| 93 | + lint-formats: |
| 94 | + - '%f:%l:%c: %t: %m' |
| 95 | + - '%f:%l: %t: %m' |
| 96 | + root-markers: |
| 97 | + - mix.lock |
| 98 | + - mix.exs |
| 99 | +
|
| 100 | + php-phpstan: &php-phpstan |
| 101 | + lint-command: './vendor/bin/phpstan analyze --error-format raw --no-progress' |
| 102 | +
|
| 103 | + php-psalm: &php-psalm |
| 104 | + lint-command: './vendor/bin/psalm --output-format=emacs --no-progress' |
| 105 | + lint-formats: |
| 106 | + - '%f:%l:%c:%trror - %m' |
| 107 | + - '%f:%l:%c:%tarning - %m' |
| 108 | +
|
| 109 | + python-autopep8: &python-autopep8 |
| 110 | + format-command: 'autopep8 -' |
| 111 | + format-stdin: true |
| 112 | +
|
| 113 | + python-black: &python-black |
| 114 | + format-command: 'black --quiet -' |
| 115 | + format-stdin: true |
| 116 | +
|
| 117 | + python-flake8: &python-flake8 |
| 118 | + lint-command: 'flake8 --stdin-display-name ${INPUT} -' |
| 119 | + lint-stdin: true |
| 120 | + lint-formats: |
| 121 | + - '%f:%l:%c: %m' |
| 122 | +
|
| 123 | + python-isort: &python-isort |
| 124 | + format-command: 'isort --quiet -' |
| 125 | + format-stdin: true |
| 126 | +
|
| 127 | + python-mypy: &python-mypy |
| 128 | + lint-command: 'mypy --show-column-numbers' |
| 129 | + lint-formats: |
| 130 | + - '%f:%l:%c: %trror: %m' |
| 131 | + - '%f:%l:%c: %tarning: %m' |
| 132 | + - '%f:%l:%c: %tote: %m' |
| 133 | +
|
| 134 | + python-pylint: &python-pylint |
| 135 | + lint-command: 'pylint --output-format text --score no --msg-template {path}:{line}:{column}:{C}:{msg} ${INPUT}' |
| 136 | + lint-stdin: false |
| 137 | + lint-formats: |
| 138 | + - '%f:%l:%c:%t:%m' |
| 139 | + lint-offset-columns: 1 |
| 140 | + lint-category-map: |
| 141 | + I: H |
| 142 | + R: I |
| 143 | + C: I |
| 144 | + W: W |
| 145 | + E: E |
| 146 | + F: E |
| 147 | +
|
| 148 | + python-yapf: &python-yapf |
| 149 | + format-command: 'yapf --quiet' |
| 150 | + format-stdin: true |
| 151 | +
|
| 152 | + rst-lint: &rst-lint |
| 153 | + lint-command: 'rst-lint' |
| 154 | + lint-formats: |
| 155 | + - '%tNFO %f:%l %m' |
| 156 | + - '%tARNING %f:%l %m' |
| 157 | + - '%tRROR %f:%l %m' |
| 158 | + - '%tEVERE %f:%l %m' |
| 159 | +
|
| 160 | + rst-pandoc: &rst-pandoc |
| 161 | + format-command: 'pandoc -f rst -t rst -s --columns=79' |
| 162 | +
|
| 163 | + sh-shellcheck: &sh-shellcheck |
| 164 | + lint-command: 'shellcheck -f gcc -x' |
| 165 | + lint-source: 'shellcheck' |
| 166 | + lint-formats: |
| 167 | + - '%f:%l:%c: %trror: %m' |
| 168 | + - '%f:%l:%c: %tarning: %m' |
| 169 | + - '%f:%l:%c: %tote: %m' |
| 170 | +
|
| 171 | + sh-shfmt: &sh-shfmt |
| 172 | + format-command: 'shfmt -ci -s -bn' |
| 173 | + format-stdin: true |
| 174 | +
|
| 175 | + vim-vint: &vim-vint |
| 176 | + lint-command: 'vint -' |
| 177 | + lint-stdin: true |
| 178 | + lint-formats: |
| 179 | + - '%f:%l:%c: %m' |
| 180 | +
|
| 181 | + yaml-yamllint: &yaml-yamllint |
| 182 | + lint-command: 'yamllint -f parsable -' |
| 183 | + lint-stdin: true |
| 184 | +
|
| 185 | +languages: |
| 186 | + blade: |
| 187 | + - <<: *blade-blade-formatter |
| 188 | +
|
| 189 | + css: |
| 190 | + - <<: *css-prettier |
| 191 | +
|
| 192 | + csv: |
| 193 | + - <<: *csv-csvlint |
| 194 | +
|
| 195 | + dockerfile: |
| 196 | + - <<: *dockerfile-hadolint |
| 197 | +
|
| 198 | + elixir: |
| 199 | + - <<: *mix_credo |
| 200 | +
|
| 201 | + eruby: |
| 202 | + - <<: *eruby-erb |
| 203 | +
|
| 204 | + html: |
| 205 | + - <<: *html-prettier |
| 206 | +
|
| 207 | + javascript: |
| 208 | + - <<: *javascript-eslint |
| 209 | +
|
| 210 | + json: |
| 211 | + - <<: *json-fixjson |
| 212 | + - <<: *json-jq |
| 213 | + # - <<: *json-prettier |
| 214 | +
|
| 215 | + lua: |
| 216 | + - <<: *lua-lua-format |
| 217 | +
|
| 218 | + make: |
| 219 | + - <<: *make-checkmake |
| 220 | +
|
| 221 | + markdown: |
| 222 | + - <<: *markdown-markdownlint |
| 223 | + - <<: *markdown-pandoc |
| 224 | +
|
| 225 | + php: |
| 226 | + - <<: *php-phpstan |
| 227 | + - <<: *php-psalm |
| 228 | +
|
| 229 | + python: |
| 230 | + - <<: *python-black |
| 231 | + - <<: *python-flake8 |
| 232 | + - <<: *python-isort |
| 233 | + - <<: *python-mypy |
| 234 | + # - <<: *python-autopep8 |
| 235 | + # - <<: *python-yapf |
| 236 | +
|
| 237 | + rst: |
| 238 | + - <<: *rst-lint |
| 239 | + - <<: *rst-pandoc |
| 240 | +
|
| 241 | + sh: |
| 242 | + - <<: *sh-shellcheck |
| 243 | + - <<: *sh-shfmt |
| 244 | +
|
| 245 | + vim: |
| 246 | + - <<: *vim-vint |
| 247 | +
|
| 248 | + yaml: |
| 249 | + - <<: *yaml-yamllint |
| 250 | +
|
| 251 | + =: |
| 252 | + - <<: *any-excitetranslate |
| 253 | +EFM_CONFIG |
| 254 | + } |
| 255 | +fi |
0 commit comments