|
6 | 6 | import vscode, { env, version } from 'vscode' |
7 | 7 | import * as nls from 'vscode-nls' |
8 | 8 | import * as crypto from 'crypto' |
9 | | -import { LanguageClient, LanguageClientOptions } from 'vscode-languageclient' |
| 9 | +import { LanguageClient, LanguageClientOptions, ResponseError } from 'vscode-languageclient' |
10 | 10 | import { InlineCompletionManager } from '../app/inline/completion' |
11 | 11 | import { AmazonQLspAuth, encryptionKey, notificationTypes } from './auth' |
12 | 12 | import { AuthUtil } from 'aws-core-vscode/codewhisperer' |
13 | | -import { ConnectionMetadata } from '@aws/language-server-runtimes/protocol' |
| 13 | +import { |
| 14 | + ConnectionMetadata, |
| 15 | + ShowDocumentParams, |
| 16 | + ShowDocumentRequest, |
| 17 | + ShowDocumentResult, |
| 18 | +} from '@aws/language-server-runtimes/protocol' |
14 | 19 | import { Settings, oidcClientName, createServerOptions, globals, Experiments, Commands } from 'aws-core-vscode/shared' |
15 | 20 | import { activate } from './chat/activation' |
16 | 21 | import { AmazonQResourcePaths } from './lspInstaller' |
@@ -101,7 +106,17 @@ export async function startLanguageServer( |
101 | 106 | }, |
102 | 107 | } |
103 | 108 | }) |
| 109 | + |
104 | 110 | await auth.refreshConnection() |
| 111 | + client.onRequest<ShowDocumentParams, ShowDocumentResult>( |
| 112 | + ShowDocumentRequest.method, |
| 113 | + async (params: ShowDocumentParams): Promise<ShowDocumentParams | ResponseError<ShowDocumentResult>> => { |
| 114 | + const uri = vscode.Uri.parse(params.uri) |
| 115 | + const doc = await vscode.workspace.openTextDocument(uri) |
| 116 | + await vscode.window.showTextDocument(doc, { preview: false }) |
| 117 | + return params |
| 118 | + } |
| 119 | + ) |
105 | 120 |
|
106 | 121 | if (Experiments.instance.get('amazonqLSPInline', false)) { |
107 | 122 | const inlineManager = new InlineCompletionManager(client) |
|
0 commit comments