diff --git a/README.md b/README.md index cf43431c75..c564179a1b 100644 --- a/README.md +++ b/README.md @@ -297,6 +297,7 @@ require("nvim-lsp-installer").setup({ | V | `vls` | | Vala | `vala_ls` | | VimL | `vimls` | +| Visualforce | `visualforce` | | Vue | `volar` | | Vue | `vuels` | | XML | `lemminx` | diff --git a/lua/nvim-lsp-installer/_generated/filetype_map.lua b/lua/nvim-lsp-installer/_generated/filetype_map.lua index 6ecc014ebb..79213e9b99 100644 --- a/lua/nvim-lsp-installer/_generated/filetype_map.lua +++ b/lua/nvim-lsp-installer/_generated/filetype_map.lua @@ -148,6 +148,7 @@ return { vb = { "omnisharp" }, verilog = { "svls", "verible" }, vim = { "vimls" }, + visualforce = { "visualforce_ls" }, vlang = { "vls" }, vmasm = { "asm_lsp" }, vue = { "eslint", "stylelint_lsp", "tailwindcss", "volar", "vuels" }, diff --git a/lua/nvim-lsp-installer/_generated/metadata.lua b/lua/nvim-lsp-installer/_generated/metadata.lua index c0986d4c31..40954725c3 100644 --- a/lua/nvim-lsp-installer/_generated/metadata.lua +++ b/lua/nvim-lsp-installer/_generated/metadata.lua @@ -340,6 +340,9 @@ return { vimls = { filetypes = { "vim" } }, + visualforce_ls = { + filetypes = { "visualforce" } + }, vls = { filetypes = { "vlang" } }, diff --git a/lua/nvim-lsp-installer/servers/apex_ls/init.lua b/lua/nvim-lsp-installer/servers/apex_ls/init.lua index 56585b78e8..2ed778a9e5 100644 --- a/lua/nvim-lsp-installer/servers/apex_ls/init.lua +++ b/lua/nvim-lsp-installer/servers/apex_ls/init.lua @@ -1,7 +1,6 @@ local server = require "nvim-lsp-installer.server" local github = require "nvim-lsp-installer.core.managers.github" local github_client = require "nvim-lsp-installer.core.managers.github.client" -local git = require "nvim-lsp-installer.core.managers.git" local Optional = require "nvim-lsp-installer.core.optional" local path = require "nvim-lsp-installer.core.path" local _ = require "nvim-lsp-installer.core.functional" diff --git a/lua/nvim-lsp-installer/servers/init.lua b/lua/nvim-lsp-installer/servers/init.lua index 861f4e0954..0668c6438c 100644 --- a/lua/nvim-lsp-installer/servers/init.lua +++ b/lua/nvim-lsp-installer/servers/init.lua @@ -145,6 +145,7 @@ local CORE_SERVERS = _.set_of { "vala_ls", "verible", "vimls", + "visualforce_ls", "vls", "volar", "vuels", diff --git a/lua/nvim-lsp-installer/servers/visualforce_ls/init.lua b/lua/nvim-lsp-installer/servers/visualforce_ls/init.lua new file mode 100644 index 0000000000..fb6b559ee7 --- /dev/null +++ b/lua/nvim-lsp-installer/servers/visualforce_ls/init.lua @@ -0,0 +1,50 @@ +local server = require "nvim-lsp-installer.server" +local github = require "nvim-lsp-installer.core.managers.github" +local github_client = require "nvim-lsp-installer.core.managers.github.client" +local Optional = require "nvim-lsp-installer.core.optional" +local path = require "nvim-lsp-installer.core.path" +local _ = require "nvim-lsp-installer.core.functional" + +return function(name, root_dir) + return server.Server:new { + name = name, + root_dir = root_dir, + homepage = "https://github.com/forcedotcom/salesforcedx-vscode", + languages = { "visualforce" }, + ---@async + installer = function() + local repo = "forcedotcom/salesforcedx-vscode" + + -- See https://github.com/forcedotcom/salesforcedx-vscode/issues/4184#issuecomment-1146052086 + ---@type GitHubRelease + local release = github_client + .fetch_releases(repo) + :map(_.find_first(_.prop_satisfies(_.compose(_.gt(0), _.length), "assets"))) + :map(Optional.of_nilable) + :get_or_throw() -- Result unwrap + :or_else_throw "Failed to find release with assets." -- Optional unwrap + + github.unzip_release_file({ + version = Optional.of(release.tag_name), + asset_file = _.compose(_.format "salesforcedx-vscode-visualforce-%s.vsix", _.gsub("^v", "")), + repo = repo, + }).with_receipt() + end, + default_options = { + cmd = { + "node", + path.concat { + root_dir, + "extension", + "node_modules", + "@salesforce", + "salesforcedx-visualforce-language-server", + "out", + "src", + "visualforceServer.js", + }, + "--stdio", + }, + }, + } +end