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

converting / to . in requires for easy auto-import #281

Merged
merged 3 commits into from
Sep 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions lua/grug-far.lua
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
local opts = require('grug-far/opts')
local highlights = require('grug-far/highlights')
local farBuffer = require('grug-far/farBuffer')
local history = require('grug-far/history')
local utils = require('grug-far/utils')
local close = require('grug-far/actions/close')
local engine = require('grug-far/engine')
local replacementInterpreter = require('grug-far/replacementInterpreter')
local fold = require('grug-far/fold')
local inputs = require('grug-far/inputs')
local fileIconsProvider = require('grug-far/fileIconsProvider')
local opts = require('grug-far.opts')
local highlights = require('grug-far.highlights')
local farBuffer = require('grug-far.farBuffer')
local history = require('grug-far.history')
local utils = require('grug-far.utils')
local close = require('grug-far.actions.close')
local engine = require('grug-far.engine')
local replacementInterpreter = require('grug-far.replacementInterpreter')
local fold = require('grug-far.fold')
local inputs = require('grug-far.inputs')
local fileIconsProvider = require('grug-far.fileIconsProvider')

local M = {}

Expand Down Expand Up @@ -232,7 +232,7 @@ local function setupCleanup(buf, context)
vim.api.nvim_buf_clear_namespace(buf, context.historyHlNamespace, 0, -1)
vim.api.nvim_buf_clear_namespace(buf, context.helpHlNamespace, 0, -1)
vim.api.nvim_del_augroup_by_id(context.augroup)
require('grug-far/render/treesitter').clear(buf)
require('grug-far.render.treesitter').clear(buf)
fold.cleanup(context)
end

Expand Down
2 changes: 1 addition & 1 deletion lua/grug-far/actions/abort.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
local utils = require('grug-far/utils')
local utils = require('grug-far.utils')

--- aborts all currently running tasks
---@param params { buf: integer, context: GrugFarContext }
Expand Down
4 changes: 2 additions & 2 deletions lua/grug-far/actions/gotoLocation.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
local resultsList = require('grug-far/render/resultsList')
local utils = require('grug-far/utils')
local resultsList = require('grug-far.render.resultsList')
local utils = require('grug-far.utils')

--- gets result location that we should open and row in buffer where it is referenced
---@param buf integer
Expand Down
4 changes: 2 additions & 2 deletions lua/grug-far/actions/help.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
local utils = require('grug-far/utils')
local opts = require('grug-far/opts')
local utils = require('grug-far.utils')
local opts = require('grug-far.opts')

---@alias HlText string[]

Expand Down
2 changes: 1 addition & 1 deletion lua/grug-far/actions/historyAdd.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
local history = require('grug-far/history')
local history = require('grug-far.history')

--- adds current UI values as history entry
---@param params { context: GrugFarContext }
Expand Down
14 changes: 7 additions & 7 deletions lua/grug-far/actions/historyOpen.lua
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
local renderHelp = require('grug-far/render/help')
local history = require('grug-far/history')
local utils = require('grug-far/utils')
local opts = require('grug-far/opts')
local engine = require('grug-far/engine')
local replacementInterpreter = require('grug-far/replacementInterpreter')
local inputs = require('grug-far/inputs')
local renderHelp = require('grug-far.render.help')
local history = require('grug-far.history')
local utils = require('grug-far.utils')
local opts = require('grug-far.opts')
local engine = require('grug-far.engine')
local replacementInterpreter = require('grug-far.replacementInterpreter')
local inputs = require('grug-far.inputs')

--- gets history entry at given 0-based buffer row
---@param historyBuf integer
Expand Down
4 changes: 2 additions & 2 deletions lua/grug-far/actions/openLocation.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
local resultsList = require('grug-far/render/resultsList')
local utils = require('grug-far/utils')
local resultsList = require('grug-far.render.resultsList')
local utils = require('grug-far.utils')

