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,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,GAAG;QAAE,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC,MAAM,CAAA;KAAE,GAAG,KAAK;IACxF,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,gBAAgB,CAAC,KAAK,CAAC;IAC/D,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,SAAS,GAAG,gBAAgB,CAAC,KAAK,CAAC,GAAG,SAAS;CAkB1F","file":"../../src/browser/monaco-to-protocol-converter.d.ts","sourcesContent":["/********************************************************************************\r\n * Copyright (C) 2020 TypeFox and others.\r\n *\r\n * This program and the accompanying materials are made available under the\r\n * terms of the Eclipse Public License v. 2.0 which is available at\r\n * http://www.eclipse.org/legal/epl-2.0.\r\n *\r\n * This Source Code may also be made available under the following Secondary\r\n * Licenses when the conditions for such availability set forth in the Eclipse\r\n * Public License v. 2.0 are satisfied: GNU General Public License, version 2\r\n * with the GNU Classpath Exception which is available at\r\n * https://www.gnu.org/software/classpath/license.html.\r\n *\r\n * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0\r\n ********************************************************************************/\r\n\r\nimport {injectable} from 'inversify';\r\nimport {Position, Range} from 'vscode-languageserver-types';\r\nimport {RecursivePartial} from '@tartjs/core/lib/common/types';\r\n\r\nexport interface MonacoRangeReplace {\r\n    insert: monaco.IRange;\r\n    replace: monaco.IRange\r\n};\r\nexport namespace MonacoRangeReplace {\r\n    export function is(v: Partial<monaco.IRange> | MonacoRangeReplace): v is MonacoRangeReplace {\r\n        return (v as MonacoRangeReplace).insert !== undefined;\r\n    }\r\n}\r\n\r\n@injectable()\r\nexport class MonacoToProtocolConverter {\r\n\r\n    asPosition(lineNumber: undefined | null, column: undefined | null): {};\r\n    asPosition(lineNumber: number, column: undefined | null): Pick<Position, 'line'>;\r\n    asPosition(lineNumber: undefined | null, column: number): Pick<Position, 'character'>;\r\n    asPosition(lineNumber: number, column: number): Position;\r\n    asPosition(lineNumber: number | undefined | null, column: number | undefined | null): Partial<Position>;\r\n    asPosition(lineNumber: number | undefined | null, column: number | undefined | null): Partial<Position> {\r\n        const line = typeof lineNumber !== 'number' ? undefined : lineNumber - 1;\r\n        const character = typeof column !== 'number' ? undefined : column - 1;\r\n        return {\r\n            line, character\r\n        };\r\n    }\r\n\r\n    asRange(range: undefined): undefined;\r\n    asRange(range: monaco.IRange): Range;\r\n    asRange(range: monaco.IRange | undefined): Range | undefined;\r\n    asRange(range: monaco.IRange | { insert: monaco.IRange; replace: monaco.IRange }): Range;\r\n    asRange(range: Partial<monaco.IRange>): RecursivePartial<Range>;\r\n    asRange(range: Partial<monaco.IRange> | undefined): RecursivePartial<Range> | undefined;\r\n    asRange(range: Partial<monaco.IRange> | undefined | MonacoRangeReplace): RecursivePartial<Range> | undefined {\r\n        if (range === undefined) {\r\n            return undefined;\r\n        }\r\n\r\n        if (MonacoRangeReplace.is(range)) {\r\n            return this.asRange(range.insert);\r\n\r\n        } else {\r\n            const start = this.asPosition(range.startLineNumber, range.startColumn);\r\n            const end = this.asPosition(range.endLineNumber, range.endColumn);\r\n            return {\r\n                start, end\r\n            };\r\n        }\r\n    }\r\n\r\n}\r\n"]}