forked from microsoft/vscode-python
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5945fda
commit 02c9904
Showing
4 changed files
with
70 additions
and
6 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import * as vscode from 'vscode'; | ||
|
||
interface IGetActiveEnvironment { | ||
filePath: string; | ||
} | ||
|
||
export class GetErrorsTool implements vscode.LanguageModelTool<IGetActiveEnvironment> { | ||
public static readonly toolName = 'getActiveEnvironment'; | ||
|
||
constructor(private isThisTrue: boolean) {} | ||
|
||
invoke( | ||
options: vscode.LanguageModelToolInvocationOptions<IGetActiveEnvironment>, | ||
_token: vscode.CancellationToken, | ||
): vscode.ProviderResult<vscode.LanguageModelToolResult> { | ||
const parameters: IGetActiveEnvironment = options.input; | ||
if (!parameters.filePath) { | ||
throw new Error('Invalid input'); | ||
} | ||
this.isThisTrue = true; | ||
console.log('This is true', this.isThisTrue); | ||
return new vscode.LanguageModelToolResult([new vscode.LanguageModelTextPart('invoked finished!')]); | ||
} | ||
|
||
prepareInvocation( | ||
options: vscode.LanguageModelToolInvocationPrepareOptions<IGetActiveEnvironment>, | ||
_token: vscode.CancellationToken, | ||
): vscode.ProviderResult<vscode.PreparedToolInvocation> { | ||
console.log(this.isThisTrue, options); | ||
console.log('preparing invocation'); | ||
return { | ||
invocationMessage: 'preparing the invocation..... ', | ||
}; | ||
} | ||
} | ||
|
||
export function registerChatTools(context: vscode.ExtensionContext): void { | ||
context.subscriptions.push(vscode.lm.registerTool('python_get_active_environment', new GetErrorsTool(false))); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters