nvim-telescope / telescope.nvim

Find, Filter, Preview, Pick. All lua, all the time.
MIT License
16.04k stars 838 forks source link

`smartcase` doesn't work when searching non-latin filenames #3337

Open RobberFox opened 1 month ago

RobberFox commented 1 month ago

Description

When using telescope builtin find_files for filenames in non-latin languages, the smartcase option doesn't work. image Here I have to explicitly type the uppercase Ф,П characters

P.S. I use neovim for note-taking and some of my filenames are in non-latin langages (armenian, russian, etc.)

Neovim version

NVIM v0.11.0-dev-532+gc9b129a02
Build type: RelWithDebInfo
LuaJIT 2.1.1720049189

Operating system and version

Debian Linux 12 x86_64

Telescope version / branch / rev

0.1.x

checkhealth telescope

==============================================================================
telescope: require("telescope.health").check()

Checking for required plugins ~
- OK plenary installed.
- OK nvim-treesitter installed.

Checking external dependencies ~
- OK rg: found ripgrep 14.1.0 (rev e50df40a19)
- OK fd: found fdfind 8.6.0

===== Installed extensions ===== ~

Telescope Extension: `fzf` ~
- OK lib working as expected
- OK file_sorter correctly configured
- OK generic_sorter correctly configured

Telescope Extension: `ui-select` ~
- No healthcheck provided

Steps to reproduce

  1. nvim -nu minimal.lua
  2. :Telescope find_files and search in lowercase (say функ дирих) for a filename in non-latin language, like Функция-Дирихле.md

Expected behavior

I would expect the smartcase behaviour to work in non-latin languages the same way it does in english. So, func diric pattern matches a filename Function-Dirichlet.md and функ дирих is expected to match Функция-Дирихле.md

Actual behavior

функ дирих doesn't match Функция-Дирихле.md

Minimal config

local root = vim.fn.fnamemodify("./.repro", ":p")

-- set stdpaths to use .repro
for _, name in ipairs { "config", "data", "state", "cache" } do
    vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end

-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.uv.fs_stat(lazypath) then
    vim.fn.system {
        "git",
        "clone",
        "--filter=blob:none",
        "https://github.com/folke/lazy.nvim.git",
        lazypath,
    }
end
vim.opt.runtimepath:prepend(lazypath)

-- install plugins
local plugins = {
    {
        "nvim-telescope/telescope.nvim",
        dependencies = {
            "nvim-lua/plenary.nvim",
        },
        config = function()
            -- ADD INIT.LUA SETTINGS THAT ARE _NECESSARY_ FOR REPRODUCING THE ISSUE
            require("telescope").setup {}
        end,
    },

    {
        'nvim-treesitter/nvim-treesitter',
        build = ':TSUpdate',
        opts = {
            ensure_installed = { 'markdown', 'markdown_inline' }, -- to avoid errors
        },
        config = function(_, opts)
            require('nvim-treesitter.configs').setup(opts)
        end,
    },
}

require("lazy").setup(plugins, {
    root = root .. "/plugins",
})
SappyJoy commented 3 weeks ago

Also saw this behavior. Switched to fd, but it didn't help

  pickers = {
    find_files = {
      find_command = { 'fd', '--type', 'f', '--ignore-case', '--hidden', '--strip-cwd-prefix' },
    },
  },

image

However in shell fd show case-insensitive result.

~/notes/vault-13
❯ fd --type f --ignore-case "что"
Во что поиграть.md
Что делать после установки Fedora.md
Что посмотреть.md
Что почитать.md