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,KAAK,IAAI,WAAW,SAChB,OAAO,IAAI,mBAAmB,SAClC,KAAK,IAAI,WAAW,OACpB,KAAK,IAAI,WAAW,OACpB,KAAK,IAAI,WAAW,QACpB,KAAK,IAAI,WAAW,MACpB,KAAK,IAAI,WAAW,IACpB,KAAK,IAAI,WAAW,KAChB,OAAO,IAAI,mBAAmB,KAClC,KAAK,IAAI,WAAW,OAChB,OAAO,IAAI,mBAAmB,OAClC,KAAK,IAAI,WAAW,WAChB,OAAO,IAAI,mBAAmB,WAClC,KAAK,IAAI,WAAW,OAChB,OAAO,IAAI,mBAAmB,OAClC,KAAK,IAAI,WAAW,MAChB,OAAO,IAAI,mBAAmB,MAClC,KAAK,IAAI,WAAW,SAChB,OAAO,IAAI,mBAAmB,SAClC,KAAK,IAAI,WAAW,cAChB,OAAO,IAAI,mBAAmB,cAClC,QACI,OAAO,IAAI,mBAAmB,KAE1C,CACA,SAAS,wBAAwB,GAC7B,OAAQ,GACJ,KAAK,IAAI,WAAW,SAChB,MAAO,WACX,KAAK,IAAI,WAAW,SAChB,MAAO,WACX,QACI,MAAO,UAEnB,CACA,SAAS,mBAAmB,EAAe,GACvC,MAAO,CACH,MAAO,EAEC,CAAC,OAAS,EAAU,EAAe,OAAO,KAAK,MACjD,EACN,KAAM,IAAI,WAAW,SAE7B,CACA,SAAS,kBAAkB,EAAM,GAC7B,MAAM,GAAU,EAAI,qBAAqB,WAAW,KAAK,KAAK,UAAW,yBAA0B,CAAC,EAAM,IAC1G,OAAuB,IAAnB,EAAQ,OACD,GAEJ,EAAQ,OACV,WACA,MAAM,MACN,KAAK,GAAM,EAAE,SACb,QAAQ,GAAM,EAAE,OAAS,GAClC,CA/FA,QAAQ,QAAU","file":"/npm/bash-language-server@5.6.0/out/server.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/bash-language-server@5.6.0/out/server.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","\"use strict\";\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n    return new (P || (P = Promise))(function (resolve, reject) {\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\n    });\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.getCommandOptions = getCommandOptions;\nconst node_child_process_1 = require(\"node:child_process\");\nconst path = require(\"node:path\");\nconst node_util_1 = require(\"node:util\");\nconst TurndownService = require(\"turndown\");\nconst LSP = require(\"vscode-languageserver/node\");\nconst vscode_languageserver_textdocument_1 = require(\"vscode-languageserver-textdocument\");\nconst analyser_1 = require(\"./analyser\");\nconst Builtins = require(\"./builtins\");\nconst config = require(\"./config\");\nconst executables_1 = require(\"./executables\");\nconst parser_1 = require(\"./parser\");\nconst ReservedWords = require(\"./reserved-words\");\nconst shellcheck_1 = require(\"./shellcheck\");\nconst shfmt_1 = require(\"./shfmt\");\nconst snippets_1 = require(\"./snippets\");\nconst types_1 = require(\"./types\");\nconst array_1 = require(\"./util/array\");\nconst logger_1 = require(\"./util/logger\");\nconst lsp_1 = require(\"./util/lsp\");\nconst sh_1 = require(\"./util/sh\");\nconst PARAMETER_EXPANSION_PREFIXES = new Set(['$', '${']);\nconst CONFIGURATION_SECTION = 'bashIde';\n/**\n * The BashServer glues together the separate components to implement\n * the various parts of the Language Server Protocol.\n */\nclass BashServer {\n    constructor({ analyzer, capabilities, connection, executables, linter, formatter, workspaceFolder, }) {\n        this.documents = new LSP.TextDocuments(vscode_languageserver_textdocument_1.TextDocument);\n        this.uriToCodeActions = {};\n        this.analyzer = analyzer;\n        this.clientCapabilities = capabilities;\n        this.connection = connection;\n        this.executables = executables;\n        this.linter = linter;\n        this.formatter = formatter;\n        this.workspaceFolder = workspaceFolder;\n        this.config = {}; // NOTE: configured in updateConfiguration\n        this.updateConfiguration(config.getDefaultConfiguration(), true);\n    }\n    /**\n     * Initialize the server based on a connection to the client and the protocols\n     * initialization parameters.\n     */\n    static initialize(connection_1, _a) {\n        return __awaiter(this, arguments, void 0, function* (connection, { rootPath, rootUri, capabilities }) {\n            (0, logger_1.setLogConnection)(connection);\n            logger_1.logger.debug('Initializing...');\n            const { PATH } = process.env;\n            const workspaceFolder = rootUri || rootPath || null;\n            if (!PATH) {\n                throw new Error('Expected PATH environment variable to be set');\n            }\n            const parser = yield (0, parser_1.initializeParser)();\n            const analyzer = new analyser_1.default({\n                parser,\n                workspaceFolder,\n            });\n            const executables = yield executables_1.default.fromPath(PATH);\n            const server = new BashServer({\n                analyzer,\n                capabilities,\n                connection,\n                executables,\n                workspaceFolder,\n            });\n            logger_1.logger.debug('Initialized');\n            return server;\n        });\n    }\n    /**\n     * The parts of the Language Server Protocol that we are currently supporting.\n     */\n    capabilities() {\n        return {\n            // For now we're using full-sync even though tree-sitter has great support\n            // for partial updates.\n            textDocumentSync: LSP.TextDocumentSyncKind.Full,\n            completionProvider: {\n                resolveProvider: true,\n                triggerCharacters: ['$', '{'],\n            },\n            hoverProvider: true,\n            documentHighlightProvider: true,\n            definitionProvider: true,\n            documentSymbolProvider: true,\n            workspaceSymbolProvider: true,\n            referencesProvider: true,\n            codeActionProvider: {\n                codeActionKinds: [LSP.CodeActionKind.QuickFix],\n                resolveProvider: false,\n                workDoneProgress: false,\n            },\n            renameProvider: { prepareProvider: true },\n            documentFormattingProvider: true,\n        };\n    }\n    /**\n     * Register handlers for the events from the Language Server Protocol that we\n     * care about.\n     */\n    register(connection) {\n        var _a, _b, _c, _d, _e;\n        const hasConfigurationCapability = !!((_b = (_a = this.clientCapabilities) === null || _a === void 0 ? void 0 : _a.workspace) === null || _b === void 0 ? void 0 : _b.configuration);\n        const canDynamicallyRegisterConfigurationChangeNotification = !!((_e = (_d = (_c = this.clientCapabilities) === null || _c === void 0 ? void 0 : _c.workspace) === null || _d === void 0 ? void 0 : _d.didChangeConfiguration) === null || _e === void 0 ? void 0 : _e.dynamicRegistration);\n        let currentDocument = null;\n        let initialized = false; // Whether the client finished initializing\n        this.documents.listen(this.connection);\n        this.documents.onDidChangeContent(({ document }) => {\n            // The content of a text document has changed. This event is emitted\n            // when the text document first opened or when its content has changed.\n            currentDocument = document;\n            if (initialized) {\n                this.analyzeAndLintDocument(document);\n            }\n        });\n        this.documents.onDidClose((event) => {\n            connection.sendDiagnostics({ uri: event.document.uri, diagnostics: [] });\n            delete this.uriToCodeActions[event.document.uri];\n        });\n        // Register all the handlers for the LSP events.\n        connection.onCodeAction(this.onCodeAction.bind(this));\n        connection.onCompletion(this.onCompletion.bind(this));\n        connection.onCompletionResolve(this.onCompletionResolve.bind(this));\n        connection.onDefinition(this.onDefinition.bind(this));\n        connection.onDocumentHighlight(this.onDocumentHighlight.bind(this));\n        connection.onDocumentSymbol(this.onDocumentSymbol.bind(this));\n        connection.onHover(this.onHover.bind(this));\n        connection.onReferences(this.onReferences.bind(this));\n        connection.onWorkspaceSymbol(this.onWorkspaceSymbol.bind(this));\n        connection.onPrepareRename(this.onPrepareRename.bind(this));\n        connection.onRenameRequest(this.onRenameRequest.bind(this));\n        connection.onDocumentFormatting(this.onDocumentFormatting.bind(this));\n        /**\n         * The initialized notification is sent from the client to the server after\n         * the client received the result of the initialize request but before the\n         * client is sending any other request or notification to the server.\n         * The server can use the initialized notification for example to dynamically\n         * register capabilities. The initialized notification may only be sent once.\n         */\n        connection.onInitialized(() => __awaiter(this, void 0, void 0, function* () {\n            const { config: environmentConfig, environmentVariablesUsed } = config.getConfigFromEnvironmentVariables();\n            if (environmentVariablesUsed.length > 0) {\n                this.updateConfiguration(environmentConfig);\n                logger_1.logger.warn(`Environment variable configuration is being deprecated, please use workspace configuration. The following environment variables were used: ${environmentVariablesUsed.join(', ')}`);\n            }\n            if (hasConfigurationCapability) {\n                // Register event for all configuration changes.\n                if (canDynamicallyRegisterConfigurationChangeNotification) {\n                    connection.client.register(LSP.DidChangeConfigurationNotification.type, {\n                        section: CONFIGURATION_SECTION,\n                    });\n                }\n                // get current configuration from client\n                const configObject = yield connection.workspace.getConfiguration(CONFIGURATION_SECTION);\n                this.updateConfiguration(configObject);\n                logger_1.logger.debug('Configuration loaded from client');\n            }\n            initialized = true;\n            if (currentDocument) {\n                // If we already have a document, analyze it now that we're initialized\n                // and the linter is ready.\n                this.analyzeAndLintDocument(currentDocument);\n            }\n            // NOTE: we do not block the server initialization on this background analysis.\n            return { backgroundAnalysisCompleted: this.startBackgroundAnalysis() };\n        }));\n        // Respond to changes in the configuration.\n        connection.onDidChangeConfiguration(({ settings }) => {\n            const configChanged = this.updateConfiguration(settings[CONFIGURATION_SECTION]);\n            if (configChanged && initialized) {\n                logger_1.logger.debug('Configuration changed');\n                this.startBackgroundAnalysis();\n                if (currentDocument) {\n                    this.uriToCodeActions[currentDocument.uri] = undefined;\n                    this.analyzeAndLintDocument(currentDocument);\n                }\n            }\n        });\n        // FIXME: re-lint on workspace folder change\n    }\n    // ==================\n    // Internal functions\n    // ==================\n    startBackgroundAnalysis() {\n        return __awaiter(this, void 0, void 0, function* () {\n            const { workspaceFolder } = this;\n            if (workspaceFolder) {\n                return this.analyzer.initiateBackgroundAnalysis({\n                    globPattern: this.config.globPattern,\n                    backgroundAnalysisMaxFiles: this.config.backgroundAnalysisMaxFiles,\n                });\n            }\n            return Promise.resolve({ filesParsed: 0 });\n        });\n    }\n    updateConfiguration(configObject, isDefaultConfig = false) {\n        var _a;\n        if (typeof configObject === 'object' && configObject !== null) {\n            try {\n                const newConfig = config.ConfigSchema.parse(configObject);\n                if (!(0, node_util_1.isDeepStrictEqual)(this.config, newConfig)) {\n                    this.config = newConfig;\n                    // NOTE: I don't really like this... An alternative would be to pass in the\n                    // shellcheck executable path when linting. We would need to handle\n                    // resetting the canLint flag though.\n                    const { shellcheckPath } = this.config;\n                    if (!shellcheckPath) {\n                        logger_1.logger.info('ShellCheck linting is disabled as \"shellcheckPath\" was not set');\n                        this.linter = undefined;\n                    }\n                    else {\n                        this.linter = new shellcheck_1.Linter({ executablePath: shellcheckPath });\n                    }\n                    const shfmtPath = (_a = this.config.shfmt) === null || _a === void 0 ? void 0 : _a.path;\n                    if (!shfmtPath) {\n                        logger_1.logger.info('Shfmt formatting is disabled as \"shfmt.path\" was not set');\n                        this.formatter = undefined;\n                    }\n                    else {\n                        this.formatter = new shfmt_1.Formatter({ executablePath: shfmtPath });\n                    }\n                    this.analyzer.setEnableSourceErrorDiagnostics(this.config.enableSourceErrorDiagnostics);\n                    this.analyzer.setIncludeAllWorkspaceSymbols(this.config.includeAllWorkspaceSymbols);\n                    if (!isDefaultConfig) {\n                        // We skip setting the log level as the default configuration should\n                        // not override the environment defined log level.\n                        (0, logger_1.setLogLevel)(this.config.logLevel);\n                    }\n                    return true;\n                }\n            }\n            catch (err) {\n                logger_1.logger.warn(`updateConfiguration: failed with ${err}`);\n            }\n        }\n        return false;\n    }\n    /**\n     * Analyze and lint the given document.\n     */\n    analyzeAndLintDocument(document) {\n        return __awaiter(this, void 0, void 0, function* () {\n            const { uri } = document;\n            // Load the tree for the modified contents into the analyzer:\n            let diagnostics = this.analyzer.analyze({ uri, document });\n            // Run ShellCheck diagnostics:\n            if (this.linter) {\n                try {\n                    const sourceFolders = this.workspaceFolder ? [this.workspaceFolder] : [];\n                    const { diagnostics: lintDiagnostics, codeActions } = yield this.linter.lint(document, sourceFolders, this.config.shellcheckArguments);\n                    diagnostics = diagnostics.concat(lintDiagnostics);\n                    this.uriToCodeActions[uri] = codeActions;\n                }\n                catch (err) {\n                    logger_1.logger.error(`Error while linting: ${err}`);\n                }\n            }\n            this.connection.sendDiagnostics({ uri, version: document.version, diagnostics });\n        });\n    }\n    logRequest({ request, params, word, }) {\n        const wordLog = word ? `\"${word}\"` : 'null';\n        logger_1.logger.debug(`${request} ${params.position.line}:${params.position.character} word=${wordLog}`);\n    }\n    getCompletionItemsForSymbols({ symbols, currentUri, }) {\n        return deduplicateSymbols({ symbols, currentUri }).map((symbol) => ({\n            label: symbol.name,\n            kind: symbolKindToCompletionKind(symbol.kind),\n            data: {\n                type: types_1.CompletionItemDataType.Symbol,\n            },\n            documentation: symbol.location.uri !== currentUri\n                ? this.getDocumentationForSymbol({\n                    currentUri,\n                    symbol,\n                })\n                : undefined,\n        }));\n    }\n    getDocumentationForSymbol({ currentUri, symbol, }) {\n        logger_1.logger.debug(`getDocumentationForSymbol: symbol=${symbol.name} uri=${symbol.location.uri}`);\n        const symbolUri = symbol.location.uri;\n        const symbolStartLine = symbol.location.range.start.line;\n        const commentAboveSymbol = this.analyzer.commentsAbove(symbolUri, symbolStartLine);\n        const symbolDocumentation = commentAboveSymbol ? `\\n\\n${commentAboveSymbol}` : '';\n        const hoverHeader = `${symbolKindToDescription(symbol.kind)}: **${symbol.name}**`;\n        const symbolLocation = symbolUri !== currentUri\n            ? `in ${path.relative(path.dirname(currentUri), symbolUri)}`\n            : `on line ${symbolStartLine + 1}`;\n        // TODO: An improvement could be to add show the symbol definition in the hover instead\n        // of the defined location – similar to how VSCode works for languages like TypeScript.\n        return getMarkdownContent(`${hoverHeader} - *defined ${symbolLocation}*${symbolDocumentation}`);\n    }\n    throwResponseError(message, code = LSP.LSPErrorCodes.RequestFailed) {\n        throw new LSP.ResponseError(code, message);\n    }\n    // ==============================\n    // Language server event handlers\n    // ==============================\n    onCodeAction(params) {\n        return __awaiter(this, void 0, void 0, function* () {\n            const codeActionsForUri = this.uriToCodeActions[params.textDocument.uri] || {};\n            const codeActions = params.context.diagnostics\n                .map(({ data }) => codeActionsForUri[data === null || data === void 0 ? void 0 : data.id])\n                .filter((action) => action != null);\n            logger_1.logger.debug(`onCodeAction: found ${codeActions.length} code action(s)`);\n            return codeActions;\n        });\n    }\n    onCompletion(params) {\n        var _a;\n        const word = this.analyzer.wordAtPointFromTextPosition(Object.assign(Object.assign({}, params), { position: {\n                line: params.position.line,\n                // Go one character back to get completion on the current word\n                character: Math.max(params.position.character - 1, 0),\n            } }));\n        this.logRequest({ request: 'onCompletion', params, word });\n        if (word === null || word === void 0 ? void 0 : word.startsWith('#')) {\n            // Inside a comment block\n            return [];\n        }\n        if (word === '{') {\n            // We should not complete when it is not prefixed by a $.\n            // This case needs to be here as \"{\" is a completionProvider triggerCharacter.\n            return [];\n        }\n        if (!word) {\n            const nextCharacter = (_a = this.analyzer.getDocument(params.textDocument.uri)) === null || _a === void 0 ? void 0 : _a.getText({\n                start: params.position,\n                end: Object.assign(Object.assign({}, params.position), { character: params.position.character + 1 }),\n            });\n            const isNextCharacterSpaceOrEmpty = nextCharacter === '' || nextCharacter === ' ';\n            if (!isNextCharacterSpaceOrEmpty) {\n                // We are in the middle of something, so don't complete\n                return [];\n            }\n        }\n        const currentUri = params.textDocument.uri;\n        // TODO: an improvement here would be to detect if the current word is\n        // not only a parameter expansion prefix, but also if the word is actually\n        // inside a parameter expansion (e.g. auto completing on a word $MY_VARIA).\n        const shouldCompleteOnVariables = word\n            ? PARAMETER_EXPANSION_PREFIXES.has(word)\n            : false;\n        const symbolCompletions = word === null\n            ? []\n            : this.getCompletionItemsForSymbols({\n                symbols: shouldCompleteOnVariables\n                    ? this.analyzer.getAllVariables({\n                        uri: currentUri,\n                        position: params.position,\n                    })\n                    : this.analyzer.findDeclarationsMatchingWord({\n                        exactMatch: false,\n                        uri: currentUri,\n                        word,\n                        position: params.position,\n                    }),\n                currentUri,\n            });\n        if (shouldCompleteOnVariables) {\n            // In case we auto complete on a word that starts a parameter expansion,\n            // we do not return anything else than variable/parameter suggestions.\n            // Note: that LSP clients should not call onCompletion in the middle\n            // of a word, so the following should work for client.\n            return symbolCompletions;\n        }\n        const reservedWordsCompletions = ReservedWords.LIST.map((reservedWord) => ({\n            label: reservedWord,\n            kind: LSP.CompletionItemKind.Keyword,\n            data: {\n                type: types_1.CompletionItemDataType.ReservedWord,\n            },\n        }));\n        const programCompletions = this.executables\n            .list()\n            .filter((executable) => !Builtins.isBuiltin(executable))\n            .map((executable) => {\n            return {\n                label: executable,\n                kind: LSP.CompletionItemKind.Function,\n                data: {\n                    type: types_1.CompletionItemDataType.Executable,\n                },\n            };\n        });\n        const builtinsCompletions = Builtins.LIST.map((builtin) => ({\n            label: builtin,\n            kind: LSP.CompletionItemKind.Function,\n            data: {\n                type: types_1.CompletionItemDataType.Builtin,\n            },\n        }));\n        let optionsCompletions = [];\n        if (word === null || word === void 0 ? void 0 : word.startsWith('-')) {\n            const commandName = this.analyzer.commandNameAtPoint(params.textDocument.uri, params.position.line, \n            // Go one character back to get completion on the current word\n            Math.max(params.position.character - 1, 0));\n            if (commandName) {\n                optionsCompletions = getCommandOptions(commandName, word).map((option) => ({\n                    label: option,\n                    kind: LSP.CompletionItemKind.Constant,\n                    data: {\n                        type: types_1.CompletionItemDataType.Symbol,\n                    },\n                    textEdit: {\n                        newText: option.slice(word.length),\n                        range: {\n                            start: {\n                                character: params.position.character,\n                                line: params.position.line,\n                            },\n                            end: {\n                                character: params.position.character,\n                                line: params.position.line,\n                            },\n                        },\n                    },\n                }));\n            }\n        }\n        const allCompletions = [\n            ...reservedWordsCompletions,\n            ...symbolCompletions,\n            ...programCompletions,\n            ...builtinsCompletions,\n            ...optionsCompletions,\n            ...snippets_1.SNIPPETS,\n        ];\n        if (word) {\n            // Filter to only return suffixes of the current word\n            return allCompletions.filter((item) => item.label.startsWith(word));\n        }\n        return allCompletions;\n    }\n    onCompletionResolve(item) {\n        return __awaiter(this, void 0, void 0, function* () {\n            const { label, data: { type }, } = item;\n            logger_1.logger.debug(`onCompletionResolve label=${label} type=${type}`);\n            try {\n                let documentation = null;\n                if (type === types_1.CompletionItemDataType.Executable ||\n                    type === types_1.CompletionItemDataType.Builtin ||\n                    type === types_1.CompletionItemDataType.ReservedWord) {\n                    documentation = yield (0, sh_1.getShellDocumentation)({ word: label });\n                }\n                return documentation\n                    ? Object.assign(Object.assign({}, item), { documentation: getMarkdownContent(documentation, 'man') }) : item;\n            }\n            catch (error) {\n                return item;\n            }\n        });\n    }\n    onDefinition(params) {\n        const word = this.analyzer.wordAtPointFromTextPosition(params);\n        this.logRequest({ request: 'onDefinition', params, word });\n        if (!word) {\n            return null;\n        }\n        return this.analyzer.findDeclarationLocations({\n            position: params.position,\n            uri: params.textDocument.uri,\n            word,\n        });\n    }\n    onDocumentHighlight(params) {\n        const word = this.analyzer.wordAtPointFromTextPosition(params);\n        this.logRequest({ request: 'onDocumentHighlight', params, word });\n        if (!word) {\n            return [];\n        }\n        return this.analyzer\n            .findOccurrences(params.textDocument.uri, word)\n            .map((n) => ({ range: n.range }));\n    }\n    onDocumentSymbol(params) {\n        // TODO: ideally this should return LSP.DocumentSymbol[] instead of LSP.SymbolInformation[]\n        // which is a hierarchy of symbols.\n        // https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_documentSymbol\n        logger_1.logger.debug(`onDocumentSymbol`);\n        return this.analyzer.getDeclarationsForUri({ uri: params.textDocument.uri });\n    }\n    onHover(params) {\n        return __awaiter(this, void 0, void 0, function* () {\n            const word = this.analyzer.wordAtPointFromTextPosition(params);\n            const currentUri = params.textDocument.uri;\n            this.logRequest({ request: 'onHover', params, word });\n            if (!word || word.startsWith('#')) {\n                return null;\n            }\n            const { explainshellEndpoint } = this.config;\n            if (explainshellEndpoint) {\n                try {\n                    const { helpHTML } = yield this.analyzer.getExplainshellDocumentation({\n                        params,\n                        endpoint: explainshellEndpoint,\n                    });\n                    if (helpHTML) {\n                        return {\n                            contents: {\n                                kind: 'markdown',\n                                value: new TurndownService().turndown(helpHTML),\n                            },\n                        };\n                    }\n                }\n                catch (error) {\n                    const errorMessage = error instanceof Error ? error.message : error;\n                    logger_1.logger.warn(`getExplainshellDocumentation exception: ${errorMessage}`);\n                }\n            }\n            const symbolsMatchingWord = this.analyzer.findDeclarationsMatchingWord({\n                exactMatch: true,\n                uri: currentUri,\n                word,\n                position: params.position,\n            });\n            if (ReservedWords.isReservedWord(word) ||\n                Builtins.isBuiltin(word) ||\n                (this.executables.isExecutableOnPATH(word) && symbolsMatchingWord.length == 0)) {\n                logger_1.logger.debug(`onHover: getting shell documentation for reserved word or builtin or executable`);\n                const shellDocumentation = yield (0, sh_1.getShellDocumentation)({ word });\n                if (shellDocumentation) {\n                    return { contents: getMarkdownContent(shellDocumentation, 'man') };\n                }\n            }\n            else {\n                const symbolDocumentation = deduplicateSymbols({\n                    symbols: symbolsMatchingWord,\n                    currentUri,\n                })\n                    // do not return hover referencing for the current line\n                    .filter((symbol) => symbol.location.uri !== currentUri ||\n                    symbol.location.range.start.line !== params.position.line)\n                    .map((symbol) => this.getDocumentationForSymbol({ currentUri, symbol }));\n                if (symbolDocumentation.length === 1) {\n                    return { contents: symbolDocumentation[0] };\n                }\n            }\n            return null;\n        });\n    }\n    onReferences(params) {\n        const word = this.analyzer.wordAtPointFromTextPosition(params);\n        this.logRequest({ request: 'onReferences', params, word });\n        if (!word) {\n            return null;\n        }\n        const isCurrentDeclaration = (l) => l.uri === params.textDocument.uri &&\n            (0, lsp_1.isPositionIncludedInRange)(params.position, l.range);\n        return this.analyzer\n            .findReferences(word)\n            .filter((l) => params.context.includeDeclaration || !isCurrentDeclaration(l));\n    }\n    onWorkspaceSymbol(params) {\n        logger_1.logger.debug('onWorkspaceSymbol');\n        return this.analyzer.findDeclarationsWithFuzzySearch(params.query);\n    }\n    onPrepareRename(params) {\n        const symbol = this.analyzer.symbolAtPointFromTextPosition(params);\n        this.logRequest({ request: 'onPrepareRename', params, word: symbol === null || symbol === void 0 ? void 0 : symbol.word });\n        if (!symbol ||\n            (symbol.kind === LSP.SymbolKind.Variable &&\n                (symbol.word === '_' || !/^[a-z_][\\w]*$/i.test(symbol.word)))) {\n            return null;\n        }\n        return symbol.range;\n    }\n    onRenameRequest(params) {\n        const symbol = this.analyzer.symbolAtPointFromTextPosition(params);\n        this.logRequest({ request: 'onRenameRequest', params, word: symbol === null || symbol === void 0 ? void 0 : symbol.word });\n        if (!symbol) {\n            return null;\n        }\n        if (symbol.kind === LSP.SymbolKind.Variable &&\n            (params.newName === '_' || !/^[a-z_][\\w]*$/i.test(params.newName))) {\n            this.throwResponseError('Invalid variable name given.');\n        }\n        if (symbol.kind === LSP.SymbolKind.Function && params.newName.includes('$')) {\n            this.throwResponseError('Invalid function name given.');\n        }\n        const { declaration, parent } = this.analyzer.findOriginalDeclaration({\n            position: params.position,\n            uri: params.textDocument.uri,\n            word: symbol.word,\n            kind: symbol.kind,\n        });\n        // File-wide rename\n        if (!declaration || parent) {\n            return {\n                changes: {\n                    [params.textDocument.uri]: this.analyzer\n                        .findOccurrencesWithin({\n                        uri: params.textDocument.uri,\n                        word: symbol.word,\n                        kind: symbol.kind,\n                        start: declaration === null || declaration === void 0 ? void 0 : declaration.range.start,\n                        scope: parent === null || parent === void 0 ? void 0 : parent.range,\n                    })\n                        .map((r) => LSP.TextEdit.replace(r, params.newName)),\n                },\n            };\n        }\n        // Workspace-wide rename\n        const edits = {};\n        edits.changes = {\n            [declaration.uri]: this.analyzer\n                .findOccurrencesWithin({\n                uri: declaration.uri,\n                word: symbol.word,\n                kind: symbol.kind,\n                start: declaration.range.start,\n            })\n                .map((r) => LSP.TextEdit.replace(r, params.newName)),\n        };\n        for (const uri of this.analyzer.findAllLinkedUris(declaration.uri)) {\n            edits.changes[uri] = this.analyzer\n                .findOccurrencesWithin({\n                uri,\n                word: symbol.word,\n                kind: symbol.kind,\n            })\n                .map((r) => LSP.TextEdit.replace(r, params.newName));\n        }\n        return edits;\n    }\n    onDocumentFormatting(params) {\n        return __awaiter(this, void 0, void 0, function* () {\n            if (this.formatter) {\n                try {\n                    const document = this.documents.get(params.textDocument.uri);\n                    if (!document) {\n                        logger_1.logger.error(`Error getting document: ${params.textDocument.uri}`);\n                        return null;\n                    }\n                    return yield this.formatter.format(document, params.options, this.config.shfmt);\n                }\n                catch (err) {\n                    logger_1.logger.error(`Error while formatting: ${err}`);\n                }\n            }\n            return null;\n        });\n    }\n}\nexports.default = BashServer;\n/**\n * Deduplicate symbols by prioritizing the current file.\n */\nfunction deduplicateSymbols({ symbols, currentUri, }) {\n    const isCurrentFile = ({ location: { uri } }) => uri === currentUri;\n    const getSymbolId = ({ name, kind }) => `${name}${kind}`;\n    const symbolsCurrentFile = symbols.filter((s) => isCurrentFile(s));\n    const symbolsOtherFiles = symbols\n        .filter((s) => !isCurrentFile(s))\n        // Remove identical symbols matching current file\n        .filter((symbolOtherFiles) => !symbolsCurrentFile.some((symbolCurrentFile) => getSymbolId(symbolCurrentFile) === getSymbolId(symbolOtherFiles)));\n    // NOTE: it might be that uniqueBasedOnHash is not needed anymore\n    return (0, array_1.uniqueBasedOnHash)([...symbolsCurrentFile, ...symbolsOtherFiles], getSymbolId);\n}\nfunction symbolKindToCompletionKind(s) {\n    switch (s) {\n        case LSP.SymbolKind.File:\n            return LSP.CompletionItemKind.File;\n        case LSP.SymbolKind.Module:\n        case LSP.SymbolKind.Namespace:\n        case LSP.SymbolKind.Package:\n            return LSP.CompletionItemKind.Module;\n        case LSP.SymbolKind.Class:\n            return LSP.CompletionItemKind.Class;\n        case LSP.SymbolKind.Method:\n            return LSP.CompletionItemKind.Method;\n        case LSP.SymbolKind.Property:\n            return LSP.CompletionItemKind.Property;\n        case LSP.SymbolKind.Field:\n            return LSP.CompletionItemKind.Field;\n        case LSP.SymbolKind.Constructor:\n            return LSP.CompletionItemKind.Constructor;\n        case LSP.SymbolKind.Enum:\n            return LSP.CompletionItemKind.Enum;\n        case LSP.SymbolKind.Interface:\n            return LSP.CompletionItemKind.Interface;\n        case LSP.SymbolKind.Function:\n            return LSP.CompletionItemKind.Function;\n        case LSP.SymbolKind.Variable:\n            return LSP.CompletionItemKind.Variable;\n        case LSP.SymbolKind.Constant:\n            return LSP.CompletionItemKind.Constant;\n        case LSP.SymbolKind.String:\n        case LSP.SymbolKind.Number:\n        case LSP.SymbolKind.Boolean:\n        case LSP.SymbolKind.Array:\n        case LSP.SymbolKind.Key:\n        case LSP.SymbolKind.Null:\n            return LSP.CompletionItemKind.Text;\n        case LSP.SymbolKind.Object:\n            return LSP.CompletionItemKind.Module;\n        case LSP.SymbolKind.EnumMember:\n            return LSP.CompletionItemKind.EnumMember;\n        case LSP.SymbolKind.Struct:\n            return LSP.CompletionItemKind.Struct;\n        case LSP.SymbolKind.Event:\n            return LSP.CompletionItemKind.Event;\n        case LSP.SymbolKind.Operator:\n            return LSP.CompletionItemKind.Operator;\n        case LSP.SymbolKind.TypeParameter:\n            return LSP.CompletionItemKind.TypeParameter;\n        default:\n            return LSP.CompletionItemKind.Text;\n    }\n}\nfunction symbolKindToDescription(s) {\n    switch (s) {\n        case LSP.SymbolKind.Function:\n            return 'Function';\n        case LSP.SymbolKind.Variable:\n            return 'Variable';\n        default:\n            return 'Keyword';\n    }\n}\nfunction getMarkdownContent(documentation, language) {\n    return {\n        value: language\n            ? // eslint-disable-next-line prefer-template\n                ['``` ' + language, documentation, '```'].join('\\n')\n            : documentation,\n        kind: LSP.MarkupKind.Markdown,\n    };\n}\nfunction getCommandOptions(name, word) {\n    const options = (0, node_child_process_1.spawnSync)(path.join(__dirname, '../src/get-options.sh'), [name, word]);\n    if (options.status !== 0) {\n        return [];\n    }\n    return options.stdout\n        .toString()\n        .split('\\t')\n        .map((l) => l.trim())\n        .filter((l) => l.length > 0);\n}\n"]}