fix(previewer): improve binary mime type check (#3083)
* fix(previewer): improve binary mime type check Problem: mime type for a ts/js file can either return `text/plain` or `application/javascript` based on the contents of the file. Previously, this meant `application/javascript` would be considered "possibly binary". This, in conjunction with how `vim.filetype.match` does not give a result for a filename that ends in `.ts`, would lead to a typescript file taking the path of `check_mime_type` and eventually `mime_hook`. Solution: Include `application/javascript` as a non-binary file type during mime type check. * [docgen] Update doc/telescope.txt skip-checks: true --------- Co-authored-by: Github Actions <actions@github>
This commit is contained in:
@@ -325,7 +325,14 @@ telescope.setup({opts}) *telescope.setup()*
|
||||
path_display can also be set to 'hidden' string to hide file names
|
||||
|
||||
path_display can also be set to a function for custom formatting of
|
||||
the path display. Example:
|
||||
the path display with the following signature
|
||||
|
||||
Signature: fun(opts: table, path: string): string, table?
|
||||
|
||||
The optional table is an list of positions and highlight groups to
|
||||
set the highlighting of the return path string.
|
||||
|
||||
Example:
|
||||
|
||||
-- Format path as "file.txt (path\to\file\)"
|
||||
path_display = function(opts, path)
|
||||
@@ -333,6 +340,24 @@ telescope.setup({opts}) *telescope.setup()*
|
||||
return string.format("%s (%s)", tail, path)
|
||||
end,
|
||||
|
||||
-- Format path and add custom highlighting
|
||||
path_display = function(opts, path)
|
||||
local tail = require("telescope.utils").path_tail(path)
|
||||
path = string.format("%s (%s)", tail, path)
|
||||
|
||||
local highlights = {
|
||||
{
|
||||
{
|
||||
0, -- highlight start position
|
||||
#path, -- highlight end position
|
||||
},
|
||||
"Comment", -- highlight group name
|
||||
},
|
||||
}
|
||||
|
||||
return path, highlights
|
||||
end
|
||||
|
||||
Default: {}
|
||||
|
||||
*telescope.defaults.borderchars*
|
||||
|
||||
Reference in New Issue
Block a user