Git Product home page Git Product logo

smart-open.nvim's Introduction

smart-open.nvim

A telescope.nvim extension designed to provide the best possible suggestions for quickly opening files in Neovim. smart-open will improve its suggestions over time, adapting to your usage.

Warning ⚠️ smart-open is beta at this time. Contributions welcome.

Preview

Isn't this yet another fuzzy file finding plugin?

In a way, but most other solutions require multiple mappings to search:

  • git files
  • open buffers
  • recent files

The goal of smart-open is to give you highly relevant results with as few keystrokes as possible--so much so that only a single mapping is needed for searching everything while still managing to be quick about it.

How it works

The source of suggestions is a combination of files under the current working directory, and your history. Ranking takes the following factors into account:

  • How well the file path matches the search text
  • How well the file name matches the search text (see notes for file name details)
  • Recency of last open
  • Whether the file is the last-edited (that is, alternate buffer)
  • The file is currently open
  • How close the file's parent directory is to the currently-open file's
  • "Frecency" - how frequently the file has been opened, with a bias toward recent opens. (See notes on frecency)
  • Whether the file is anywhere under the current working directory. This is especially useful if using an extension that cd's to your project's top-level directory.

This ranking algorithm is self-tuning. Over time, the weights of the factors above will be adjusted based upon your interaction with it. The tuning process is especially sensitive to selecting a suggestion that is not at the top. Weights will be adjusted relative to the higher-ranked suggestions that were not selected.

Calculating and tuning all these factors might sound slow, but this is not the case. Results return quickly and the impact of these calculations are optimized to be negligible.

Notes

  • In certain cases, both the parent directory as well as the filename are treated as the "file name". This is because for some file structures, the filename itself isn't informative. For example, if your JavaScript project uses the convention of directoryName/index.js throughout, then searching for "index" isn't going to be very useful. As a result, we treat index.js and init.lua as special cases, and treat parentDirectory/filename as though it were the filename.
  • Search text matching uses the fzy algorithm. If telescope-fzy-native is installed, it will be used.
  • Determining how close two files' directories are is just a function of how many directories the two files have in common. This means that for any pair of files in the same directory, the score is more significant the deeper that directory is.
  • Frecency controls how long a given file is preserved in history. While it can be replenished by opening that file, this value otherwise dwindles over time. When the value is fully depleted, the file can be cleared from the history, improving performance and disk usage. Frecency uses an implementation of Mozilla's Frecency algorithm (used in Firefox's address bar).

Acknowledgements

  • Thanks to telescope-frecency.nvim for inspiration. This code is also adapted from that code base.

Using an implementation of Mozilla's Frecency algorithm (used in Firefox's address bar), files edited frecently are given higher precedence in the list index.

As the extension learns your editing habits over time, the sorting of the list is dynamically altered to prioritize the files you're likely to need.

Requirements

Timestamps, scoring weights, and file records are stored in an SQLite3 database for persistence and speed.

Installation

Put the following in your lazy.setup(...):

{
  "danielfalk/smart-open.nvim",
  branch = "0.2.x",
  config = function()
    require("telescope").load_extension("smart_open")
  end,
  dependencies = {
    "kkharji/sqlite.lua",
    -- Only required if using match_algorithm fzf
    { "nvim-telescope/telescope-fzf-native.nvim", build = "make" },
    -- Optional.  If installed, native fzy will be used when match_algorithm is fzy
    { "nvim-telescope/telescope-fzy-native.nvim" },
  },
}
use {
  "danielfalk/smart-open.nvim",
  branch = "0.2.x",
  config = function()
    require"telescope".load_extension("smart_open")
  end,
  requires = {
    {"kkharji/sqlite.lua"},
    -- Only required if using match_algorithm fzf
    { "nvim-telescope/telescope-fzf-native.nvim", run = "make" },
    -- Optional.  If installed, native fzy will be used when match_algorithm is fzy
    { "nvim-telescope/telescope-fzy-native.nvim" },
  }
}

sqlite3 (required)

sqlite3 must be installed locally. (if you are on mac it might be installed already)

Windows

Download precompiled and set let g:sqlite_clib_path = path/to/sqlite3.dll (note: /)

Linux

Arch
sudo pacman -S sqlite # Arch
sudo apt-get install sqlite3 libsqlite3-dev # Ubuntu
Fedora
sudo dnf install sqlite sqlite-devel sqlite-tcl

Nix (home-manager)

programs.neovim.plugins = [
    {
      plugin = pkgs.vimPlugins.sqlite-lua;
      config = "let g:sqlite_clib_path = '${pkgs.sqlite.out}/lib/libsqlite3.so'";
    }
];

If no database is found when running Neovim with the plugin installed, a new one is created and entries from shada v:oldfiles are automatically imported.

Usage

:Telescope smart_open

..or to map to a key:

vim.keymap.set("n", "<leader><leader>", function ()
  require("telescope").extensions.smart_open.smart_open()
end, { noremap = true, silent = true })

Options

Options can be set when opening the picker. For example:

require('telescope').extensions.smart_open.smart_open {
  cwd_only = true,
  filename_first = false,
}
  • cwd_only (default: false)

    Limit the results to files under the current working directory. This is normally not needed because if you prefer this pattern of access, then the plugin will pick up on that over time regardless, to the point where files under cwd will be recommended above all others.

  • filename_first (default: true)

    Format filename as "filename path/to/parent/directory" if true and "path/to/parent/directory/filename" if false.

Configuration

See default configuration for full details on configuring Telescope.

  • show_scores (default : false)

    To see the scores generated by the algorithm in the results, set this to true.

  • ignore_patterns (default: {"*.git/*", "*/tmp/*"})

    Patterns in this table control which files are indexed (and subsequently which you'll see in the finder results).

  • match_algorithm (default: fzy)

    The algorithm to use for determining how well each file path matches the typed-in search text. Options are fzf and fzy. Entered text is not the only factor considered in ranking but is typically the most significant.

  • disable_devicons (default: false)

    Disable devicons (if available)

  • open_buffer_indicators (default: {previous = "•", others = "∘"})

Example Configuration:

telescope.setup {
  extensions = {
    smart_open = {
      match_algorithm = "fzf",
      disable_devicons = false,
    },
  },
}

Known Limitations

For files not already in your history, smart-open uses ripgrep for scanning the current directory. (The command is roughly: rg --files --glob-case-insensitive --hidden --ignore-file=<cwd>/.ff-ignore -g <ignore_patterns...>).

As a result, files added to git, but also ignored by git, will not be included. While not common, this is something that git allows. If this becomes a problem you can work around it by either changing your git ignore patterns, editing the file in neovim in some other way, (thereby adding it to the history), or by using ripgrep's .ignore file for overriding git.

Highlight Groups

Directory

smart-open.nvim's People

Contributors

abosnjakovic avatar barklan avatar danielfalk avatar dlvhdr avatar martinbjeldbak avatar nikolam-dev avatar nisalvd avatar samwindell avatar titouancreach avatar yodaembedding avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

smart-open.nvim's Issues

config method is required even with lazy.nvim

Hello I spent time trying to figure out why is the plugin was not working (:Telescope smart_open was not available).
I put:

 config = function()
    require"telescope".load_extension("smart_open")
  end, 

this line (from the section packer), in the lazy block, and it started to work.
I'm not a pro regarding the neovim package manager, but the config block might be required in lazy.nvim :)

ps: I use Lazy.nvim in the "lunarvim" context so it could have some magic happening

When no input, show recent files first

Hello
I believe that when we open a project, and just open :Telescope smart_open, the most "interesting" / "smart" choice we can have is the recent file rather than the files with the high score. But I understand it's a matter of opinion. (I think this is what vscode is doing) :)

Path name is truncated (and inconsistently)

It seems sometimes the filepath is truncated, for example, I have a file in tools/foobar_query_benchmark/main.go
And when I type in bench/main I can find the file but the path was truncated. At the same time, other file with longer path doesn't get truncated.
image

I wonder if there is a way to configure so that either:

  1. Everything is truncated based on an consistent length limit, or
  2. Allow the user to disable the truncation

Again, thanks for the plugin I'm already enjoying the quickness when working on a large codebase.

Not all files are searchable?

I'm in a rather large monorepo, and it seems the max number of files indexed is 6505.

My monorepo has multiples of tens of thousands of files 🙃

But anywho, I can type in full paths in to the smart-open box, and the file won't show up.


Update:

ah ha, I found this in the README:

max_unindexed (default: 6500)

Stop scanning the current directory when max_unindexed files have been found. This limit is in place to prevent performance problems when run from a directory with an excessive number of files under it.

So I need to make this something like 100_000 🙃

cwd_only including items outside working directory

          I found an issue, I _really_ need the search to be contained to the `cwd`. searching outside of the `cwd` has _only_ caused problems for me 😢 

image

on the main branch,
this was enough to keep the search scoped to the cwd

nnoremap <C-t> :lua require('telescope').extensions.smart_open.smart_open({cwd_only = true})<CR>

is there a way to regain this narrowing of scope?

Originally posted by @NullVoxPopuli in #22 (comment)

Add ability to pass in picker options through telescope setup

I would like to customize smart-open like so:

telescope.setup({
  extensions = {
    smart_open = {
      preview = { hide_on_startup = true },
      layout_config = {
        width = 0.65,
      },
      mappings = {
        i = {
          ["<esc>"] = require("telescope.actions").close,
        },
      },
    },
  },

Many plugins allow passing in these standard telescope picker options

Devicons highlighting is broken on nvim nightly

Devicons with smart_open isn't highlighted whereas find_files does.

Minimal repro:

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

-- 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.loop.fs_stat(lazypath) then
  vim.fn.system({
    "git",
    "clone",
    "--filter=blob:none",
    "--single-branch",
    "https://github.com/folke/lazy.nvim.git",
    lazypath,
  })
end
vim.opt.runtimepath:prepend(lazypath)

-- install plugins
local plugins = {
  -- do not remove the colorscheme!
  "folke/tokyonight.nvim",
  -- add any other pugins here
  {
    "nvim-telescope/telescope.nvim",
    opts = true,
    dependencies = {
      {
        "danielfalk/smart-open.nvim",
        config = function()
          require("telescope").load_extension("smart_open")
        end,
      },
      "kkharji/sqlite.lua",
      "nvim-lua/plenary.nvim",
      "nvim-tree/nvim-web-devicons",
    },
    keys = {
      { "<leader>ff", "<cmd>Telescope smart_open<CR>" },
    },
  },
}
require("lazy").setup(plugins, {
  root = root .. "/plugins",
})

-- add anything else here
vim.opt.termguicolors = true
-- do not remove the colorscheme!
vim.cmd([[colorscheme tokyonight]])

Option to hide open buffer indicators

Really cool plugin. Thank you!
Similiar to oldfiles in telescope. Would be nice to have a configuration to hide the open_buffer_indicators. Personally I don't find it helpful. It might be just me :)

Dropping sqlite like telescope-frecency?

Hi,
Recently I saw that telescope-frecency has dropped the sqlite3 requirement, and since this plugin was inspired by that I wonder if it is considered to follow/borrow from it and drop this requirement as well.

I tried telescope-frecency and see it faster to startup as well, however I still like the "smart" search of this plugin.

Thanks for the plugin.

Error when starting

Below errors are thrown when I start the smart open through Telescope

Error executing vim.schedule lua callback: .../smart-open.nvim/lua/smart-open/util/priority_insert.lua:9: attempt to compare nil with number                                          
stack traceback:                                                                                                                                                                      
        .../smart-open.nvim/lua/smart-open/util/priority_insert.lua:9: in function 'priority_insert'                                                                                  
        ...m/lua/telescope/_extensions/smart_open/finder/finder.lua:94: in function ''                                                                                                
        vim/_editor.lua: in function <vim/_editor.lua:0>                                                                                                                              

Weird thing is this only happen for this specific CWD while in other projects it's working fine.

I'm on the 0.2.x branch

Custom highlight group for directories

Currently, the plugin uses the builtin highlight group Directory to highlight directories. Would you accept a PR that introduces a custom hlgroup such as SmartOpenDirectory (or any other name you might suggest) that would link to Directory by default? This would allow users to redefine the highlight only for the plugin, not globally, e.g. to a different hlgroup such as Comment.

Error on 0.2 branch when opening and the picker list contains an entry with no name

I noticed this bug appearing recently, if the results list contains a directory then the result does not have a name, which seems to trigger the error message.

Screenshot 2023-05-10 at 07 58 19
Screenshot 2023-05-10 at 07 59 39


Also, more generally, when opening I often see the Press ENTER or type command to continue message and the picker isn't populated until I press enter, this is not accompanied by any error - I'm not sure if this is related and only seems to happen when opening for the first time:

Screenshot 2023-05-10 at 07 57 40

EDIT: Actually, for this second issue, it seems that it's triggered by a warning: 🎥 example

Current buffer is excluded

Not sure if this is intended but it seems the file opened in the current buffer is excluded from the search result. While I understand the reason of doing so I'm still wondering if there is a way to toggle such behavior? I would like to just using the same keystroke to open any file at any time.

Thanks

`Error executing luv callback` in a large project

whenever I execute

nnoremap <C-t> :lua require('telescope').extensions.smart_open.smart_open({cwd_only = true})<CR>

(aka Ctrl + t), I get this error:

Error executing luv callback:
...telescope/_extensions/smart_open/display/entry_maker.lua:94: attempt to perform arithmetic on local 'max_frecency_score' (
a nil value)
stack traceback:
        ...telescope/_extensions/smart_open/display/entry_maker.lua:94: in function 'entry_maker'
        ...m/lua/telescope/_extensions/smart_open/finder/finder.lua:34: in function 'on_insert'
        ...im/lua/telescope/_extensions/smart_open/file_scanner.lua:78: in function <...im/lua/telescope/_extensions/smart_op
en/file_scanner.lua:66>
        [C]: at 0x559809c92b5a
        [C]: in function 'pcall'
        ...ck/packer/start/telescope.nvim/lua/telescope/pickers.lua:381: in function 'find'
        ...pen.nvim/lua/telescope/_extensions/smart_open/picker.lua:59: in function 'start'
        ...smart-open.nvim/lua/telescope/_extensions/smart_open.lua:22: in function 'smart_open'
        [string ":lua"]:1: in main chunk}

Highlighting doesn't seem to work right when using fzf sorter

The fzf sorter seems to break when you have a whitespace in your search. it begins to highlight correctly, but as soon as you have a space you do not get both parts highlighted right.

As you can see below, it also breaks sometimes even on queries with no space for some reason:

no space:
image

space:
image

Devicons are uncolored

here is how it looks like with smart open:
Pasted image 2023-01-14 22 19 44

and here how it looks like with the other telescope pickers:
Pasted image 2023-01-14 22 20 18

Crash related to Windows directory separtor

Thanks for making this, I'm finding it very useful.

On Windows I am getting a crash: attempting to perform arithmetic on a nil value "last"

Here is the code causing the issue.

function M.get_pos(path)
local last, penultimate, current
local k = 0
repeat
penultimate = last
last = current
current, k = path:find("/", k + 1, true)
until current == nil
return is_index_filename[path:sub(last + 1, path:len())] and penultimate + 1 or last + 1
end

The variable last is still nil at the end of the function because on Windows, the path separator is \ instead of /. If I changed "/" into "\\" the error is fixed.

So I believe that all we need to do is change the directory separator depending on if Windows or not.

Error on load extension

The error:

Error detected while processing :source (no file):                                                                                            
E5108: Error executing lua ...im/site/pack/packer/start/sqlite.lua/lua/sqlite/defs.lua:55: libsqlite3.so: cannot open shared object file: No such file 
or directory
stack traceback:
        [builtin#203]: at 0x55f830986100
        ...im/site/pack/packer/start/sqlite.lua/lua/sqlite/defs.lua:55: in main chunk
        [C]: in function 'require'
        ...m/site/pack/packer/start/sqlite.lua/lua/sqlite/utils.lua:252: in function '__index'
        ...nvim/site/pack/packer/start/sqlite.lua/lua/sqlite/db.lua:662: in main chunk
        [C]: in function 'require'
        ...im/site/pack/packer/start/sqlite.lua/lua/sqlite/init.lua:66: in function '__index'
        ...n.nvim/lua/telescope/_extensions/smart_open/dbclient.lua:27: in function 'new'
        ...smart-open.nvim/lua/telescope/_extensions/smart_open.lua:52: in function 'setup'
        .../start/telescope.nvim/lua/telescope/_extensions/init.lua:64: in function 'load_extension'
        [string ":source (no file)"]:11: in main chunk

How the plugin is installed:

    use {
        "danielfalk/smart-open.nvim",
        requires = {
            { "tami5/sqlite.lua" },
            { 'kyazdani42/nvim-web-devicons', opt = true },
        }
    }

relevant part of my after/plugin/telescope.lua

telescope.load_extension("smart_open")
vim.keymap.set("n", "<Leader><Leader>", telescope.extensions.smart_open.smart_open)

Space in search prompt

Hey, cool plugin!

I was wondering, how the matching handles spaces in the search. I often use them to match different parts of the path of a files path, like this:

  • mat mod to match path/to/match/mod.rs
  • test sub ex to match path/test/submodule/example.rs

With smart open, there are no files shown at all in this case. In general, adding a space to the search, seems to result in no results at all.

As a workaround, I could type everything without a space and would get a result mostly expected.
But my muscle memory is somewhat used to that from other finders such as rofi.

Inconsistent search result keyword highlighting?

Telescope built in find files will highlight all partial matches in the file name, for example if I search person item then the search result will have the following highlights (bold used to indicate highlight): timeline-**item**-**person**.

However, smart open highlight behaves much more erratically, for example, see this screenshot, I see some fragments of the search term highlighted, but not others.

Screenshot 2023-01-31 at 20 47 35

Various installation issues

So first, in the installation instructions, the repo name seems to be wrong: "nvim-telescope/telescope_smart_open.nvim", should be danielfalk/smart-open.nvim.

Then when I restart nvim, I get this error:
Pasted image 2023-01-14 17 28 11

So it looks like fzy-native is required, even though the docs state that it's only optional. Well, I tried installing it nonetheless. But then I get this error:
Pasted image 2023-01-14 17 30 00

and this time, I have no idea how I might fix it myself :(

SQLite error on first run

Hi, I got this error on first run. No error on subsequent run. Just reporting.

Error executing vim.schedule lua callback: .../.local/share/nvim/lazy/sqlite.lua/lua/sqlite/assert.lua:47: sqlite.lua: eval has failed to execute statement, ERRMSG: NOT NULL constraint failed: files.path
stack traceback:
	[C]: in function 'assert'
	.../.local/share/nvim/lazy/sqlite.lua/lua/sqlite/assert.lua:47: in function 'should_eval'
	...ntau/.local/share/nvim/lazy/sqlite.lua/lua/sqlite/db.lua:329: in function 'eval'
	...n.nvim/lua/telescope/_extensions/smart_open/dbclient.lua:49: in function 'update_file'
	...en.nvim/lua/telescope/_extensions/smart_open/history.lua:150: in function 'handle_open'
	...en.nvim/lua/telescope/_extensions/smart_open/history.lua:114: in function 'batch_import'
	...en.nvim/lua/telescope/_extensions/smart_open/history.lua:93: in function ''
	vim/_editor.lua: in function ''
	vim/_editor.lua: in function <vim/_editor.lua:0>

5 second pause before opening

Hi, thanks for the great tool, I use it all the time. I'm having a problem where there's sometimes a ~5 second pause when trying to open the telescope buffer for smart-open.

It normally opens instantly. But then it will 'break' and go from then onward always have a 5 second delay before opening. So it's not like it's just randomly getting caught up whenever, it seems that's there's something very specific and permanent that must have changed to cause it to always have a delay.

My go-to solution is to delete the smart-open.sqlite3 file in case some bad data got written into it. But that doesn't seem to do it. My next thought, is could it be related to some bad data in my old-files list? Because when you delete smart-open.sqlite3 the next time it's launched the database is populated with data from the old files.

I've been using this plugin for about a year and I've come across this issue a few times. I've never worked out what's causing it or how I've fixed it. It's happened on both my Windows machine and my Linux machine.

Do you have any suggestions or ideas? Where can I start with debugging this?

mappings does not work

return {
  "danielfalk/smart-open.nvim",
  -- branch = "0.2.x",
  dependencies = {
    "kkharji/sqlite.lua",
    "nvim-telescope/telescope.nvim",
    { "nvim-telescope/telescope-fzf-native.nvim", build = "make" },
  },
  keys = {
    {
      "<leader>fs",
      function()
        require("telescope").extensions.smart_open.smart_open({
          prompt_title = "Smart Open",
          cwd_only = true,
          filename_first = true,
        })
      end,
      desc = "Smart Open File",
    },
  },
  config = function()
    local telescope = require("telescope")
    local hbac = function()
      vim.cmd("Telescope hbac buffers")
    end
    telescope.setup({
      extensions = {
        smart_open = {
          match_algorithm = "fzf",
          mappings = {
            i = {
              ["<C-g>"] = hbac,
            },
          },
        },
      },
    })
    telescope.load_extension("smart_open")
  end,
}

My customized <C-h> doesn't work. Seems the mapping is not registered.

space after filename is not working (should search for folder instead filename)

if i search only the file works:

image

if i search the path afterwards, doesn't works:

image

Tried with fzf and fzy and filename_first is true.

--

With filename_first false works only using /:

image

If i try to use space, doesn't work (i prefer space 100000x times):
image

Would be awesome to have a option to use space as separator instead / for filename_first false.

Is possible to do it?

In newly-visited projects, not all files are findable

I noticed this the most with ci.yml (GitHub Action file), as I hope around between projects.

My smart-open command is:

nnoremap <C-t> :lua require('telescope').extensions.smart_open.smart_open({cwd_only = true})<CR>

maybe there is some default filter I need to configure?

Use default `TelescopePrompt` filetype

vim.api.nvim_buf_set_option(picker.prompt_bufnr, "filetype", "smart_open")

Any particular reason why this need to be set as smart_open filetype? Most extensions have TelescopePrompt filetype ignored to prevent weird interactions.

Changing this to other filetype just make more hustle for users to have manually ignore this filetype in other extension. For example autopairs.nvim

Increase result limit for the number of entries

Increase the result limit for the number of entries or provide a configuration option for it.

Rationale: It's useful to page up/down through the results sometimes.


For now, I have been manually overriding it via:

diff --git a/lua/smart-open/matching/multithread/create.lua b/lua/smart-open/matching/multithread/create.lua
index 0d07b4a..0a2650e 100644
--- a/lua/smart-open/matching/multithread/create.lua
+++ b/lua/smart-open/matching/multithread/create.lua
@@ -12,7 +12,7 @@ local function create_matcher(matching_algorithm, context)
   local slot_count = 4 -- threadpool thread count
   local last_processed_index = 0
   local top_entries = {} -- treat it as ascending (lowest relevance last)
-  local top_entry_count = 20
+  local top_entry_count = 1024
   local waiting_threads = 0
   local history_data_cache = {}

diff --git a/lua/smart-open/matching/multithread/process.lua b/lua/smart-open/matching/multithread/process.lua
index 08d769d..f881c64 100644
--- a/lua/smart-open/matching/multithread/process.lua
+++ b/lua/smart-open/matching/multithread/process.lua
@@ -1,6 +1,6 @@
 -- prompt, cancel_token, options, last_processed_index
 local function process(prompt, cancel_token, encoded_options, encoded_entries)
-  local result_limit = 20
+  local result_limit = 1024

   local ok, result = pcall(function()
     local options = vim.mpack.decode(encoded_options)
Also relevant
diff --git a/lua/telescope/_extensions/smart_open/finder/finder.lua b/lua/telescope/_extensions/smart_open/finder/finder.lua
index e4975fa..d27d61b 100644
--- a/lua/telescope/_extensions/smart_open/finder/finder.lua
+++ b/lua/telescope/_extensions/smart_open/finder/finder.lua
@@ -65,9 +65,9 @@ return function(history, opts, context)
     __call = function(_, prompt, process_result, process_complete)
       results = {}
 
-      if prompt == "" and #db_results >= 50 then
+      if prompt == "" and #db_results >= 200 then
         for _, result in pairs(db_results) do
-          priority_insert(results, 50, result, function(x)
+          priority_insert(results, 200, result, function(x)
             return x.base_score
           end)
         end
@@ -90,7 +90,7 @@ return function(history, opts, context)
           local to_insert =
             vim.tbl_extend("keep", { ordinal = entry.relevance, display = opts.display, prompt = prompt }, entry)
 
-          priority_insert(results, 50, to_insert, function(e)
+          priority_insert(results, 200, to_insert, function(e)
             return e.relevance or e.base_score
           end)

Can't search with spaces between search keywords?

If I'm searching for a file which I don't remember the exact name of, I usually enter space separated words which I think are part of the name.

For example, if the file is called timeline-item-person.ts I might search for person item.

In the standard Telescope find files, this will get a match, however it seems that smart open needs me to use the exact word separator which the files use on disk (ie. -), for example, neither of the following will find any files for the above mentioned file name: person item, item person.

Is this expected?

(Also, thanks for the great add-on, love it!)

Is there a way to get a preview?

This is what my current fuzzy finder looks like:
image
image

atm, the things I like are:

  • typing on top, results underneath
  • preview with tree-sitter highlighting
  • because of the preview thing, there is also a bit of responsiveness based on terminal shape/size

Telescope to_fuzzy_refine action not working

After starting a search with lua require('telescope').extensions.smart_open.smart_open(), the telescope action to_fuzzy_refine doesn't work and triggers the following warning:

[telescope] [WARN  20:13:41] /Users/user/.local/share/nvim/lazy/telescope.nvim/lua/telescope/pickers.lua:669: Finder failed with msg:  ...escope-fzf-native.nvim/lua/telescope/_extensions/fzf.lua:97: bad argument #1 to 'get_score' (cannot
convert 'number' to 'const char *')

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.