| 1 | /** |
| 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. |
| 3 | * |
| 4 | * This source code is licensed under the MIT license found in the |
| 5 | * LICENSE file in the root directory of this source tree. |
| 6 | */ |
| 7 | |
| 8 | import * as vscode from 'vscode'; |
| 9 | import {Position} from 'vscode-languageclient/node'; |
| 10 | |
| 11 | export function positionLiteralToVSCodePosition( |
| 12 | position: Position, |
| 13 | ): vscode.Position { |
| 14 | return new vscode.Position(position.line, position.character); |
| 15 | } |
| 16 | |
| 17 | export function positionsToRange(start: Position, end: Position): vscode.Range { |
| 18 | return new vscode.Range( |
| 19 | positionLiteralToVSCodePosition(start), |
| 20 | positionLiteralToVSCodePosition(end), |
| 21 | ); |
| 22 | } |