aboutsummaryrefslogtreecommitdiffstats
path: root/lua/nvim-lsp-installer/core
diff options
context:
space:
mode:
authorWilliam Boman <william@redwill.se>2022-06-03 19:04:52 +0200
committerGitHub <noreply@github.com>2022-06-03 19:04:52 +0200
commitf5f6538984b5bc9bccfc544960e05d47304f3c5e (patch)
tree9f1f0fcd3b35a7ace0efc9966b652bb9b8234121 /lua/nvim-lsp-installer/core
parentadded wgsl_analyzer server (#719) (diff)
downloadmason-f5f6538984b5bc9bccfc544960e05d47304f3c5e.tar
mason-f5f6538984b5bc9bccfc544960e05d47304f3c5e.tar.gz
mason-f5f6538984b5bc9bccfc544960e05d47304f3c5e.tar.bz2
mason-f5f6538984b5bc9bccfc544960e05d47304f3c5e.tar.lz
mason-f5f6538984b5bc9bccfc544960e05d47304f3c5e.tar.xz
mason-f5f6538984b5bc9bccfc544960e05d47304f3c5e.tar.zst
mason-f5f6538984b5bc9bccfc544960e05d47304f3c5e.zip
feat: add apex_ls (#746)
Closes #701.
Diffstat (limited to 'lua/nvim-lsp-installer/core')
-rw-r--r--lua/nvim-lsp-installer/core/functional/init.lua2
-rw-r--r--lua/nvim-lsp-installer/core/functional/list.lua5
-rw-r--r--lua/nvim-lsp-installer/core/functional/string.lua7
-rw-r--r--lua/nvim-lsp-installer/core/managers/cargo/client.lua2
-rw-r--r--lua/nvim-lsp-installer/core/managers/github/client.lua5
5 files changed, 18 insertions, 3 deletions
diff --git a/lua/nvim-lsp-installer/core/functional/init.lua b/lua/nvim-lsp-installer/core/functional/init.lua
index 6987e1a7..3e29037f 100644
--- a/lua/nvim-lsp-installer/core/functional/init.lua
+++ b/lua/nvim-lsp-installer/core/functional/init.lua
@@ -32,6 +32,7 @@ _.concat = list.concat
_.zip_table = list.zip_table
_.nth = list.nth
_.head = list.head
+_.length = list.length
-- relation
local relation = require "nvim-lsp-installer.core.functional.relation"
@@ -62,6 +63,7 @@ local string = require "nvim-lsp-installer.core.functional.string"
_.matches = string.matches
_.format = string.format
_.split = string.split
+_.gsub = string.gsub
-- table
local tbl = require "nvim-lsp-installer.core.functional.table"
diff --git a/lua/nvim-lsp-installer/core/functional/list.lua b/lua/nvim-lsp-installer/core/functional/list.lua
index c12330dd..89393cfb 100644
--- a/lua/nvim-lsp-installer/core/functional/list.lua
+++ b/lua/nvim-lsp-installer/core/functional/list.lua
@@ -115,4 +115,9 @@ end, 2)
_.head = _.nth(1)
+---@param value string|any[]
+_.length = function(value)
+ return #value
+end
+
return _
diff --git a/lua/nvim-lsp-installer/core/functional/string.lua b/lua/nvim-lsp-installer/core/functional/string.lua
index 3fd3aa03..212fc0d9 100644
--- a/lua/nvim-lsp-installer/core/functional/string.lua
+++ b/lua/nvim-lsp-installer/core/functional/string.lua
@@ -20,4 +20,11 @@ _.split = fun.curryN(function(sep, str)
return vim.split(str, sep)
end, 2)
+---@param pattern string
+---@param repl string|function|table
+---@param str string
+_.gsub = fun.curryN(function(pattern, repl, str)
+ return string.gsub(str, pattern, repl)
+end, 3)
+
return _
diff --git a/lua/nvim-lsp-installer/core/managers/cargo/client.lua b/lua/nvim-lsp-installer/core/managers/cargo/client.lua
index 7e69cdf4..d4f0e2a7 100644
--- a/lua/nvim-lsp-installer/core/managers/cargo/client.lua
+++ b/lua/nvim-lsp-installer/core/managers/cargo/client.lua
@@ -6,7 +6,7 @@ local M = {}
---@async
---@param crate string
----@return Result @of [Crate]
+---@return Result @of Crate
function M.fetch_crate(crate)
return fetch(("https://crates.io/api/v1/crates/%s"):format(crate)):map_catching(vim.json.decode)
end
diff --git a/lua/nvim-lsp-installer/core/managers/github/client.lua b/lua/nvim-lsp-installer/core/managers/github/client.lua
index bf79fec6..530fee06 100644
--- a/lua/nvim-lsp-installer/core/managers/github/client.lua
+++ b/lua/nvim-lsp-installer/core/managers/github/client.lua
@@ -24,6 +24,7 @@ end
---@async
---@param repo string @The GitHub repo ("username/repo").
+---@return Result @of GitHubRelease[]
function M.fetch_releases(repo)
log.fmt_trace("Fetching GitHub releases for repo=%s", repo)
local path = ("repos/%s/releases"):format(repo)
@@ -87,7 +88,7 @@ end
---@async
---@param repo string @The GitHub repo ("username/repo").
----@return Result @of [GitHubTag[]]
+---@return Result @of GitHubTag[]
function M.fetch_tags(repo)
local path = ("repos/%s/tags"):format(repo)
return api_call(path):map_err(function()
@@ -97,7 +98,7 @@ end
---@async
---@param repo string @The GitHub repo ("username/repo").
----@return Result @of [GitHubTag]
+---@return Result @of GitHubTag
function M.fetch_latest_tag(repo)
return M.fetch_tags(repo):map_catching(function(tags)
if vim.tbl_count(tags) == 0 then