--- gets result location that we should open and row in buffer where it is referenced
---@param buf integer
Expand Down
2 changes: 1 addition & 1 deletion lua/grug-far/actions/previewLocation.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
local resultsList = require('grug-far/render/resultsList')
local resultsList = require('grug-far.render.resultsList')

local function previewLocation(params)
local buf = params.buf
Expand Down
2 changes: 1 addition & 1 deletion lua/grug-far/actions/qflist.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
local utils = require('grug-far/utils')
local utils = require('grug-far.utils')

--- opens quickfix list
---@param context GrugFarContext
Expand Down
6 changes: 3 additions & 3 deletions lua/grug-far/actions/replace.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
local renderResultsHeader = require('grug-far/render/resultsHeader')
local resultsList = require('grug-far/render/resultsList')
local history = require('grug-far/history')
local renderResultsHeader = require('grug-far.render.resultsHeader')
local resultsList = require('grug-far.render.resultsList')
local history = require('grug-far.history')
local uv = vim.uv

--- gets action message to display
Expand Down
6 changes: 3 additions & 3 deletions lua/grug-far/actions/search.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
local renderResultsHeader = require('grug-far/render/resultsHeader')
local resultsList = require('grug-far/render/resultsList')
local fold = require('grug-far/fold')
local renderResultsHeader = require('grug-far.render.resultsHeader')
local resultsList = require('grug-far.render.resultsList')
local fold = require('grug-far.fold')

--- performs search
---@param params { buf: integer, context: GrugFarContext }
Expand Down
4 changes: 2 additions & 2 deletions lua/grug-far/actions/swapEngine.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
local search = require('grug-far/actions/search')
local engine = require('grug-far/engine')
local search = require('grug-far.actions.search')
local engine = require('grug-far.engine')

--- swaps engine with the next one
---@param params { buf: integer, context: GrugFarContext }
Expand Down
4 changes: 2 additions & 2 deletions lua/grug-far/actions/swapReplacementInterpreter.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
local search = require('grug-far/actions/search')
local replacementInterpreter = require('grug-far/replacementInterpreter')
local search = require('grug-far.actions.search')
local replacementInterpreter = require('grug-far.replacementInterpreter')

--- swaps replacement interpreter with the next one
---@param params { buf: integer, context: GrugFarContext }
Expand Down
4 changes: 2 additions & 2 deletions lua/grug-far/actions/sync.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
local renderResultsHeader = require('grug-far/render/resultsHeader')
local resultsList = require('grug-far/render/resultsList')
local renderResultsHeader = require('grug-far.render.resultsHeader')
local resultsList = require('grug-far.render.resultsList')
local uv = vim.uv

--- gets action message to display
Expand Down
2 changes: 1 addition & 1 deletion lua/grug-far/actions/syncLine.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
local sync = require('grug-far/actions/sync')
local sync = require('grug-far.actions.sync')

--- syncs current result line with original file location
---@param params { buf: integer, context: GrugFarContext }
Expand Down
4 changes: 2 additions & 2 deletions lua/grug-far/actions/syncLocations.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
local sync = require('grug-far/actions/sync')
local history = require('grug-far/history')
local sync = require('grug-far.actions.sync')
local history = require('grug-far.history')

--- syncs all result lines with original file locations
---@param params { buf: integer, context: GrugFarContext }
Expand Down
2 changes: 1 addition & 1 deletion lua/grug-far/actions/toggleShowCommand.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
local search = require('grug-far/actions/search')
local search = require('grug-far.actions.search')

--- toggles displaying search command
---@param params { buf: integer, context: GrugFarContext }
Expand Down
4 changes: 2 additions & 2 deletions lua/grug-far/engine.lua
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ M.DiffSeparatorChars = ' '
---@return GrugFarEngine
function M.getEngine(type)
if type == 'astgrep' then
return require('grug-far/engine/astgrep')
return require('grug-far.engine.astgrep')
else
return require('grug-far/engine/ripgrep')
return require('grug-far.engine.ripgrep')
end
end

