feat: detect ghostty config files by canonical path (#7)

* feat: detect ghostty config files by canonical path

Problem: enabled() only checked for the 'ghostty' filetype, but many
users have ghostty config files detected as 'config' or with no
filetype set. These users got no completions.

Solution: check canonical ghostty config directories
($XDG_CONFIG_HOME/ghostty, ~/.config/ghostty, /etc/ghostty) when the
filetype is 'config' or empty, resolving symlinks to handle indirect
paths.

* fix: revert blanket diagnostics.disable and selene comments

Problem: .luarc.json blanket-disabled four diagnostic categories
project-wide, and selene inline directives were added to suppress
warnings on io.open monkey-patching in tests.

Solution: revert .luarc.json to match main and remove selene comments.

* fix(ci): resolve selene and lua-ls CI failures

Problem: selene flags io.open assignments in test mocks as
incorrect_standard_library_use, and lua-ls reports undefined blink.cmp
types and a need-check-nil on enums_cache. These are pre-existing
issues on main that surface when Lua files change.

Solution: add targeted selene allow comments on the two io.open
mock lines, add minimal blink.cmp type stubs for lua-ls, and
include enums_cache in the nil guard.
This commit is contained in:
Barrett Ruth 2026-02-20 20:56:26 -05:00 committed by GitHub
parent dfbae31684
commit b5b18520d7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 79 additions and 2 deletions

View file

@ -10,9 +10,31 @@ function M.new()
return setmetatable({}, { __index = M })
end
local ghostty_config_dirs = {
vim.fn.expand('$XDG_CONFIG_HOME/ghostty'),
vim.fn.expand('$HOME/.config/ghostty'),
'/etc/ghostty',
}
---@return boolean
function M.enabled()
return vim.bo.filetype == 'ghostty'
if vim.bo.filetype == 'ghostty' then
return true
end
if vim.bo.filetype ~= 'config' and vim.bo.filetype ~= '' then
return false
end
local path = vim.api.nvim_buf_get_name(0)
if path == '' then
return false
end
local real = vim.uv.fs_realpath(path) or path
for _, dir in ipairs(ghostty_config_dirs) do
if real:find(dir, 1, true) == 1 then
return true
end
end
return false
end
---@return blink.cmp.CompletionItem[]
@ -81,7 +103,7 @@ end
---@param callback fun(response: blink.cmp.CompletionResponse)
---@return fun()
function M:get_completions(ctx, callback)
if not keys_cache then
if not keys_cache or not enums_cache then
keys_cache = parse_keys()
enums_cache = parse_enums()
end