refactor: formatting fixes, config cleanup, health simplification
Problem: Formatter disagreements in `init.lua` and `gtasks.lua`, stale `calendar` field in gcal config, and redundant health checks for data directory existence. Solution: Apply stylua formatting, remove `calendar` field from `pending.GcalConfig`, drop data-dir and no-file health messages, add `done`/`pending` to filter tab-completion candidates.
This commit is contained in:
parent
765d7fa0b5
commit
9a762a5320
5 changed files with 4 additions and 19 deletions
|
|
@ -7,7 +7,6 @@
|
|||
---@field category string
|
||||
|
||||
---@class pending.GcalConfig
|
||||
---@field calendar? string
|
||||
---@field credentials_path? string
|
||||
---@field client_id? string
|
||||
---@field client_secret? string
|
||||
|
|
|
|||
|
|
@ -25,13 +25,6 @@ function M.check()
|
|||
vim.health.info('(project-local store; global path: ' .. cfg.data_path .. ')')
|
||||
end
|
||||
|
||||
local data_dir = vim.fn.fnamemodify(resolved_path, ':h')
|
||||
if vim.fn.isdirectory(data_dir) == 1 then
|
||||
vim.health.ok('Data directory exists: ' .. data_dir)
|
||||
else
|
||||
vim.health.warn('Data directory does not exist yet: ' .. data_dir)
|
||||
end
|
||||
|
||||
if vim.fn.filereadable(resolved_path) == 1 then
|
||||
local s = store.new(resolved_path)
|
||||
local load_ok, err = pcall(function()
|
||||
|
|
@ -54,8 +47,6 @@ function M.check()
|
|||
else
|
||||
vim.health.error('Failed to load data file: ' .. tostring(err))
|
||||
end
|
||||
else
|
||||
vim.health.info('No data file yet (will be created on first save)')
|
||||
end
|
||||
|
||||
local sync_paths = vim.fn.globpath(vim.o.runtimepath, 'lua/pending/sync/*.lua', false, true)
|
||||
|
|
|
|||
|
|
@ -559,10 +559,7 @@ local function run_sync(backend_name, action)
|
|||
end
|
||||
end
|
||||
table.sort(actions)
|
||||
vim.notify(
|
||||
backend_name .. ' actions: ' .. table.concat(actions, ', '),
|
||||
vim.log.levels.INFO
|
||||
)
|
||||
vim.notify(backend_name .. ' actions: ' .. table.concat(actions, ', '), vim.log.levels.INFO)
|
||||
return
|
||||
end
|
||||
if type(backend[action]) ~= 'function' then
|
||||
|
|
|
|||
|
|
@ -372,8 +372,7 @@ function M.push()
|
|||
---@cast s pending.Store
|
||||
---@cast now_ts string
|
||||
local by_gtasks_id = build_id_index(s)
|
||||
local created, updated, deleted =
|
||||
push_pass(access_token, tasklists, s, now_ts, by_gtasks_id)
|
||||
local created, updated, deleted = push_pass(access_token, tasklists, s, now_ts, by_gtasks_id)
|
||||
s:save()
|
||||
require('pending')._recompute_counts()
|
||||
local buffer = require('pending.buffer')
|
||||
|
|
@ -419,8 +418,7 @@ function M.sync()
|
|||
local by_gtasks_id = build_id_index(s)
|
||||
local pushed_create, pushed_update, pushed_delete =
|
||||
push_pass(access_token, tasklists, s, now_ts, by_gtasks_id)
|
||||
local pulled_create, pulled_update =
|
||||
pull_pass(access_token, tasklists, s, now_ts, by_gtasks_id)
|
||||
local pulled_create, pulled_update = pull_pass(access_token, tasklists, s, now_ts, by_gtasks_id)
|
||||
s:save()
|
||||
require('pending')._recompute_counts()
|
||||
local buffer = require('pending.buffer')
|
||||
|
|
|
|||
|
|
@ -181,7 +181,7 @@ end, {
|
|||
for word in after_filter:gmatch('%S+') do
|
||||
used[word] = true
|
||||
end
|
||||
local candidates = { 'clear', 'overdue', 'today', 'priority' }
|
||||
local candidates = { 'clear', 'overdue', 'today', 'priority', 'done', 'pending' }
|
||||
local store = require('pending.store')
|
||||
local s = store.new(store.resolve_path())
|
||||
s:load()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue