"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
    __setModuleDefault(result, mod);
    return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.JavaLspService = void 0;
const path = __importStar(require("path"));
const cp = __importStar(require("child_process"));
const common_1 = require("./common");
const util_1 = require("../../../util/util");
class JavaLspService extends common_1.CommonLspService {
    constructor() {
        super(...arguments);
        this.languageIdMap = new Map([
            ['.java', 'java'],
        ]);
    }
    startLspServer() {
        const os = (0, util_1.getPlatform)();
        const confDir = path.normalize(path.join(this.lspServerBin, '../../', `config_${os}`));
        const args = [
            '-Declipse.application=org.eclipse.jdt.ls.core.id1',
            '-Dosgi.bundles.defaultStartLevel=4',
            '-Declipse.product=org.eclipse.jdt.ls.core.product',
            '-Dlog.level=ALL',
            '-noverify',
            '-Xmx1G',
            '-jar',
            this.lspServerBin,
            '-configuration',
            confDir,
            '-data',
            './data',
            '--add-modules=ALL-SYSTEM',
            '--add-opens',
            'java.base/java.util=ALL-UNNAMED',
            '--add-opens',
            'java.base/java.lang=ALL-UNNAMED'
        ];
        return cp.spawn('java', args);
    }
    getCapabilities() {
        return {
            textDocument: {
                documentSymbol: {
                    hierarchicalDocumentSymbolSupport: true,
                },
                moniker: {},
            },
        };
    }
}
exports.JavaLspService = JavaLspService;
