private LspInstallResult fetchLspInstallation()

in plugin/src/software/aws/toolkits/eclipse/amazonq/lsp/manager/DefaultLspManager.java [79:120]


    private LspInstallResult fetchLspInstallation() {
        var startTime = Instant.now();
        // retrieve local lsp overrides and use that if valid
        var overrideResult = getLocalLspOverride();

        if (overrideResult != null && hasValidResult(overrideResult)) {
            Activator.getLogger().info(String.format("Launching Amazon Q language server from local override location: %s, with command: %s and args: %s",
                    overrideResult.getServerDirectory(), overrideResult.getServerCommand(), overrideResult.getServerCommandArgs()));
            emitGetServerWithOverride(startTime);
            return overrideResult;
        }
        Manifest manifest = fetchManifest();

        if (manifest.isManifestDeprecated() && manifest.manifestSchemaVersion() != null) {
            try {
                showDeprecatedManifestNotification(manifest.manifestSchemaVersion());
            } catch (Exception e) {
                Activator.getLogger().error("Failed to show deprecated manifest notification", e);
            }
        }

        var platform = platformOverride != null ? platformOverride : PluginUtils.getPlatform();
        var architecture = architectureOverride != null ? architectureOverride : PluginUtils.getArchitecture();

        startTime = Instant.now();
        var lspFetcher = createLspFetcher(manifest);
        var fetchResult = lspFetcher.fetch(platform, architecture, workingDirectory, startTime);

        // initiate cleanup on a background thread
        initiateCleanup(lspFetcher);

        // set the command and args with the necessary values to launch the Q language server when retrieved from remote/local cache
        var result = new LspInstallResult();
        result.setLocation(fetchResult.location());
        result.setVersion(fetchResult.version());
        result.setServerDirectory(Paths.get(fetchResult.assetDirectory(), LspConstants.LSP_SERVER_FOLDER).toString());
        result.setClientDirectory(Paths.get(fetchResult.assetDirectory(), LspConstants.LSP_CLIENT_FOLDER).toString());
        result.setServerCommand(getNodeForPlatform());
        result.setServerCommandArgs(lspExecutablePrefix);

        return result;
    }