nvim/coc/extensions/node_modules/coc-go/lib/utils/config.js

27 lines
970 B
JavaScript
Raw Normal View History

2021-03-09 22:18:08 +00:00
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.configDir = exports.setStoragePath = exports.getConfig = void 0;
const tslib_1 = require("tslib");
const path_1 = tslib_1.__importDefault(require("path"));
const os_1 = tslib_1.__importDefault(require("os"));
const coc_nvim_1 = require("coc.nvim");
const fs_1 = require("./fs");
const state = {};
function getConfig() {
return coc_nvim_1.workspace.getConfiguration().get("go");
}
exports.getConfig = getConfig;
function setStoragePath(dir) {
state.storagePath = dir;
}
exports.setStoragePath = setStoragePath;
async function configDir(...names) {
const storage = state.storagePath || path_1.default.join(os_1.default.homedir(), ".config", "coc", "go");
const dir = path_1.default.join(storage, ...names);
return new Promise((resolve) => {
fs_1.createDir(dir);
resolve(dir);
});
}
exports.configDir = configDir;
//# sourceMappingURL=config.js.map