aboutsummaryrefslogtreecommitdiffstats
path: root/.github
diff options
context:
space:
mode:
Diffstat (limited to '.github')
-rw-r--r--.github/ISSUE_TEMPLATE/bug_report.yml112
-rwxr-xr-x.github/generate.py91
-rwxr-xr-x.github/main.py31
m---------.github/nvim_doc_tools0
-rwxr-xr-x.github/pre-commit5
-rwxr-xr-x.github/pre-push7
-rw-r--r--.github/workflows/install_nvim.sh12
-rw-r--r--.github/workflows/tests.yml65
-rw-r--r--.github/workflows/update-docs.yml35
9 files changed, 358 insertions, 0 deletions
diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml
new file mode 100644
index 0000000..de8b9ee
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/bug_report.yml
@@ -0,0 +1,112 @@
+name: Bug Report
+description: File a bug/issue
+title: "bug: "
+labels: [bug]
+body:
+ - type: markdown
+ attributes:
+ value: |
+ Before reporting a bug, make sure to search [existing issues](https://github.com/stevearc/conform.nvim/issues)
+ - type: input
+ attributes:
+ label: "Neovim version (nvim -v)"
+ placeholder: "0.8.0 commit db1b0ee3b30f"
+ validations:
+ required: true
+ - type: input
+ attributes:
+ label: "Operating system/version"
+ placeholder: "MacOS 11.5"
+ validations:
+ required: true
+ - type: textarea
+ attributes:
+ label: "Output of :checkhealth conform"
+ validations:
+ required: true
+ - type: textarea
+ attributes:
+ label: Describe the bug
+ description: A clear and concise description of what the bug is.
+ validations:
+ required: true
+ - type: textarea
+ attributes:
+ label: Steps To Reproduce
+ description: Steps to reproduce the behavior.
+ placeholder: |
+ 1. nvim -u repro.lua
+ 2.
+ 3.
+ validations:
+ required: true
+ - type: textarea
+ attributes:
+ label: Expected Behavior
+ description: A concise description of what you expected to happen.
+ validations:
+ required: true
+ - type: textarea
+ attributes:
+ label: Minimal example file
+ description: A small example file you are editing that produces the issue
+ validations:
+ required: false
+ - type: textarea
+ attributes:
+ label: Minimal init.lua
+ description:
+ Minimal `init.lua` to reproduce this issue. Save as `repro.lua` and run with `nvim -u repro.lua`
+ This uses lazy.nvim (a plugin manager).
+ value: |
+ -- DO NOT change the paths and don't remove the colorscheme
+ local root = vim.fn.fnamemodify("./.repro", ":p")
+
+ -- set stdpaths to use .repro
+ for _, name in ipairs({ "config", "data", "state", "cache" }) do
+ vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
+ end
+
+ -- bootstrap lazy
+ local lazypath = root .. "/plugins/lazy.nvim"
+ if not vim.loop.fs_stat(lazypath) then
+ vim.fn.system({
+ "git",
+ "clone",
+ "--filter=blob:none",
+ "--single-branch",
+ "https://github.com/folke/lazy.nvim.git",
+ lazypath,
+ })
+ end
+ vim.opt.runtimepath:prepend(lazypath)
+
+ -- install plugins
+ local plugins = {
+ "folke/tokyonight.nvim",
+ {
+ "stevearc/conform.nvim",
+ config = function()
+ require("conform").setup({
+ log_level = vim.log.levels.DEBUG,
+ -- add your config here
+ })
+ end,
+ },
+ -- add any other plugins here
+ }
+ require("lazy").setup(plugins, {
+ root = root .. "/plugins",
+ })
+
+ vim.cmd.colorscheme("tokyonight")
+ -- add anything else here
+ render: Lua
+ validations:
+ required: false
+ - type: textarea
+ attributes:
+ label: Additional context
+ description: Any additional information or screenshots you would like to provide
+ validations:
+ required: false
diff --git a/.github/generate.py b/.github/generate.py
new file mode 100755
index 0000000..3f4fa27
--- /dev/null
+++ b/.github/generate.py
@@ -0,0 +1,91 @@
+import os
+import os.path
+import re
+from typing import List
+
+from nvim_doc_tools import (
+ Vimdoc,
+ VimdocSection,
+ generate_md_toc,
+ parse_functions,
+ read_nvim_json,
+ render_md_api,
+ render_vimdoc_api,
+ replace_section,
+)
+
+HERE = os.path.dirname(__file__)
+ROOT = os.path.abspath(os.path.join(HERE, os.path.pardir))
+README = os.path.join(ROOT, "README.md")
+DOC = os.path.join(ROOT, "doc")
+VIMDOC = os.path.join(DOC, "conform.txt")
+
+
+def update_formatter_list():
+ formatters = sorted(
+ [
+ os.path.splitext(file)[0]
+ for file in os.listdir(os.path.join(ROOT, "lua", "conform", "formatters"))
+ ]
+ )
+ formatter_lines = ["\n"]
+ for formatter in formatters:
+ meta = read_nvim_json(f'require("conform.formatters.{formatter}").meta')
+ formatter_lines.append(
+ f"- [{formatter}]({meta['url']}) - {meta['description']}\n"
+ )
+ replace_section(
+ README,
+ r"^<!-- FORMATTERS -->$",
+ r"^<!-- /FORMATTERS -->$",
+ formatter_lines,
+ )
+
+
+def add_md_link_path(path: str, lines: List[str]) -> List[str]:
+ ret = []
+ for line in lines:
+ ret.append(re.sub(r"(\(#)", "(" + path + "#", line))
+ return ret
+
+
+def update_md_api():
+ funcs = parse_functions(os.path.join(ROOT, "lua", "conform", "init.lua"))
+ lines = ["\n"] + render_md_api(funcs, 3)[:-1] # trim last newline
+ replace_section(
+ README,
+ r"^<!-- API -->$",
+ r"^<!-- /API -->$",
+ lines,
+ )
+
+
+def update_readme_toc():
+ toc = ["\n"] + generate_md_toc(README) + ["\n"]
+ replace_section(
+ README,
+ r"^<!-- TOC -->$",
+ r"^<!-- /TOC -->$",
+ toc,
+ )
+
+
+def generate_vimdoc():
+ doc = Vimdoc("conform.txt", "conform")
+ funcs = parse_functions(os.path.join(ROOT, "lua", "conform", "init.lua"))
+ doc.sections.extend(
+ [
+ VimdocSection("API", "conform-api", render_vimdoc_api("conform", funcs)),
+ ]
+ )
+
+ with open(VIMDOC, "w", encoding="utf-8") as ofile:
+ ofile.writelines(doc.render())
+
+
+def main() -> None:
+ """Update the README"""
+ update_formatter_list()
+ update_md_api()
+ update_readme_toc()
+ generate_vimdoc()
diff --git a/.github/main.py b/.github/main.py
new file mode 100755
index 0000000..4dffddf
--- /dev/null
+++ b/.github/main.py
@@ -0,0 +1,31 @@
+#!/usr/bin/env python
+import argparse
+import os
+import sys
+
+HERE = os.path.dirname(__file__)
+ROOT = os.path.abspath(os.path.join(HERE, os.path.pardir))
+DOC = os.path.join(ROOT, "doc")
+
+
+def main() -> None:
+ """Generate docs"""
+ sys.path.append(HERE)
+ parser = argparse.ArgumentParser(description=main.__doc__)
+ parser.add_argument("command", choices=["generate", "lint"])
+ args = parser.parse_args()
+ if args.command == "generate":
+ import generate
+
+ generate.main()
+ elif args.command == "lint":
+ from nvim_doc_tools import lint_md_links
+
+ files = [os.path.join(ROOT, "README.md")] + [
+ os.path.join(DOC, file) for file in os.listdir(DOC) if file.endswith(".md")
+ ]
+ lint_md_links.main(ROOT, files)
+
+
+if __name__ == "__main__":
+ main()
diff --git a/.github/nvim_doc_tools b/.github/nvim_doc_tools
new file mode 160000
+Subproject 4260b374395d963b8ae74134908e70650f591d2
diff --git a/.github/pre-commit b/.github/pre-commit
new file mode 100755
index 0000000..49ee249
--- /dev/null
+++ b/.github/pre-commit
@@ -0,0 +1,5 @@
+#!/bin/bash
+set -e
+luacheck lua tests
+
+stylua --check .
diff --git a/.github/pre-push b/.github/pre-push
new file mode 100755
index 0000000..d117589
--- /dev/null
+++ b/.github/pre-push
@@ -0,0 +1,7 @@
+#!/bin/bash
+set -e
+luacheck lua tests
+
+stylua --check .
+
+lua-typecheck lua
diff --git a/.github/workflows/install_nvim.sh b/.github/workflows/install_nvim.sh
new file mode 100644
index 0000000..c5119dc
--- /dev/null
+++ b/.github/workflows/install_nvim.sh
@@ -0,0 +1,12 @@
+#!/bin/bash
+set -e
+PLUGINS="$HOME/.local/share/nvim/site/pack/plugins/start"
+mkdir -p "$PLUGINS"
+
+wget "https://github.com/neovim/neovim/releases/download/${NVIM_TAG}/nvim.appimage"
+chmod +x nvim.appimage
+./nvim.appimage --appimage-extract >/dev/null
+rm -f nvim.appimage
+mkdir -p ~/.local/share/nvim
+mv squashfs-root ~/.local/share/nvim/appimage
+sudo ln -s "$HOME/.local/share/nvim/appimage/AppRun" /usr/bin/nvim
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
new file mode 100644
index 0000000..ca71ef2
--- /dev/null
+++ b/.github/workflows/tests.yml
@@ -0,0 +1,65 @@
+name: Run tests
+
+on: [push, pull_request]
+
+jobs:
+ luacheck:
+ name: Luacheck
+ runs-on: ubuntu-22.04
+ steps:
+ - uses: actions/checkout@v3
+
+ - name: Prepare
+ run: |
+ sudo apt-get update
+ sudo add-apt-repository universe
+ sudo apt install luarocks -y
+ sudo luarocks install luacheck
+
+ - name: Run Luacheck
+ run: luacheck .
+
+ typecheck:
+ name: typecheck
+ runs-on: ubuntu-22.04
+ steps:
+ - uses: actions/checkout@v3
+ - uses: stevearc/nvim-typecheck-action@v1
+ with:
+ path: lua
+
+ stylua:
+ name: StyLua
+ runs-on: ubuntu-22.04
+ steps:
+ - uses: actions/checkout@v3
+ - name: Stylua
+ uses: JohnnyMorganz/stylua-action@v3
+ with:
+ token: ${{ secrets.GITHUB_TOKEN }}
+ version: v0.15.2
+ args: --check .
+
+ release:
+ name: release
+
+ if: ${{ github.ref == 'refs/heads/master' }}
+ needs:
+ - luacheck
+ - stylua
+ - typecheck
+ runs-on: ubuntu-22.04
+ steps:
+ - uses: google-github-actions/release-please-action@v3
+ id: release
+ with:
+ release-type: simple
+ package-name: conform.nvim
+ - uses: actions/checkout@v3
+ - uses: rickstaa/action-create-tag@v1
+ if: ${{ steps.release.outputs.release_created }}
+ with:
+ tag: stable
+ message: "Current stable release: ${{ steps.release.outputs.tag_name }}"
+ tag_exists_error: false
+ force_push_tag: true
diff --git a/.github/workflows/update-docs.yml b/.github/workflows/update-docs.yml
new file mode 100644
index 0000000..813e69c
--- /dev/null
+++ b/.github/workflows/update-docs.yml
@@ -0,0 +1,35 @@
+name: Update docs
+
+on: push
+
+jobs:
+ update-readme:
+ name: Update docs
+ runs-on: ubuntu-22.04
+ steps:
+ - uses: actions/checkout@v3
+ with:
+ submodules: true
+
+ - name: Install Neovim and dependencies
+ env:
+ NVIM_TAG: v0.8.3
+ run: |
+ bash ./.github/workflows/install_nvim.sh
+
+ - name: Update docs
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ COMMIT_MSG: |
+ [docgen] Update docs
+ skip-checks: true
+ run: |
+ git config user.email "actions@github"
+ git config user.name "Github Actions"
+ git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git
+ python -m pip install pyparsing==3.0.9
+ python .github/main.py generate
+ python .github/main.py lint
+ git add README.md doc
+ # Only commit and push if we have changes
+ git diff --quiet && git diff --staged --quiet || (git commit -m "${COMMIT_MSG}"; git push origin HEAD:${GITHUB_REF})