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

style: fix some typos #337

Merged
merged 1 commit into from
Dec 23, 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
2 changes: 1 addition & 1 deletion lua/grug-far.lua
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ local function ensure_instance(instanceName)
return inst
end

-- note: unfortunatly has to be global so it can be passed to command complete= opt
-- note: unfortunately has to be global so it can be passed to command complete= opt
-- selene: allow(unused_variable)
function GrugFarCompleteEngine()
return table.concat(vim.fn.keys(opts.defaultOptions.engines), '\n')
Expand Down
2 changes: 1 addition & 1 deletion lua/grug-far/actions/search.lua
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ local function search(params)
state.stats = { matches = 0, files = 0 }
state.actionMessage = nil

-- note: we clear first time we fetch more info instead of intially
-- note: we clear first time we fetch more info instead of initially
-- in order to reduce flicker
local isCleared = false
local effectiveArgs
Expand Down
2 changes: 1 addition & 1 deletion lua/grug-far/actions/sync.lua
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ local function sync(params)
end

if not context.engine.isSyncSupported() then
state.actionMessage = 'sync operation not suppored by current engine!'
state.actionMessage = 'sync operation not supported by current engine!'
renderResultsHeader(buf, context)
vim.notify('grug-far: ' .. state.actionMessage, vim.log.levels.INFO)
return
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 @@ -52,7 +52,7 @@ M.DiffSeparatorChars = ' '
---@field options GrugFarOptions
---@field replacementInterpreter? GrugFarReplacementInterpreter
---@field on_fetch_chunk fun(data: ParsedResultsData)
---@field on_finish fun(status: GrugFarStatus, errorMesage: string?, customActionMessage: string?)
---@field on_finish fun(status: GrugFarStatus, errorMessage: string?, customActionMessage: string?)

---@class EngineReplaceParams
---@field inputs GrugFarInputs
Expand All @@ -74,7 +74,7 @@ M.DiffSeparatorChars = ' '
---@field options GrugFarOptions
---@field changedFiles ChangedFile[]
---@field report_progress fun(update: { type: "update_total" | "update_count", count: integer })
---@field on_finish fun(status: GrugFarStatus, errorMesage: string?, customActionMessage: string?)
---@field on_finish fun(status: GrugFarStatus, errorMessage: string?, customActionMessage: string?)

---@class GrugFarEngine
---@field type GrugFarEngineType
Expand Down
2 changes: 1 addition & 1 deletion lua/grug-far/engine/ProcessingQueue.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ M.__index = M

--- a processing queue processes each item pushed to it in sequence
--- until there are none. If more items are pushed it automatically starts
--- procesing again
--- processing again
---@param processCallback fun(item: any, on_done: fun())
function M.new(processCallback)
local self = setmetatable({}, M)
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
Expand Up @@ -72,7 +72,7 @@ local function getArgs(inputs, options, extraArgs, blacklistedFlags, forceReplac
end

local version = getAstgrepVersion(options)
-- note: astgrep added --glob suport in v0.28.0
-- note: astgrep added --glob support in v0.28.0
if #inputs.filesFilter > 0 and version and vim.version.gt(version, '0.27.999') then
for _, fileFilter in ipairs(vim.split(inputs.filesFilter, '\n')) do
local glob = vim.trim(fileFilter)
Expand Down
6 changes: 3 additions & 3 deletions lua/grug-far/engine/astgrep/replace.lua
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ function M.replace(params)
local filesFilter = params.inputs.filesFilter
local version = getAstgrepVersion(params.options)
if filesFilter and #filesFilter > 0 and version and vim.version.lt(version, '0.28.0') then
-- note: astgrep added --glob suport in v0.28.0
-- note: astgrep added --glob support in v0.28.0
-- this if-branch uses rg to get the files and can be removed in the future once everybody uses new astgrep
on_abort = fetchFilteredFilesList({
inputs = params.inputs,
Expand Down Expand Up @@ -206,7 +206,7 @@ function M.replace(params)
cmd_path = params.options.engines.astgrep.path,
args = chunk_args,
on_fetch_chunk = function()
-- astgrep does not report progess while replacing
-- astgrep does not report progress while replacing
end,
on_finish = on_finish_chunk,
})
Expand All @@ -224,7 +224,7 @@ function M.replace(params)
cmd_path = params.options.engines.astgrep.path,
args = args,
on_fetch_chunk = function()
-- astgrep does not report progess while replacing
-- astgrep does not report progress while replacing
end,
on_finish = on_finish,
})
Expand Down
2 changes: 1 addition & 1 deletion lua/grug-far/engine/astgrep/search.lua
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ function M.search(params)
local filesFilter = params.inputs.filesFilter
local version = getAstgrepVersion(params.options)
if filesFilter and #filesFilter > 0 and version and vim.version.gt(version, '0.28.0') then
-- note: astgrep added --glob suport in v0.28.0
-- note: astgrep added --glob support in v0.28.0
-- this if-branch uses rg to get the files and can be removed in the future once everybody uses new astgrep

