1
0
Fork 0
mirror of https://github.com/jiriks74/presence.nvim synced 2025-06-23 12:58:58 +02:00

Support more files and update default asset

- Use `code` instead of `file` as default asset
- Check filename before extension in file asset assignment
- Support a lot more files and file extensions
This commit is contained in:
Andrew Kwon 2021-04-04 17:22:53 -07:00
parent c61fd0f7ae
commit 41c1221cad
2 changed files with 62 additions and 2 deletions
lua/presence

View file

@ -392,13 +392,16 @@ function Presence:update_for_buffer(buffer, should_debounce)
local extension = self.get_file_extension(filename)
local parent_dirpath = self.get_dir_path(buffer)
self.log:debug(string.format("Parsed filename %s with %s extension", filename, extension or "no"))
-- Determine image text and asset key
local name = filename
local asset_key = "file"
local asset_key = "code"
local description = filename
local file_asset = extension and file_assets[extension] or file_assets[filename]
local file_asset = file_assets[filename] or file_assets[extension]
if file_asset then
name, asset_key, description = unpack(file_asset)
self.log:debug(string.format("Using file asset: %s", vim.inspect(file_asset)))
end
local file_text = description or name