Skip to content

Commit 2d4e6f6

Browse files
committed
refactor: move cursorPosition util to seperate file
1 parent a08ca02 commit 2d4e6f6

File tree

2 files changed

+21
-15
lines changed

2 files changed

+21
-15
lines changed

packages/amazonq/src/lsp/chat/messages.ts

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ import {
6868
import { telemetry, TelemetryBase } from 'aws-core-vscode/telemetry'
6969
import { isValidResponseError } from './error'
7070
import { decodeRequest, encryptRequest } from '../encryption'
71+
import { getCursorState } from '../utils'
7172

7273
export function registerLanguageServerEventListener(languageClient: LanguageClient, provider: AmazonQChatViewProvider) {
7374
languageClient.info(
@@ -99,21 +100,6 @@ export function registerLanguageServerEventListener(languageClient: LanguageClie
99100
})
100101
}
101102

102-
function getCursorState(selection: readonly vscode.Selection[]) {
103-
return selection.map((s) => ({
104-
range: {
105-
start: {
106-
line: s.start.line,
107-
character: s.start.character,
108-
},
109-
end: {
110-
line: s.end.line,
111-
character: s.end.character,
112-
},
113-
},
114-
}))
115-
}
116-
117103
export function registerMessageListeners(
118104
languageClient: LanguageClient,
119105
provider: AmazonQChatViewProvider,

packages/amazonq/src/lsp/utils.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*!
2+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
import * as vscode from 'vscode'
6+
7+
export function getCursorState(selection: readonly vscode.Selection[]) {
8+
return selection.map((s) => ({
9+
range: {
10+
start: {
11+
line: s.start.line,
12+
character: s.start.character,
13+
},
14+
end: {
15+
line: s.end.line,
16+
character: s.end.character,
17+
},
18+
},
19+
}))
20+
}

0 commit comments

Comments
 (0)