local on_abort = nil
Expand Down
2 changes: 1 addition & 1 deletion lua/grug-far/engine/fetchCommandOutput.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ local uv = vim.uv
---@field cmd_path string
---@field args string[]?
---@field on_fetch_chunk fun(data: string)
---@field on_finish fun(status: GrugFarStatus, errorMesage: string?)
---@field on_finish fun(status: GrugFarStatus, errorMessage: string?)
---@field stdin? uv_pipe_t
---@field fixChunkLineTruncation? boolean

Expand Down
2 changes: 1 addition & 1 deletion lua/grug-far/engine/ripgrep/fetchFilesWithMatches.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ local fetchCommandOutput = require('grug-far.engine.fetchCommandOutput')
---@field inputs GrugFarInputs
---@field options GrugFarOptions
---@field report_progress fun(count: integer)
---@field on_finish fun(status: GrugFarStatus, errorMesage: string?, filesWithMatches: string[], blacklistedArgs: string[]?)
---@field on_finish fun(status: GrugFarStatus, errorMessage: string?, filesWithMatches: string[], blacklistedArgs: string[]?)

--- fetch list of files that match search
---@param params FetchWithMatchesParams
Expand Down
2 changes: 1 addition & 1 deletion lua/grug-far/engine/ripgrep/fetchFilteredFilesList.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ local fetchCommandOutput = require('grug-far.engine.fetchCommandOutput')
---@field inputs GrugFarInputs
---@field options GrugFarOptions
---@field report_progress fun(count: integer)
---@field on_finish fun(status: GrugFarStatus, errorMesage: string?, files: string[])
---@field on_finish fun(status: GrugFarStatus, errorMessage: string?, files: string[])

--- fetch list of files that match filter and paths
---@param params FetchFilteredFilesListParams
Expand Down
2 changes: 1 addition & 1 deletion lua/grug-far/engine/ripgrep/fetchReplacedFileContent.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ local uv = vim.uv
---@field inputs GrugFarInputs
---@field options GrugFarOptions
---@field file string
---@field on_finish fun(status: GrugFarStatus, errorMesage: string | nil, content: string?)
---@field on_finish fun(status: GrugFarStatus, errorMessage: string | nil, content: string?)

--- fetch file content with matches replaced
---@param params FetchReplacedFileContentParams
Expand Down
4 changes: 2 additions & 2 deletions lua/grug-far/engine/ripgrep/search.lua
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ end
---@field json_data RipgrepJson[]
---@field options GrugFarOptions
---@field inputs GrugFarInputs
---@field on_finish fun(status: GrugFarStatus, errorMesage: string?, results: ParsedResultsData?)
---@field on_finish fun(status: GrugFarStatus, errorMessage: string?, results: ParsedResultsData?)

--- adds results of doing a replace to results of doing a search
---@param params ResultsWithReplaceDiffParams
Expand Down Expand Up @@ -123,7 +123,7 @@ end
---@field options GrugFarOptions
---@field inputs GrugFarInputs
---@field on_fetch_chunk fun(data: ParsedResultsData)
---@field on_finish fun(status: GrugFarStatus, errorMesage: string?, customActionMessage: string?)
---@field on_finish fun(status: GrugFarStatus, errorMessage: string?, customActionMessage: string?)

--- runs search
---@param params RipgrepEngineSearchParams
Expand Down
2 changes: 1 addition & 1 deletion lua/grug-far/engine/ripgrep/sync.lua
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ M.sync = function(params)
end

if isMultilineSearchReplace(args) then
on_finish(nil, nil, 'sync disabled for multline search/replace!')
on_finish(nil, nil, 'sync disabled for multiline search/replace!')
return
end

