ide на основе vs code
Это ide на основе vs code(code oss), в ней будет встроенный умный апи роутинг, свой маркет с плагинами(агент харнесс, поддержка java/kotlin/мобильной разработки, командная разработка проектов, orca, оркестратор агентов
Это ide на основе vs code(code oss), в ней будет встроенный умный апи роутинг, свой маркет с плагинами(агент харнесс, поддержка java/kotlin/мобильной разработки, командная разработка проектов, orca, оркестратор агентов
Before you create a new issue, please do a search in open issues to see if the issue or feature request has already been filed.
Be sure to scan through the most popular feature requests.
If you find your issue already exists, make relevant comments and add your reaction. Use a reaction in place of a "+1" comment:
If you cannot find an existing issue that describes your bug or feature, create a new issue using the guidelines below.
File a single issue per problem and feature request. Do not enumerate multiple bugs or feature requests in the same issue.
Do not add your issue as a comment to an existing issue unless it's for the identical input. Many issues look similar but have different causes.
The more information you can provide, the more likely someone will be successful at reproducing the issue and finding a fix.
The built-in tool for reporting an issue, which you can access by using Report Issue in VS Code's Help menu, can help streamline this process by automatically providing the version of VS Code, all your installed extensions, and your system info. Additionally, the tool will search among existing issues to see if a similar issue already exists.
Please include the following with each issue:
Set-ExecutionPolicy Unrestricted as admin in Powershell.npm installnpm run get_tokenCmd+Shift+B (or Ctrl+Shift+B if you are on Windows), or just start the "Launch Copilot Extension - Watch Mode" launch config to start the build then start debugging the extension.Tip: If "Launch Copilot Extension - Watch Mode" doesn't work for you, try using the "Launch Copilot Extension" debug configuration instead.
Note: Setup and running under Windows Subsystem for Linux (WSL) is supported by following the VS Code setup instructions.
If you hit errors while running tests, ensure that you are using the correct Node version and that git lfs is properly installed (run git lfs pull to validate).
There are unit tests which run in Node.JS:
npm run test:unitThere are also integration tests that run within VS Code itself:
npm run test:extensionFinally, there are simulation tests. These tests reach out to Copilot API endpoints, invoke LLMs and require expensive computations to run. Each test runs 10 times, to accommodate for the stochastic nature of LLMs themselves. The results of all runs of all tests are snapshotted in the baseline file, `test/simulation/baseline.json`, which encodes the quality of the test suite at any given point in time.
Because LLM results are both random and costly, they are cached within the repo in test/simulation/cache. This means rerunning the simulation tests and benefiting from the cache will make the test run be both faster as well as deterministic.
You can run the simulation tests with:
npm run simulateKeep in mind that PRs will fail unless the cache is populated. Running the command above will populate the cache by creating new cache layers in test/simulation/cache/layers. This cache population must be done by VS Code team members. If a community member submits a PR with new cache layer(s), the PR will fail and a VS Code team member must delete the layer(s) and recreate them within their dev box.
You can ensure the cache is populated with:
npm run simulate-require-cacheFinally, the PR will also fail with any uncommitted baseline changes. If you do see change test results locally, and would like to accept the new baseline for the simulation tests, you should update the baseline and include that change in your commit:
npm run simulate-update-baselinebase/common utilsWe like and miss our utilities from the 'microsoft/vscode' repo, esp those from base/common, like async.ts, strings.ts, map.ts etc pp. Instead of copying them manually and maintaining them in here, we can use them from the vscode repo. To do so, there is a the script/setup/copySources.ts script. Towards the end you'll find a list of modules that are copied from the vscode repo. If you need a module from vscode, add it to the list and run npx tsx script/setup/copySources.ts. Have this repo as sibling to the vscode repo and it will copy the modules from the vscode repo into src/util/vs. Note that the src/util/vs folder is marked as readonly and that changes to the copied sources should be carried out in the vscode repo.
We have developed a TSX-based framework for composing prompts. This section describes the problems it solves and how to use it.
priority that is conceptually similar to a zIndex (higher number == higher priority). If an intent declares more messages than can fit into the token budget, the prompt renderer prunes messages with the lowest priority from the ChatMessage array that is eventually sent to the Copilot API, preserving the order in which they were declared.System, User and Assistant messages that are sent to the Copilot API. This allows greater control and visibility into the safety rules, prompt context kinds, and conversation history that are sent for each feature.PromptElement]. The simplest prompt element implements a synchronous render method which returns the chat messages it wants to send to the Copilot API. For example:```ts interface CatPromptProps extends BasePromptElementProps { query: string; }
export class CatPrompt extends PromptElement<CatPromptProps, void> { render() { return ( <> <SystemMessage> Respond to all messages as if you were a cat. </SystemMessage> <UserMessage> {this.props.query} </UserMessage> </> ); } } ```
PromptRenderer] and call render on the prompt component you defined, passing in the props that your prompt component expects. PromptRenderer produces an array of system, user, and assistant messages which are suitable for sending to the Copilot API via the ChatMLFetcher. See this OpenAI guide for some strategies to get good results.```ts class CatIntentInvocation implements IIntentInvocation { constructor(private readonly accessor: ServicesAccessor, private readonly endpoint: IChatEndpoint, ) {}
async buildPrompt({ query }: IBuildPromptContext, progress: vscode.Progress<vscode.ChatResponseProgressPart | vscode.ChatResponseReferencePart>, token: vscode.CancellationToken): Promise<RenderPromptResult> { // Render the CatPrompt prompt element const renderer = new PromptRenderer(this.accessor, this.endpoint, CatPrompt, { query });
return renderer.render(progress, token); } } ```
SystemMessage, UserMessage and AssistantMessage: Text within these components will be converted to the system, user and assistant message types from the OpenAI API.SafetyRules: This should usually be included in a SystemMessage to ensure that your feature is compliant with Responsible AI guidelines.prepare method. prepare is called before render and the prepared state will be passed back to your prompt component's sync render method.Please note:
<br /> attribute.For comprehensive information about the project architecture, coding standards, and development guidelines, please refer to the Copilot Instructions. This document includes:
Understanding these guidelines is crucial for making effective contributions to the GitHub Copilot Chat extension.
Like in VS Code we organize our source code into layers and folders. Understand a "layer" as runtime target which is defined by the ambient APIs that you can use. We have these layers:
common - Just JavaScript and its builtins APIs. Also allowed to use types from the VS Code API, but no runtime access.vscode - Runtime access to VS Code APIs, can use commonnode - Node.js APIs and modules, can use common, nodevscode-node - VS Code APIs and Node.js APIs, can use common, vscode, nodeworker - Web Worker APIs, can use commonvscode-worker - VS Code APIs and Web Worker APIs, can use common, vscode, workerTop-level folders are how we organize our code into logic groups, each folder has sub-folders, source files are inside a layer-folder. We have the following top-level folders
vscodeTypes module, this will be shimmed for tests./platform nor ./extension folder./util./util and ./platformbase/ but not extension/Copilot supports both node.js and web worker extension hosts, i.e. can run on desktop but also in web, even if no remote is connected ("serverless"). As such, we are building 2 flavors of the extension:
./extension/extension/vscode-node/extension.ts: extension runs in node.js extension hosts./extension/extension/vscode-worker/extension.ts: extension runs in web worker extension hostsAs much as possible, we try to run the same code in both node.js and web worker extension hosts. Having runtime specific code should be the exception and not the rule.
Here are some examples of code that will not be supported in web worker extension hosts:
require, process.env, fs)vscode.Git extension)Running the extension out of sources in their runtimes:
node: just use the launch configuration ("Launch Copilot Extension")web"browser": "./dist/web" in package.jsonnpm run webhttp://localhost:3000chat.experimental.serverlessWebEnabled to true (reload if this is the first time you set it)Like in VS Code, Copilot extension is built with contributions and services so that components can both isolate from each other but also provide and use services together.
Contributions are registered in these folders and automatically picked up by the extension when running:
./extension/extension/vscode/contributions.ts: contributions that can run in both node.js and web worker extension hosts./extension/extension/vscode-node/contributions.ts: contributions that only run in node.js extension hosts./extension/extension/vscode-worker/contributions.ts: contributions that only run in web worker extension hostsSimilarly, services are registered and automatically picked up by the main instantiation service that creates these contributions:
./extension/extension/vscode/services.ts: services that can run in both node.js and web worker extension hosts./extension/extension/vscode-node/services.ts: services that only run in node.js extension hosts./extension/extension/vscode-worker/services.ts: services that only run in web worker extension hostsAgain, try to make your services and contributions available in the vscode layer so that it can be used in all supported runtimes.
The main interesting files related to agent mode are:
Currently, agent mode is essentially a chat participant registered with VS Code. It mainly uses the standard API along with the standard `vscode.lm.invokeTool` API to invoke tools, but is registered with a flag in package.json denoting it as the "agent mode" participant. It also has some special abilities driven by proposed API.
> Note: Some usages of "agent" in the codebase may refer to our older chat participants (@workspace, @vscode, ...) or Copilot Extension agents installed by a GitHub App.
Copilot registers a number of different tools. Tools are also available from other VS Code extensions or from MCP servers registered with VS Code. The tool picker in VS Code primarily determines which tools are enabled, and this set is passed to the agent on the ChatRequest. Some edit tools are only enabled for certain models or based on configuration or experiments. The agent has the final say for which tools are included in a request, and this logic is in getTools in `agentIntent.ts`.
Tools are registered through VS Code's normal Language Model Tool API. The key parts of the built-in tools are here:
vscode.LanguageModelTool interface, but since some have additional custom behavior, they can implement the extended ICopilotTool interface.See the tools.md document for more important details on how to develop tools. Please read it before adding a new tool!
We have now moved to https://github.com/microsoft/vscode-tree-sitter-wasm for WASM prebuilds.
To easily see the details of requests made by Copilot Chat, run the command "Show Chat Debug View". This will show a treeview with an entry for each request made. You can see the prompt that was sent to the model, the tools that were enabled, the response, and other key details. Always read the prompt when making any changes, to ensure that it's being rendered as you expect! You can save the request log with right click > "Export As...".
The view also has entries for tool calls on their own, and a prompt-tsx debug view that opens in the Simple Browser.
> 🚨 Note: This log is also very helpful in troubleshooting issues, and we will appreciate if you share it when filing an issue about the agent's behavior. But, this log may contain personal information such as the contents of your files or terminal output. Please review the contents carefully before sharing it with anyone else.
When updating VS Code proposed extension API that is used by the extension, the engines.vscode field in package.json is used to make sure that the version of the extension that gets installed will be compatible with the version of VS Code.
When adopting any change to a proposed API (whether backwards-compatible or not), you must update the date part of the engines.vscode field in package.json. For example, "vscode": "^1.91.0-20240624". This ensures that the extension will only be installed and activated in a version of VS Code that supports the new API.
You must adopt API changes in the extension at the same time as they're made in VS Code, otherwise the next day's Insiders build won't have a compatible Copilot Chat extension available.
Examples of API changes:
ChatResponseStreamYou can run the extension from Code OSS Desktop, provided that you follow along these steps:
product.overrides.json in the vscode repository{
"trustedExtensionAuthAccess": {
"github": [
"github.copilot-chat"
]
}
}Code OSS for Web unfortunately does not support the product.overrides.json trick. You have to manually copy the contents of the defaultChatAgent property into the src/vs/platform/product/common/product.ts file here.
For example:
Object.assign(product, {
version: '1.102.0-dev',
nameShort: 'Code - OSS Dev',
nameLong: 'Code - OSS Dev',
applicationName: 'code-oss',
dataFolderName: '.vscode-oss',
urlProtocol: 'code-oss',
reportIssueUrl: 'https://github.com/microsoft/vscode/issues/new',
licenseName: 'MIT',
licenseUrl: 'https://github.com/microsoft/vscode/blob/main/LICENSE.txt',
serverLicenseUrl: 'https://github.com/microsoft/vscode/blob/main/LICENSE.txt',
defaultChatAgent: {
'extensionId': 'GitHub.copilot',
'chatExtensionId': 'GitHub.copilot-chat',
'documentationUrl': 'https://aka.ms/github-copilot-overview',
'termsStatementUrl': 'https://aka.ms/github-copilot-terms-statement',
'privacyStatementUrl': 'https://aka.ms/github-copilot-privacy-statement',
'skusDocumentationUrl': 'https://aka.ms/github-copilot-plans',
'publicCodeMatchesUrl': 'https://aka.ms/github-copilot-match-public-code',
'manageSettingsUrl': 'https://aka.ms/github-copilot-settings',
'managePlanUrl': 'https://aka.ms/github-copilot-manage-plan',
'manageOverageUrl': 'https://aka.ms/github-copilot-manage-overage',
'upgradePlanUrl': 'https://aka.ms/github-copilot-upgrade-plan',
'signUpUrl': 'https://aka.ms/github-sign-up',
'provider': {
'default': {
'id': 'github',
'name': 'GitHub'
},
'enterprise': {
'id': 'github-enterprise',
'name': 'GHE.com'
},
'google': {
'id': 'google',
'name': 'Google'
},
'apple': {
'id': 'apple',
'name': 'Apple'
}
},
'providerUriSetting': 'github-enterprise.uri',
'providerScopes': [
[
'user:email'
],
[
'read:user'
],
[
'read:user',
'user:email',
'repo',
'workflow'
]
],
'entitlementUrl': 'https://api.github.com/copilot_internal/user',
'entitlementSignupLimitedUrl': 'https://api.github.com/copilot_internal/subscribe_limited_user',
'chatQuotaExceededContext': 'github.copilot.chat.quotaExceeded',
'completionsQuotaExceededContext': 'github.copilot.completions.quotaExceeded',
'walkthroughCommand': 'github.copilot.open.walkthrough',
'completionsMenuCommand': 'github.copilot.toggleStatusMenu',
'chatRefreshTokenCommand': 'github.copilot.refreshToken',
'completionsAdvancedSetting': 'github.copilot.advanced',
'completionsEnablementSetting': 'github.copilot.enable',
'nextEditSuggestionsSetting': 'github.copilot.nextEditSuggestions.enabled'
},
trustedExtensionAuthAccess: {
'github': [
'github.copilot-chat'
]
}
});
}