diff options
| author | Jacob McDonnell <jacob@jacobmcdonnell.com> | 2024-12-05 13:34:46 -0500 |
|---|---|---|
| committer | Jacob McDonnell <jacob@jacobmcdonnell.com> | 2024-12-05 13:34:46 -0500 |
| commit | 5849e2ad7323f086bd6edf221b29e3f0b2b7cbd3 (patch) | |
| tree | bb437c98f3661b5a3ac9d721dadd2c7b6e629692 /.config/coc/extensions/node_modules/coc-go/lib/commands.js | |
| parent | 6e5c51a6ee731e17e81cc5e23867dbd4ddc006e0 (diff) | |
Removed Useless Configs
Diffstat (limited to '.config/coc/extensions/node_modules/coc-go/lib/commands.js')
| -rw-r--r-- | .config/coc/extensions/node_modules/coc-go/lib/commands.js | 125 |
1 files changed, 0 insertions, 125 deletions
diff --git a/.config/coc/extensions/node_modules/coc-go/lib/commands.js b/.config/coc/extensions/node_modules/coc-go/lib/commands.js deleted file mode 100644 index f77d866..0000000 --- a/.config/coc/extensions/node_modules/coc-go/lib/commands.js +++ /dev/null @@ -1,125 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.installTools = exports.installImpl = exports.installGoplay = exports.installGotests = exports.installGomodifytags = exports.checkGopls = exports.installGopls = exports.version = void 0; -const tslib_1 = require("tslib"); -const path_1 = tslib_1.__importDefault(require("path")); -const fs_1 = tslib_1.__importDefault(require("fs")); -const coc_nvim_1 = require("coc.nvim"); -const tools_1 = require("./utils/tools"); -const checktag_1 = tslib_1.__importDefault(require("./utils/checktag")); -const ui_1 = require("./utils/ui"); -const config_1 = require("./utils/config"); -const binaries_1 = require("./binaries"); -const versions_1 = require("./utils/versions"); -async function version() { - const v1 = await pkgVersion(); - const v2 = await goplsVersion() || 'unknown'; - coc_nvim_1.window.showMessage(`Version: coc-go ${v1}; gopls ${v2}`, 'more'); -} -exports.version = version; -async function installGopls(client) { - await (0, tools_1.installGoBin)(binaries_1.GOPLS, true, goplsVersion); - if (client.needsStop()) { - await client.stop(); - client.restart(); - } -} -exports.installGopls = installGopls; -const checkInterval = 24 * 60 * 60 * 1000; -async function shouldCheckGopls() { - const now = new Date().getTime(); - const last = await (0, config_1.getState)('gopls:last-check'); - if (last - (now - checkInterval) < 0) { - await (0, config_1.setState)('gopls:last-check', new Date().getTime()); - return true; - } - return false; -} -async function checkGopls(client, mode) { - try { - if (!(await shouldCheckGopls())) { - return; - } - let install = false; - await (0, ui_1.withProgress)('Checking for new gopls version', async () => { - const [current, latest] = await Promise.all([ - goplsVersion(), - (0, checktag_1.default)("golang/tools", /^gopls\//), - ]); - if (!(0, versions_1.isValidVersion)(current) || !(0, versions_1.isValidVersion)(latest)) { - coc_nvim_1.window.showMessage('checking for a new gopls version failed', 'warning'); - return; - } - switch ((0, versions_1.compareVersions)(latest, current)) { - case 0: - coc_nvim_1.window.showMessage(`[gopls] up-to-date: ${current}`, 'more'); - break; - case 1: - switch (mode) { - case 'install': - install = true; - break; - case 'ask': - install = await coc_nvim_1.window.showPrompt(`[gopls] Install update? ${current} => ${latest}`); - break; - case 'inform': - coc_nvim_1.window.showMessage(`[gopls] update available: ${current} => ${latest}`); - break; - } - break; - case -1: - coc_nvim_1.window.showMessage(`[gopls] current: ${current} | latest: ${latest}`, 'more'); - break; - } - }); - if (install) { - await installGopls(client); - } - } - catch (e) { - coc_nvim_1.window.showMessage(e.toString(), 'error'); - } -} -exports.checkGopls = checkGopls; -async function pkgVersion() { - try { - const pkgPath = path_1.default.resolve(__dirname, '..', 'package.json'); - const pkgContent = await fs_1.default.promises.readFile(pkgPath, 'utf8'); - return JSON.parse(pkgContent).version; - } - catch (err) { - console.error(err); - } - return ''; -} -async function goplsVersion() { - const [, versionOut] = await (0, tools_1.runGoTool)("gopls", ["version"]); - const m = versionOut.trim().match(/\s{4}golang\.org\/x\/tools\/gopls@(v?\d+\.\d+\.\d+) .*/); - if (m && (0, versions_1.isValidVersion)(m[1])) { - return m[1].replace(/^v/, ''); - } - return ''; -} -async function installGomodifytags() { - await (0, tools_1.installGoBin)(binaries_1.GOMODIFYTAGS, true); -} -exports.installGomodifytags = installGomodifytags; -async function installGotests() { - await (0, tools_1.installGoBin)(binaries_1.GOTESTS, true); -} -exports.installGotests = installGotests; -async function installGoplay() { - await (0, tools_1.installGoBin)(binaries_1.GOPLAY, true); -} -exports.installGoplay = installGoplay; -async function installImpl() { - await (0, tools_1.installGoBin)(binaries_1.IMPL, true); -} -exports.installImpl = installImpl; -async function installTools() { - for (const tool of binaries_1.TOOLS) { - await (0, tools_1.installGoBin)(tool, true); - } -} -exports.installTools = installTools; -//# sourceMappingURL=commands.js.map
\ No newline at end of file |
