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

fix(preview): update mime-type check for json files (#2221) #2480

Merged
merged 2 commits into from
May 14, 2023
Merged

fix(preview): update mime-type check for json files (#2221) #2480

merged 2 commits into from
May 14, 2023

Conversation

KevinSilvester
Copy link
Contributor

@KevinSilvester KevinSilvester commented Apr 25, 2023

Description

Fix JSON files without file extensions being treated as non-text files as its MIME type is application\json.
The current implementation splits the output of the file command and only uses the first item of the split output to check if file reviewable.

Also manually setting opt.ft to json for syntax highlighting as plenary.filetype.detect is unable to recognize JSON files without file extension

Issue #2221

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

Create a JSON file with no file extension and some dummy data

{
   "dummy": "data"
}
  • Telescope find_files and verify the file is previewable and syntax highlight is working

Configuration:

  • Neovim version (nvim --version): NVIM v0.9.0
  • Operating system and version: Windows 11 version 22H2 (Build No: 22621, Arch: x86_64)

Checklist:

  • My code follows the style guidelines of this project (stylua)
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (lua annotations)

@Conni2461
Copy link
Member

thanks :)

@Conni2461 Conni2461 merged commit 89c6767 into nvim-telescope:master May 14, 2023
8 checks passed
Conni2461 pushed a commit that referenced this pull request May 14, 2023
abelmul pushed a commit to abelmul/telescope.nvim that referenced this pull request Jun 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants