nvim-telescope / telescope-frecency.nvim

A telescope.nvim extension that offers intelligent prioritization when selecting files from your editing history.
MIT License
777 stars 37 forks source link

Workspaces tag configuration not being applied #6

Closed akinsho closed 3 years ago

akinsho commented 3 years ago

Hi 👋🏿 thanks for creating this, I've been really enjoying using it.

I noticed today that you added tag filtering and so I setup my config with a few different paths to test things out with but I'm not able to get it to a) show my workspaces in the omnicomplete menu b) likely because typing them out doesn't work at all. This is probably user error but I can't quite figure out where I might be going wrong. I'd appreciate any help.

For some reason the only tag that shows up is :LSP: which I didn't create and on completing it the final : causes a pause likely because the results are being loaded in and the call is blocking (could be a general telescope issue though)

  telescope.setup {
    defaults = {
      prompt_prefix = " ❯",
      mappings = {
        i = {
          ["<ESC>"] = actions.close
        }
      },
      file_ignore_patterns = {"%.jpg", "%.jpeg", "%.png", "%.otf", "%.ttf"},
      file_sorter = sorters.get_fzy_sorter,
      generic_sorter = sorters.get_fzy_sorter,
      file_previewer = previewers.vim_buffer_cat.new,
      grep_previewer = previewers.vim_buffer_vimgrep.new,
      layout_strategy = "flex",
      winblend = 7,
      set_env = {COLORTERM = "truecolor"}
    },
    extensions = { -- <-- Should this be somewhere else?
      frecency = {
        workspaces = {
          ["conf"] = vim.env.DOTFILES,
          ["project"] = vim.env.PROJECTS_DIR,
          ["wiki"] = vim.g.wiki_path
        }
      }
    }
  }
sunjon commented 3 years ago

Hey :) Sorry for the delayed response!

Your config looks correct. Is there anything unusual about your environment (*Note: we need an issue template). I can put some debugging output in the workspace config and we can try work this out.

For now, let me have some details on your OS/setup, etc.

akinsho commented 3 years ago

@sunjon course sorry 🤦🏿 , So I've been running the plugin on both macOS Big Sur 11.2 and Ubuntu 20.10 and am getting more or less the same behaviour. On Linux for some reason I get the :LSP: tag on <tab> but nothing on mac.

Neovim version is

NVIM v0.5.0-dev+nightly-448-g971e0ca903
Build type: Release
LuaJIT 2.1.0-beta3
Compilation: /usr/bin/clang -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNDEBUG -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-s
trong -fno-common -fdiagnostics-color=auto -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/tmp/neovim-20210210-93493-1v7gtf9/build/config -I/tmp/neovim-20210210-93493-1v7
gtf9/src -I/usr/local/include -I/tmp/neovim-20210210-93493-1v7gtf9/deps-build/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include -I/usr/local/opt/gettext/include -I/tmp/neovim-2
0210210-93493-1v7gtf9/build/src/nvim/auto -I/tmp/neovim-20210210-93493-1v7gtf9/build/include
Compiled by akinso@Akins-MacBook-Pro.local

Features: +acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/local/Cellar/neovim/HEAD-971e0ca/share/nvim"

Run :checkhealth for more info

The plugin is loaded using packer, not sure if there could be an ordering issue here i.e. should frecency be explicitly before or after telescope

    use {
      "nvim-telescope/telescope.nvim",
      config = require("as.plugins.telescope"),
      requires = {
        "nvim-lua/popup.nvim",
        {
          "nvim-telescope/telescope-frecency.nvim",
          requires = {"tami5/sql.nvim"},
          config = function()
            require("telescope").load_extension("frecency")
          end
        }
      }
    }
akinsho commented 3 years ago

This actually seems to have started working, not sure when or why exactly but also not about to look a gift horse in the mouth. Thanks for your help anyway 😄

akinsho commented 3 years ago

Actually, I spoke too soon it seems to have stopped again. I think somehow it might relate to my local data. Not sure anyway I can live without this

runiq commented 3 years ago

Doesn't work for me either, for some reason. :-/ Care to reopen, pretty please?

akinsho commented 3 years ago

Tbh it is actually working for me now, I don't really use it atm since I'm waiting for when this can just be done with manually having to specify a tag. There's another PR/issue tracking that.

runiq commented 3 years ago

Which one is that? https://github.com/nvim-telescope/telescope-frecency.nvim/issues/16?

runiq commented 3 years ago

Alright, I got it – it was a race condition. Setup needs to run before the extension is loaded, and I did it the other way round.