From a7ea87db1960ce4d51c3f8b79c405a908c2d2165 Mon Sep 17 00:00:00 2001 From: Mika Vilpas Date: Tue, 5 Nov 2024 14:42:47 +0200 Subject: [PATCH] refactor!: rename project to blink-ripgrep.nvim Issue ===== It's confusing that this project has the same name as the original project. This causes confusion and is not in anyone's best interest. Solution ======== Rename the project to `blink-ripgrep.nvim`. --- README.md | 8 ++++---- ...scm-1.rockspec => blink-ripgrep.nvim-scm-1.rockspec | 4 ++-- integration-tests/cypress/e2e/cmp-rg/health_spec.cy.ts | 4 ++-- integration-tests/package.json | 2 +- integration-tests/test-environment/test-setup.lua | 8 ++++---- lua/{blink-cmp-rg => blink-ripgrep}/health.lua | 4 ++-- lua/{blink-cmp-rg => blink-ripgrep}/init.lua | 10 +++++----- lua/{blink-cmp-rg => blink-ripgrep}/ripgrep_parser.lua | 0 package.json | 2 +- spec/{blink-cmp-rg => blink-ripgrep}/rg-output.jsonl | 0 .../ripgrep_parser_spec.lua | 4 ++-- 11 files changed, 23 insertions(+), 23 deletions(-) rename blink-cmp-rg.nvim-scm-1.rockspec => blink-ripgrep.nvim-scm-1.rockspec (82%) rename lua/{blink-cmp-rg => blink-ripgrep}/health.lua (79%) rename lua/{blink-cmp-rg => blink-ripgrep}/init.lua (90%) rename lua/{blink-cmp-rg => blink-ripgrep}/ripgrep_parser.lua (100%) rename spec/{blink-cmp-rg => blink-ripgrep}/rg-output.jsonl (100%) rename spec/{blink-cmp-rg => blink-ripgrep}/ripgrep_parser_spec.lua (86%) diff --git a/README.md b/README.md index 54f43ff..a8e0447 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# blink-cmp-rg.nvim +# blink-ripgrep.nvim Ripgrep source for [blink.cmp](https://github.com/Saghen/blink.cmp). @@ -9,7 +9,7 @@ Forked here (mikavilpas/blink.cmp) for my own use from -- NOTE: you can skip the type annotations if you don't want to use them -- ---@module "lazy" ----@module "blink-cmp-rg" +---@module "blink-ripgrep" ---@type LazySpec require("blink.cmp").setup({ sources = { @@ -19,10 +19,10 @@ require("blink.cmp").setup({ providers = { -- other sources ripgrep = { - module = "blink-cmp-rg", + module = "blink-ripgrep", name = "Ripgrep", -- options below are optional, these are the default values - ---@type blink-cmp-rg.Options + ---@type blink-ripgrep.Options opts = { -- blink.cmp get prefix in a different way, -- thus use `prefix_min_len` instead of `min_keyword_length` diff --git a/blink-cmp-rg.nvim-scm-1.rockspec b/blink-ripgrep.nvim-scm-1.rockspec similarity index 82% rename from blink-cmp-rg.nvim-scm-1.rockspec rename to blink-ripgrep.nvim-scm-1.rockspec index 7d64143..b8648d1 100644 --- a/blink-cmp-rg.nvim-scm-1.rockspec +++ b/blink-ripgrep.nvim-scm-1.rockspec @@ -1,9 +1,9 @@ ---@diagnostic disable: lowercase-global rockspec_format = "3.0" -package = "blink-cmp-rg.nvim" +package = "blink-ripgrep.nvim" version = "scm-1" source = { - url = "git+https://github.com/mikavilpas/blink-cmp-rg.nvim", + url = "git+https://github.com/mikavilpas/blink-ripgrep.nvim", } dependencies = { -- Add runtime dependencies here diff --git a/integration-tests/cypress/e2e/cmp-rg/health_spec.cy.ts b/integration-tests/cypress/e2e/cmp-rg/health_spec.cy.ts index 1cacf87..ff631bb 100644 --- a/integration-tests/cypress/e2e/cmp-rg/health_spec.cy.ts +++ b/integration-tests/cypress/e2e/cmp-rg/health_spec.cy.ts @@ -5,8 +5,8 @@ describe("the healthcheck", () => { // wait until text on the start screen is visible cy.contains("If you see this text, Neovim is ready!") - cy.typeIntoTerminal(":checkhealth blink-cmp-rg{enter}") - cy.contains("OK blink-cmp-rg") + cy.typeIntoTerminal(":checkhealth blink-ripgrep{enter}") + cy.contains("OK blink-ripgrep") cy.contains("WARN").should("not.exist") }) }) diff --git a/integration-tests/package.json b/integration-tests/package.json index adf57be..a222d54 100644 --- a/integration-tests/package.json +++ b/integration-tests/package.json @@ -1,5 +1,5 @@ { - "name": "@blink-cmp-rg.nvim/integration-tests", + "name": "@blink-ripgrep.nvim/integration-tests", "version": "0.0.0", "private": true, "type": "module", diff --git a/integration-tests/test-environment/test-setup.lua b/integration-tests/test-environment/test-setup.lua index 32a4845..30c41b8 100644 --- a/integration-tests/test-environment/test-setup.lua +++ b/integration-tests/test-environment/test-setup.lua @@ -2,7 +2,7 @@ -- integration tests. It should be executed before running the tests. ---@module "lazy" ----@module "blink-cmp-rg" +---@module "blink-ripgrep" ---@module "catppuccin" -- DO NOT change the paths and don't remove the colorscheme @@ -58,9 +58,9 @@ local plugins = { }, providers = { ripgrep = { - module = "blink-cmp-rg", + module = "blink-ripgrep", name = "Ripgrep", - ---@type blink-cmp-rg.Options + ---@type blink-ripgrep.Options opts = { -- }, @@ -81,7 +81,7 @@ local plugins = { }, }, { - "https://github.com/niuiic/blink-cmp-rg.nvim", + "mikavilpas/blink-ripgrep.nvim", -- for tests, always use the code from this repository dir = "../..", }, diff --git a/lua/blink-cmp-rg/health.lua b/lua/blink-ripgrep/health.lua similarity index 79% rename from lua/blink-cmp-rg/health.lua rename to lua/blink-ripgrep/health.lua index 6a54383..880064d 100644 --- a/lua/blink-cmp-rg/health.lua +++ b/lua/blink-ripgrep/health.lua @@ -2,12 +2,12 @@ -- https://github.com/neovim/neovim/blob/b7779c514632f8c7f791c92203a96d43fffa57c6/runtime/doc/pi_health.txt#L17 return { check = function() - vim.health.start("blink-cmp-rg") + vim.health.start("blink-ripgrep") if vim.fn.executable("rg") ~= 1 then vim.health.warn("rg (ripgrep) not found on PATH") end - vim.health.ok("blink-cmp-rg") + vim.health.ok("blink-ripgrep") end, } diff --git a/lua/blink-cmp-rg/init.lua b/lua/blink-ripgrep/init.lua similarity index 90% rename from lua/blink-cmp-rg/init.lua rename to lua/blink-ripgrep/init.lua index b7e8cea..285f848 100644 --- a/lua/blink-cmp-rg/init.lua +++ b/lua/blink-ripgrep/init.lua @@ -1,18 +1,18 @@ ---@module "blink.cmp" ----@class blink-cmp-rg.Options +---@class blink-ripgrep.Options ---@field prefix_min_len? number ---@field get_command? fun(context: blink.cmp.Context, prefix: string): string[] ---@field get_prefix? fun(context: blink.cmp.Context): string ----@class blink-cmp-rg.RgSource : blink.cmp.Source +---@class blink-ripgrep.RgSource : blink.cmp.Source ---@field prefix_min_len number ---@field get_command fun(context: blink.cmp.Context, prefix: string): string[] ---@field get_prefix fun(context: blink.cmp.Context): string ---@field get_completions? fun(self: blink.cmp.Source, context: blink.cmp.Context, callback: fun(response: blink.cmp.CompletionResponse | nil)): nil local RgSource = {} ----@param opts blink-cmp-rg.Options +---@param opts blink-ripgrep.Options function RgSource.new(opts) opts = opts or {} @@ -56,7 +56,7 @@ function RgSource:get_completions(context, resolve) local lines = vim.split(result.stdout, "\n") local cwd = vim.uv.cwd() or "" - local parsed = require("blink-cmp-rg.ripgrep_parser").parse(lines, cwd) + local parsed = require("blink-ripgrep.ripgrep_parser").parse(lines, cwd) ---@type table local items = {} @@ -65,7 +65,7 @@ function RgSource:get_completions(context, resolve) ---@diagnostic disable-next-line: missing-fields items[match.match.text] = { documentation = table.concat(file.lines, "\n"), - source_id = "blink-cmp-rg", + source_id = "blink-ripgrep", label = match.match.text .. " (rg)", insertText = match.match.text, } diff --git a/lua/blink-cmp-rg/ripgrep_parser.lua b/lua/blink-ripgrep/ripgrep_parser.lua similarity index 100% rename from lua/blink-cmp-rg/ripgrep_parser.lua rename to lua/blink-ripgrep/ripgrep_parser.lua diff --git a/package.json b/package.json index b82a93c..1c5df49 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "@blink-cmp-rg/monorepo", + "name": "@blink-ripgrep/monorepo", "version": "1.0.0", "private": true, "license": "MIT", diff --git a/spec/blink-cmp-rg/rg-output.jsonl b/spec/blink-ripgrep/rg-output.jsonl similarity index 100% rename from spec/blink-cmp-rg/rg-output.jsonl rename to spec/blink-ripgrep/rg-output.jsonl diff --git a/spec/blink-cmp-rg/ripgrep_parser_spec.lua b/spec/blink-ripgrep/ripgrep_parser_spec.lua similarity index 86% rename from spec/blink-cmp-rg/ripgrep_parser_spec.lua rename to spec/blink-ripgrep/ripgrep_parser_spec.lua index ab6ecde..e443cda 100644 --- a/spec/blink-cmp-rg/ripgrep_parser_spec.lua +++ b/spec/blink-ripgrep/ripgrep_parser_spec.lua @@ -1,9 +1,9 @@ -local ripgrep_parser = require("blink-cmp-rg.ripgrep_parser") +local ripgrep_parser = require("blink-ripgrep.ripgrep_parser") local assert = require("luassert") describe("ripgrep_parser", function() local ripgrep_output_lines = - vim.fn.readfile("spec/blink-cmp-rg/rg-output.jsonl") + vim.fn.readfile("spec/blink-ripgrep/rg-output.jsonl") it("can parse according to the expected schema", function() local result = ripgrep_parser.parse(ripgrep_output_lines, "/home/user")