Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev3 #85

Merged
merged 12 commits into from
Nov 30, 2024
Merged

Dev3 #85

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 0 additions & 30 deletions .github/workflows/busted.yml

This file was deleted.

40 changes: 40 additions & 0 deletions .github/workflows/mini-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Run tests

on:
push:
branches-ignore: [ sync, stable ]
paths: [ 'colors/**', 'lua/**', 'tests/**' ]
pull_request:
branches-ignore: [ sync, stable ]
paths: [ 'colors/**', 'lua/**', 'tests/**' ]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.actor }}
cancel-in-progress: true

jobs:
build:
name: Run tests
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
neovim_version: ['v0.10.2', 'nightly']
include:
- os: macos-latest
neovim_version: v0.10.1
- os: windows-latest
neovim_version: v0.10.1
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v4
- name: Setup neovim
uses: rhysd/action-setup-vim@v1
with:
neovim: true
version: ${{ matrix.neovim_version }}

- name: Run tests
run: make test
15 changes: 15 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Run all test files
test: build
nvim --headless --noplugin -u ./scripts/minimal_init.lua -c "lua MiniTest.run()"

build: deps/mini.nvim
nvim --headless --noplugin -u ./scripts/deps.lua

# Run test from file at `$FILE` environment variable
test_file: build
nvim --headless --noplugin -u ./scripts/minimal_init.lua -c "lua MiniTest.run_file('$(FILE)')"

# Download 'mini.nvim' to use its 'mini.test' testing module
deps/mini.nvim:
@mkdir -p deps
git clone --filter=blob:none https://github.com/echasnovski/mini.nvim $@
3 changes: 3 additions & 0 deletions feed.nvim-scm-1.rockspec
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ dependencies = {
"nui.nvim",
"pathlib.nvim",
"plenary.nvim",
"tree-sitter-markdown",
"tree-sitter-html",
"tree-sitter-xml",
}

test_dependencies = {
Expand Down
36 changes: 22 additions & 14 deletions lua/feed.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,38 @@ M.setup = function(usr_config)
cmds._sync_feedlist()
end

local render = require "feed.ui"
M.get_entry = render.get_entry
local ui = require "feed.ui"
M.get_entry = ui.get_entry

M.register_command = function(name, doc, context, f, key)
local ut = require "feed.utils"
local cmds = require "feed.commands"
cmds[name] = {
impl = f,
doc = doc,
context = context,
}
if key then
if context["all"] then
vim.keymap.set("n", key, ut.wrap(f))
local function map()
local buf = vim.api.nvim_get_current_buf()
vim.keymap.set("n", key, f, { silent = true, noremap = true, buffer = buf })
end
if context["index"] then
if render.index then
vim.keymap.set("n", key, ut.wrap(f), { buffer = render.index })
end
end
if context["entry"] then
if render.entry then
vim.keymap.set("n", key, ut.wrap(f), { buffer = render.entry }) -- TODO:??
end
if context.all then
vim.keymap.set("n", key, f, { silent = true, noremap = true })
elseif context.index and context.entry then
vim.api.nvim_create_autocmd("User", {
pattern = { "FeedIndex", "FeedEntry" },
callback = map,
})
elseif context.index then
vim.api.nvim_create_autocmd("User", {
pattern = "FeedIndex",
callback = map,
})
elseif context.entry then
vim.api.nvim_create_autocmd("User", {
pattern = "FeedEntry",
callback = map,
})
end
end
end
Expand Down
Loading
Loading