From 616343cadf95b5f1303d384be85bbc3fc3f20a02 Mon Sep 17 00:00:00 2001 From: Julius Riegel Date: Wed, 20 Mar 2024 13:12:38 +0100 Subject: [PATCH] Add efm --- content/config/efm-langserver/config.yaml | 143 ++++++++++++++++++++++ content/config/helix/languages.toml | 17 ++- content/config/nushell/scripts/ci.nu | 21 +++- silo.config.lua | 1 + 4 files changed, 174 insertions(+), 8 deletions(-) create mode 100644 content/config/efm-langserver/config.yaml diff --git a/content/config/efm-langserver/config.yaml b/content/config/efm-langserver/config.yaml new file mode 100644 index 0000000..0a010e4 --- /dev/null +++ b/content/config/efm-langserver/config.yaml @@ -0,0 +1,143 @@ +version: 2 +root-markers: + - .git/ + - package.json + - Cargo.toml +lint-debounce: 1s +commands: [] + +tools: + css-prettier: &css-prettier + format-command: './node_modules/.bin/prettier ${--tab-width:tabWidth} ${--single-quote:singleQuote} --parser css' + + csv-csvlint: &csv-csvlint + lint-command: 'csvlint' + + dockerfile-hadolint: &dockerfile-hadolint + lint-command: 'hadolint' + lint-formats: + - '%f:%l %m' + + gitcommit-gitlint: &gitcommit-gitlint + lint-command: 'gitlint' + lint-stdin: true + lint-formats: + - '%l: %m: "%r"' + - '%l: %m' + + html-prettier: &html-prettier + format-command: './node_modules/.bin/prettier ${--tab-width:tabWidth} ${--single-quote:singleQuote} --parser html' + + javascript-eslint: &javascript-eslint + lint-command: 'eslint -f visualstudio --stdin --stdin-filename ${INPUT}' + lint-ignore-exit-code: true + lint-stdin: true + lint-formats: + - "%f(%l,%c): %tarning %m" + - "%f(%l,%c): %rror %m" + + typescript-eslint: &typescript-eslint + lint-command: 'eslint -f visualstudio --stdin --stdin-filename ${INPUT}' + lint-ignore-exit-code: true + lint-stdin: true + lint-formats: + - "%f(%l,%c): %tarning %m" + - "%f(%l,%c): %rror %m" + + json-fixjson: &json-fixjson + format-command: 'fixjson' + + json-jq: &json-jq + lint-command: 'jq .' + + json-prettier: &json-prettier + format-command: './node_modules/.bin/prettier ${--tab-width:tabWidth} --parser json' + + lua-lua-format: &lua-lua-format + format-command: 'lua-format -i' + format-stdin: true + + markdown-markdownlint: &markdown-markdownlint + lint-command: 'markdownlint -s -c %USERPROFILE%\.markdownlintrc' + lint-stdin: true + lint-formats: + - '%f:%l %m' + - '%f:%l:%c %m' + - '%f: %l: %m' + + markdown-pandoc: &markdown-pandoc + format-command: 'pandoc -f markdown -t gfm -sp --tab-stop=2' + + prettierd: &prettierd + format-command: > + prettierd ${INPUT} ${--range-start=charStart} ${--range-end=charEnd} \ + ${--tab-width=tabSize} + format-stdin: true + root-markers: + - .prettierrc + - .prettierrc.json + - .prettierrc.js + - .prettierrc.yml + - .prettierrc.yaml + - .prettierrc.json5 + - .prettierrc.mjs + - .prettierrc.cjs + - .prettierrc.toml + + sh-shellcheck: &sh-shellcheck + lint-command: 'shellcheck -f gcc -x' + lint-source: 'shellcheck' + lint-formats: + - '%f:%l:%c: %trror: %m' + - '%f:%l:%c: %tarning: %m' + - '%f:%l:%c: %tote: %m' + + sh-shfmt: &sh-shfmt + format-command: 'shfmt -ci -s -bn' + format-stdin: true + + yaml-yamllint: &yaml-yamllint + lint-command: 'yamllint -f parsable -' + lint-stdin: true + +languages: + css: + - <<: *css-prettier + + csv: + - <<: *csv-csvlint + + dockerfile: + - <<: *dockerfile-hadolint + + gitcommit: + - <<: *gitcommit-gitlint + + html: + - <<: *html-prettier + + javascript: + - <<: *javascript-eslint + - <<: *prettierd + + typescript: + - <<: *typescript-eslint + + json: + - <<: *json-fixjson + - <<: *json-jq + + lua: + - <<: *lua-lua-format + + markdown: + - <<: *markdown-markdownlint + - <<: *markdown-pandoc + + sh: + - <<: *sh-shellcheck + - <<: *sh-shfmt + + yaml: + - <<: *yaml-yamllint + diff --git a/content/config/helix/languages.toml b/content/config/helix/languages.toml index 2c44edc..92b5e3a 100644 --- a/content/config/helix/languages.toml +++ b/content/config/helix/languages.toml @@ -2,36 +2,42 @@ command = "biome" args = ["lsp-proxy"] -[language-server.eslint] -command = "vscode-eslint-language-server" -args = [] +[language-server.efm] +command = "efm-langserver" [language-server.roc_lang_server] command = "roc_lang_server" args = [] + [language-server.graphql-language-service] command = "graphql-lsp" args = ["server", "-m", "stream"] + +# languages + [[language]] name = "typescript" -language-servers = ["typescript-language-server", "biome", "graphql-language-service", "eslint"] +language-servers = ["typescript-language-server", "biome", "graphql-language-service", { name = "efm", only-features = ["diagnostics", "format"]}] auto-format = true formatter = { command = "biome" , args = ["format", "--stdin-file-path=file.ts"] } indent = { tab-width = 4, unit = " " } + [[language]] name = "javascript" -language-servers = ["typescript-language-server", "biome", "eslint"] +language-servers = ["typescript-language-server", "biome", { name = "efm", only-features = ["diagnostics", "format"]}] auto-format = true formatter = { command = "biome" , args = ["format", "--stdin-file-path=file.js"] } indent = { tab-width = 4, unit = " " } + [[language]] name = "json" formatter = { command = "biome" , args = ["format", "--stdin-file-path=file.json"] } + [[language]] name = "handlebars" injection-regex = "hbs" @@ -60,6 +66,7 @@ roots = [] formatter = { command = "roc", args = ['format', '--stdin', '--stdout'] } grammar = "roc" + [[language]] name = "bash" auto-format = true diff --git a/content/config/nushell/scripts/ci.nu b/content/config/nushell/scripts/ci.nu index d3e48e0..78fc41e 100644 --- a/content/config/nushell/scripts/ci.nu +++ b/content/config/nushell/scripts/ci.nu @@ -28,15 +28,19 @@ export def info [] { # notify in background export def notify-bg [] { use task.nu - task spawn -l "ci-notify" { + task spawn -i -l "ci-notify" -g (task-group) { ci notify } } export def watch-bg [] { use task.nu - task spawn -l "ci-watch" { - ci watch + task spawn -l "ci-watch" -g (task-group) { + while (ci info | get status) != "running" { + sleep 10sec; + } + ci notify + ci watch-bg } } @@ -48,3 +52,14 @@ export def get-ci [] { "github" } } + +def task-group [] { + let name = ($env.PWD | path basename) + let groupname = $"ci-($name)" + + if not ($groupname in ...(task group | columns)) { + task group add $groupname -p 4 + } + + $groupname +} diff --git a/silo.config.lua b/silo.config.lua index 5467240..7a4337e 100644 --- a/silo.config.lua +++ b/silo.config.lua @@ -54,6 +54,7 @@ config.modules = { 'pastel', 'pueue', 'onefetch', + 'efm-langserver', }, gui = mod { 'kdePackages.breeze-icons',