Expand Down
4 changes: 2 additions & 2 deletions lua/grug-far/engine/astgrep.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
local search = require('grug-far/engine/astgrep/search')
local replace = require('grug-far/engine/astgrep/replace')
local search = require('grug-far.engine.astgrep.search')
local replace = require('grug-far.engine.astgrep.replace')

---@type GrugFarEngine
local AstgrepEngine = {
Expand Down
2 changes: 1 addition & 1 deletion lua/grug-far/engine/astgrep/blacklistedReplaceFlags.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
local blacklistedSearchFlags = require('grug-far/engine/astgrep/blacklistedSearchFlags')
local blacklistedSearchFlags = require('grug-far.engine.astgrep.blacklistedSearchFlags')

-- those are flags that would result in undesirable situations when replacing
-- (in addition to the blacklisted search flags)
Expand Down
2 changes: 1 addition & 1 deletion lua/grug-far/engine/astgrep/getArgs.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
local utils = require('grug-far/utils')
local utils = require('grug-far.utils')

local rewriteFlags = {
'--rewrite',
Expand Down
4 changes: 2 additions & 2 deletions lua/grug-far/engine/astgrep/parseResults.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
local utils = require('grug-far/utils')
local engine = require('grug-far/engine')
local utils = require('grug-far.utils')
local engine = require('grug-far.engine')
local ResultHighlightType = engine.ResultHighlightType

local M = {}
Expand Down
18 changes: 9 additions & 9 deletions lua/grug-far/engine/astgrep/replace.lua
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
local fetchCommandOutput = require('grug-far/engine/fetchCommandOutput')
local utils = require('grug-far/utils')
local getArgs = require('grug-far/engine/astgrep/getArgs')
local blacklistedReplaceFlags = require('grug-far/engine/astgrep/blacklistedReplaceFlags')
local fetchFilteredFilesList = require('grug-far/engine/ripgrep/fetchFilteredFilesList')
local runWithChunkedFiles = require('grug-far/engine/runWithChunkedFiles')
local argUtils = require('grug-far/engine/astgrep/argUtils')
local parseResults = require('grug-far/engine/astgrep/parseResults')
local ProcessingQueue = require('grug-far/engine/ProcessingQueue')
local fetchCommandOutput = require('grug-far.engine.fetchCommandOutput')
local utils = require('grug-far.utils')
local getArgs = require('grug-far.engine.astgrep.getArgs')
local blacklistedReplaceFlags = require('grug-far.engine.astgrep.blacklistedReplaceFlags')
local fetchFilteredFilesList = require('grug-far.engine.ripgrep.fetchFilteredFilesList')
local runWithChunkedFiles = require('grug-far.engine.runWithChunkedFiles')
local argUtils = require('grug-far.engine.astgrep.argUtils')
local parseResults = require('grug-far.engine.astgrep.parseResults')
local ProcessingQueue = require('grug-far.engine.ProcessingQueue')

local M = {}

Expand Down
20 changes: 10 additions & 10 deletions lua/grug-far/engine/astgrep/search.lua
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
local fetchCommandOutput = require('grug-far/engine/fetchCommandOutput')
local getArgs = require('grug-far/engine/astgrep/getArgs')
local parseResults = require('grug-far/engine/astgrep/parseResults')
local utils = require('grug-far/utils')
local blacklistedSearchFlags = require('grug-far/engine/astgrep/blacklistedSearchFlags')
local getAstgrepVersion = require('grug-far/engine/astgrep/getAstgrepVersion')
local fetchFilteredFilesList = require('grug-far/engine/ripgrep/fetchFilteredFilesList')
local runWithChunkedFiles = require('grug-far/engine/runWithChunkedFiles')
local getRgVersion = require('grug-far/engine/ripgrep/getRgVersion')
local argUtils = require('grug-far/engine/astgrep/argUtils')
local fetchCommandOutput = require('grug-far.engine.fetchCommandOutput')
local getArgs = require('grug-far.engine.astgrep.getArgs')
local parseResults = require('grug-far.engine.astgrep.parseResults')
local utils = require('grug-far.utils')
local blacklistedSearchFlags = require('grug-far.engine.astgrep.blacklistedSearchFlags')
local getAstgrepVersion = require('grug-far.engine.astgrep.getAstgrepVersion')
local fetchFilteredFilesList = require('grug-far.engine.ripgrep.fetchFilteredFilesList')
local runWithChunkedFiles = require('grug-far.engine.runWithChunkedFiles')
local getRgVersion = require('grug-far.engine.ripgrep.getRgVersion')
local argUtils = require('grug-far.engine.astgrep.argUtils')

local M = {}

Expand Down
2 changes: 1 addition & 1 deletion lua/grug-far/engine/fetchCommandOutput.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
local utils = require('grug-far/utils')
local utils = require('grug-far.utils')
local uv = vim.uv

---@class FetchCommandOutputParams
Expand Down
6 changes: 3 additions & 3 deletions lua/grug-far/engine/ripgrep.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
local search = require('grug-far/engine/ripgrep/search')
local replace = require('grug-far/engine/ripgrep/replace')
local sync = require('grug-far/engine/ripgrep/sync')
local search = require('grug-far.engine.ripgrep.search')
local replace = require('grug-far.engine.ripgrep.replace')
local sync = require('grug-far.engine.ripgrep.sync')

---@type GrugFarEngine
local RipgrepEngine = {
Expand Down
2 changes: 1 addition & 1 deletion lua/grug-far/engine/ripgrep/colors.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
local ResultHighlightType = require('grug-far/engine').ResultHighlightType
local ResultHighlightType = require('grug-far.engine').ResultHighlightType

local M = {}
M.ansi_color_ending = ''
Expand Down
6 changes: 3 additions & 3 deletions lua/grug-far/engine/ripgrep/fetchFilesWithMatches.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
local getArgs = require('grug-far/engine/ripgrep/getArgs')
local blacklistedReplaceFlags = require('grug-far/engine/ripgrep/blacklistedReplaceFlags')
local fetchCommandOutput = require('grug-far/engine/fetchCommandOutput')
local getArgs = require('grug-far.engine.ripgrep.getArgs')
local blacklistedReplaceFlags = require('grug-far.engine.ripgrep.blacklistedReplaceFlags')
local fetchCommandOutput = require('grug-far.engine.fetchCommandOutput')

---@class FetchWithMatchesParams
---@field inputs GrugFarInputs
Expand Down
4 changes: 2 additions & 2 deletions lua/grug-far/engine/ripgrep/fetchFilteredFilesList.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
local getArgs = require('grug-far/engine/ripgrep/getArgs')
local fetchCommandOutput = require('grug-far/engine/fetchCommandOutput')
local getArgs = require('grug-far.engine.ripgrep.getArgs')
local fetchCommandOutput = require('grug-far.engine.fetchCommandOutput')

---@class FetchFilteredFilesListParams
---@field inputs GrugFarInputs
Expand Down
6 changes: 3 additions & 3 deletions lua/grug-far/engine/ripgrep/fetchReplacedFileContent.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
local getArgs = require('grug-far/engine/ripgrep/getArgs')
local utils = require('grug-far/utils')
local blacklistedReplaceFlags = require('grug-far/engine/ripgrep/blacklistedReplaceFlags')
local getArgs = require('grug-far.engine.ripgrep.getArgs')
local utils = require('grug-far.utils')
local blacklistedReplaceFlags = require('grug-far.engine.ripgrep.blacklistedReplaceFlags')
local uv = vim.uv

---@class FetchReplacedFileContentParams
Expand Down
4 changes: 2 additions & 2 deletions lua/grug-far/engine/ripgrep/getArgs.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
local utils = require('grug-far/utils')
local getRgVersion = require('grug-far/engine/ripgrep/getRgVersion')
local utils = require('grug-far.utils')
local getRgVersion = require('grug-far.engine.ripgrep.getRgVersion')

--- get args for ripgrep or nil if params invalid / insufficient
---@param inputs GrugFarInputs
Expand Down
4 changes: 2 additions & 2 deletions lua/grug-far/engine/ripgrep/parseResults.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
local utils = require('grug-far/utils')
local engine = require('grug-far/engine')
local utils = require('grug-far.utils')
local engine = require('grug-far.engine')
local ResultHighlightType = engine.ResultHighlightType

local M = {}
Expand Down
6 changes: 3 additions & 3 deletions lua/grug-far/engine/ripgrep/replace.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
local fetchFilesWithMatches = require('grug-far/engine/ripgrep/fetchFilesWithMatches')
local replaceInMatchedFiles = require('grug-far/engine/ripgrep/replaceInMatchedFiles')
local getArgs = require('grug-far/engine/ripgrep/getArgs')
local fetchFilesWithMatches = require('grug-far.engine.ripgrep.fetchFilesWithMatches')
local replaceInMatchedFiles = require('grug-far.engine.ripgrep.replaceInMatchedFiles')
local getArgs = require('grug-far.engine.ripgrep.getArgs')

local M = {}

Expand Down
12 changes: 6 additions & 6 deletions lua/grug-far/engine/ripgrep/replaceInMatchedFiles.lua
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
local fetchReplacedFileContent = require('grug-far/engine/ripgrep/fetchReplacedFileContent')
local utils = require('grug-far/utils')
local fetchCommandOutput = require('grug-far/engine/fetchCommandOutput')
local argUtils = require('grug-far/engine/ripgrep/argUtils')
local getArgs = require('grug-far/engine/ripgrep/getArgs')
local parseResults = require('grug-far/engine/ripgrep/parseResults')
local fetchReplacedFileContent = require('grug-far.engine.ripgrep.fetchReplacedFileContent')
local utils = require('grug-far.utils')
local fetchCommandOutput = require('grug-far.engine.fetchCommandOutput')
local argUtils = require('grug-far.engine.ripgrep.argUtils')
local getArgs = require('grug-far.engine.ripgrep.getArgs')
local parseResults = require('grug-far.engine.ripgrep.parseResults')

---@class replaceInFileParams
---@field inputs GrugFarInputs
Expand Down
14 changes: 7 additions & 7 deletions lua/grug-far/engine/ripgrep/search.lua
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
local fetchCommandOutput = require('grug-far/engine/fetchCommandOutput')
local utils = require('grug-far/utils')
local ProcessingQueue = require('grug-far/engine/ProcessingQueue')
local getRgVersion = require('grug-far/engine/ripgrep/getRgVersion')
local parseResults = require('grug-far/engine/ripgrep/parseResults')
local getArgs = require('grug-far/engine/ripgrep/getArgs')
local argUtils = require('grug-far/engine/ripgrep/argUtils')
local fetchCommandOutput = require('grug-far.engine.fetchCommandOutput')
local utils = require('grug-far.utils')
local ProcessingQueue = require('grug-far.engine.ProcessingQueue')
local getRgVersion = require('grug-far.engine.ripgrep.getRgVersion')
local parseResults = require('grug-far.engine.ripgrep.parseResults')
local getArgs = require('grug-far.engine.ripgrep.getArgs')
local argUtils = require('grug-far.engine.ripgrep.argUtils')
local uv = vim.uv

local M = {}
Expand Down
6 changes: 3 additions & 3 deletions lua/grug-far/engine/ripgrep/sync.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
local syncChangedFiles = require('grug-far/engine/syncChangedFiles')
local getArgs = require('grug-far/engine/ripgrep/getArgs')
local utils = require('grug-far/utils')
local syncChangedFiles = require('grug-far.engine.syncChangedFiles')
local getArgs = require('grug-far.engine.ripgrep.getArgs')
local utils = require('grug-far.utils')

local M = {}

Expand Down
2 changes: 1 addition & 1 deletion lua/grug-far/engine/syncChangedFiles.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
local utils = require('grug-far/utils')
local utils = require('grug-far.utils')

--- performs sync for given changed file
---@param params { changedFile: ChangedFile, on_done: fun(errorMessage: string?) }
Expand Down
Loading
Loading