Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit43a786e

Browse files
authored
1 parent84abc3a commit43a786e

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

‎Extension/src/LanguageServer/Providers/CopilotHoverProvider.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import*asvscodefrom'vscode';
66
import{Position,ResponseError}from'vscode-languageclient';
77
import*asnlsfrom'vscode-nls';
8+
import{getVSCodeLanguageModel}from'../../common';
89
import{modelSelector}from'../../constants';
910
import*astelemetryfrom'../../telemetry';
1011
import{DefaultClient,GetCopilotHoverInfoParams,GetCopilotHoverInfoRequest,GetCopilotHoverInfoResult}from'../client';
@@ -42,7 +43,7 @@ export class CopilotHoverProvider implements vscode.HoverProvider {
4243
}
4344

4445
// Ensure the user has access to Copilot.
45-
constvscodelm=(vscodeasany).lm;
46+
constvscodelm=getVSCodeLanguageModel();
4647
if(vscodelm){
4748
const[model]=awaitvscodelm.selectChatModels(modelSelector);
4849
if(!model){

‎Extension/src/LanguageServer/extension.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1413,8 +1413,7 @@ export async function preReleaseCheck(): Promise<void> {
14131413
asyncfunctiononCopilotHover():Promise<void>{
14141414
telemetry.logLanguageServerEvent("CopilotHover");
14151415

1416-
// Check if the user has access to vscode language model.
1417-
constvscodelm=(vscodeasany).lm;
1416+
constvscodelm=util.getVSCodeLanguageModel();
14181417
if(!vscodelm){
14191418
return;
14201419
}
@@ -1477,6 +1476,7 @@ async function onCopilotHover(): Promise<void> {
14771476

14781477
letchatResponse:vscode.LanguageModelChatResponse|undefined;
14791478
try{
1479+
// Select the chat model.
14801480
const[model]=awaitvscodelm.selectChatModels(modelSelector);
14811481

14821482
chatResponse=awaitmodel.sendRequest(

‎Extension/src/common.ts‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1828,3 +1828,16 @@ export function equals(array1: string[] | undefined, array2: string[] | undefine
18281828
}
18291829
returntrue;
18301830
}
1831+
1832+
exportfunctiongetVSCodeLanguageModel():any|undefined{
1833+
// Check if the user has access to vscode language model.
1834+
constvscodelm=(vscodeasany).lm;
1835+
if(!vscodelm){
1836+
returnundefined;
1837+
}
1838+
// Check that vscodelm has a method called 'selectChatModels'
1839+
if(!vscodelm.selectChatModels||typeofvscodelm.selectChatModels!=='function'){
1840+
returnundefined;
1841+
}
1842+
returnvscodelm;
1843+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp