diff --git a/lua/telescope/_extensions/frecency.lua b/lua/telescope/_extensions/frecency.lua index 3b0f18c..a79ed48 100644 --- a/lua/telescope/_extensions/frecency.lua +++ b/lua/telescope/_extensions/frecency.lua @@ -13,7 +13,6 @@ local path = require('telescope.path') local pickers = require "telescope.pickers" local sorters = require "telescope.sorters" local utils = require('telescope.utils') -local frecency_utils = require("telescope._extensions.frecency.util") local os_home = vim.loop.os_homedir() local os_path_sep = utils.get_separator() @@ -56,7 +55,7 @@ local frecency = function(opts) filename = utils.path_shorten(filename) else -- check relative to home/current filename = path.make_relative(filename, cwd) - if frecency_utils.string_starts(filename, os_home) then + if vim.startswith(filename, os_home) then filename = "~/" .. path.make_relative(filename, os_home) elseif filename ~= original_filename then filename = "./" .. filename diff --git a/lua/telescope/_extensions/frecency/db_client.lua b/lua/telescope/_extensions/frecency/db_client.lua index 7a0e97f..d7583f1 100644 --- a/lua/telescope/_extensions/frecency/db_client.lua +++ b/lua/telescope/_extensions/frecency/db_client.lua @@ -1,7 +1,5 @@ local sqlwrap = require("telescope._extensions.frecency.sql_wrapper") local util = require("telescope._extensions.frecency.util") -local conf = require('telescope.config').values - local MAX_TIMESTAMPS = 10 local DB_REMOVE_SAFETY_THRESHOLD = 10 @@ -79,7 +77,6 @@ end local function init(config_ignore_patterns) if sql_wrapper then return end - sql_wrapper = sqlwrap:new() local first_run = sql_wrapper:bootstrap() validate_db() @@ -126,14 +123,14 @@ end local function filter_workspace(filelist, workspace_path) local res = {} for _, entry in pairs(filelist) do - if util.string_starts(entry.path, workspace_path) then + if vim.startwith(entry.path, workspace_path) then table.insert(res, entry) end end return res end -local function get_file_scores(opts) +local function get_file_scores(opts) -- TODO: no need to pass in all opts here if not sql_wrapper then return {} end local queries = sql_wrapper.queries diff --git a/lua/telescope/_extensions/frecency/util.lua b/lua/telescope/_extensions/frecency/util.lua index 0f74a82..134d488 100644 --- a/lua/telescope/_extensions/frecency/util.lua +++ b/lua/telescope/_extensions/frecency/util.lua @@ -24,10 +24,6 @@ util.string_isempty = function(str) return str == nil or str == '' end -util.string_starts = function(str, token) - return str:sub(1, token:len()) == token -end - util.string_ends = function(str, token) return str:sub(str:len() - token:len() + 1, -1) == token end