Expand Down
2 changes: 1 addition & 1 deletion lua/grug-far/farBuffer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ local function getActions(buf, context)
{
text = 'Swap Replacement Interpreter',
keymap = keymaps.swapReplacementInterpreter,
description = 'Swap replacement interpreter with the next one. For example, with the "lua" interpeter, you can use lua to generate your replacement for each match.',
description = 'Swap replacement interpreter with the next one. For example, with the "lua" interpreter, you can use lua to generate your replacement for each match.',
action = function()
swapReplacementInterpreter({ buf = buf, context = context })
end,
Expand Down
8 changes: 4 additions & 4 deletions lua/grug-far/opts.lua
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@ M.defaultOptions = {
-- Supported:
-- * 'default': treat replacement as a string to pass to the current engine
-- * 'lua': treat replacement as lua function body where search match is identified by `match` and
-- meta variables (with astgrep for example) are avaible in `vars` table (ex: `vars.A` captures `$A`)
-- meta variables (with astgrep for example) are available in `vars` table (ex: `vars.A` captures `$A`)
-- * 'vimscript': treat replacement as vimscript function body where search match is identified by `match` and
-- meta variables (with astgrep for example) are avaible in `vars` table (ex: `vars.A` captures `$A`)
-- meta variables (with astgrep for example) are available in `vars` table (ex: `vars.A` captures `$A`)
enabledReplacementInterpreters = { 'default', 'lua', 'vimscript' },

-- which replacement interprer to use
Expand Down Expand Up @@ -133,7 +133,7 @@ M.defaultOptions = {

-- static title to use for grug-far buffer, as opposed to the dynamically generated title.
-- Note that nvim does not allow multiple buffers with the same name, so this option is meant more
-- as something to be speficied for a particular instance as opposed to something set in the setup function
-- as something to be specified for a particular instance as opposed to something set in the setup function
-- nil or '' disables it
staticTitle = nil,

Expand Down Expand Up @@ -288,7 +288,7 @@ M.defaultOptions = {

-- unique instance name. This is used as a handle to refer to a particular instance of grug-far when
-- toggling visibility, etc.
-- As this needs to be unique per instance, this option is meant to be speficied for a particular instance
-- As this needs to be unique per instance, this option is meant to be specified for a particular instance
-- as opposed to something set in the setup function
instanceName = nil,

Expand Down
2 changes: 1 addition & 1 deletion lua/grug-far/render/resultsList.lua
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ function M.appendSearchCommand(buf, context, rgArgs)
)
end

--- force redraws buffer. This is order to apear more responsive to the user
--- force redraws buffer. This is order to appear more responsive to the user
--- and quickly give user feedback as results come in / data is updated
--- note that only the "top" range of lines is redrawn, including a bunch of lines
--- after headerRow so that we immediately get error messages to show up
Expand Down
2 changes: 1 addition & 1 deletion lua/grug-far/replacementInterpreter.lua
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function M.setReplacementInterpreter(buf, context, type)
return
end

-- clear results as it can be slow to clear sytnax highlight otherwise
-- clear results as it can be slow to clear syntax highlight otherwise
resultsList.clear(buf, context)

-- clear old syntax highlighting
Expand Down
4 changes: 2 additions & 2 deletions tests/astgrep/test_sync.lua
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ T['sync all is not supported'] = function()

child.type_keys('<esc>' .. keymaps.syncLocations.n)

helpers.childWaitForUIVirtualText(child, 'sync operation not suppored')
helpers.childWaitForUIVirtualText(child, 'sync operation not supported')
end

T['sync line is not supported'] = function()
Expand Down Expand Up @@ -80,7 +80,7 @@ T['sync line is not supported'] = function()

child.type_keys('<esc>' .. keymaps.syncLine.n)

helpers.childWaitForUIVirtualText(child, 'sync operation not suppored')
helpers.childWaitForUIVirtualText(child, 'sync operation not supported')
end

return T
2 changes: 1 addition & 1 deletion tests/base/test_utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ describe('strEllideAfter', function()
it('returns string if strlen < n', function()
expect.equality('hello world', utils.strEllideAfter('hello world', 20))
end)
it('returns ellided strign if strlen > n', function()
it('returns ellided string if strlen > n', function()
expect.equality('hello...', utils.strEllideAfter('hello world', 5))
end)
it('adds prefix if proficed', function()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
12|
13|
14| STATUS_READY ⟪ ripgrep ⟫
15| 5 matches in 2 files  sync disabled for multline search/replace!
15| 5 matches in 2 files  sync disabled for multiline search/replace!
16|
17|file1.txt
18|3:13: then grug swims a deep depth indeed! [2]
Expand All @@ -39,7 +39,7 @@
12|11111111111111111111111111111111111111111111111111111111111111111111111111111111
13|11111111111111111111111111111111111111111111111111111111111111111111111111111111
14|33333333333333333333333333333333333333333333333333333333333333333333333333333333
15|33333333333333333333330000000000000000000000000000000000000000000001111111111111
15|33333333333333333333330000000000000000000000000000000000000000000000111111111111
16|11111111111111111111111111111111111111111111111111111111111111111111111111111111
17|44444444411111111111111111111111111111111111111111111111111111111111111111111111
18|51551111111111111444411111111111111111111111111111111111111111111111111111112222
Expand Down
Loading