Oleg Solomko 8264792d81
add prompt snippets support (#234220)
* [prompt snippets]: working on recursive file references

* [prompt snippets]: working on file contents codec

* [prompt snippets]: implement the `LinesCodecDecoder`

* [prompt snippets]: working on the `SimpleTokensCodecDecoder`

* [prompt snippets]: implement first version of `PromptSyntaxCodec`

* [prompt snippets]: add `Range` attributes to all the tokens

* [prompt snippets]: refactoring components to standalone files

* [prompt snippets]: move out components to separate files, working on the first unit test

* [prompt snippets]: add the first unit test for `LinesDecoder`

* [prompt snippets]: add first unit test for the `SimpleDecoder`

* [prompt snippets]: refactor `SimpleDecoder` logic

* [prompt snippets]: make `SimpleDecoder` handle `\t` characters and improve unit tests

* [prompt snippets]: add unit tests for the `ChatbotPromptCodec` codec

* [prompt snippets]: add unit test for the `ChatbotPromptReference`

* [prompt snippets]: working on enhancing prompt context

* [prompt snippets]: enahnce working set file references on submit

* [prompt snippets]: cleanup

* [prompt snippets]: implement automatic references resolution on file variable addition

* [prompt snippets]: implement prompt snippets for implicit context files

* [prompt snippets]: improve implicit context file rendering

* [prompt snippets]: remove redundant `ChatReference` class

* [prompt snippets]: `PromptReference` can now subscribe to filesystem changes, added unit test for the `assertDefined` util

* [prompt snippets]: make `LinesDecoder` to also emit `NewLine` tokens, add more unit tests for it

* [prompt snippets]: resolve nested references for dynamic variables and update variable label

* [prompt snippets]: add nested file references to implicit context of prompt request

* [prompt snippets]: variable hover label now includes nested file references

* [prompt snippets]: add the `TestDecoder` and `TestLinesDecoder` reusable test utilities

* [prompt snippets]: add unit tests for `ChatbotPromptDecoder` decoder

* [prompt snippets]: refactor decoders to eliminate static type hacks

* [prompt snippets]: improve `BaseDecoder` logic and docs

* [prompt snippets]: add unit tests for the new reduce-less logic of the stream

* [prompt snippets]: improve doc comments, finish the basic unit test for the `PromptFileReference` class

* [prompt snippets]: finish the main unit test for the `PromptFileReference` class

* [prompt snippets]: make the `PromptFileReference` class ininite-reference-recursion-proof and add approptiate tests

* [prompt snippets]: cleanup

* [prompt snippets]: ensure codecs work well with UTF16 codepoints

* [prompt snippets]: add `randomInt()` utility and related tests

* [prompt snippets]: refactor and add more unit tests

* [prompt snippets]: fix unresolved `Buffer` import reference

* [prompt snippets]: refactor `LinesDecoder` to use `VSBuffer` as underlying data source

* [prompt snippets]: make the `ImplicitContext` to create prompt file reference object only if `prompt-snippets` config value is set

* [prompt snippets]: make the `ChatDynamicVariable` to resolve prompt file reference object only if `prompt-snippets` config value is set

* [prompt snippets]: localize (+N more) labels

* [prompt snippets]: pre PR cleanups

* [prompt snippets]: minor cleanups

* [prompt snippets]: address some PR feedback, fix an unit test issue

* [prompt snippets]: move file to common layers

* [prompt snippets]: move base codec types to base/common

* [prompt snippets]: move more codec files around

* [prompt snippets]: update a code comment

* [prompt snippets]: fix `assert.throws()` API incompatibility issue

* [prompt snippets]: minor cleanup

* [prompt snippets]: improve unit tests for the `PromptFileReference`

* [prompt snippets]: skip unit tests of `PromptFileReference` on Windows for now

* [prompt snippets]: address PR feedback

* [prompt snippets]: add `PromptFileReference.isPromptSnippetFile` getter

* [prompt snippets]: move the `assertDefined` utility to `types.ts`

* use service injection in `PromptFileReference` class

* [prompt snippets]: remove formatting changes

* [prompt snippets]: remove more formatting changes

* [prompt snippets]: revert more formatting changes

* [prompt snippets]: add logic to dispose existing variables in `ChatDynamicVariableModel`

* [prompt snippets]: cleanup

* [prompt snippets]: minor cleanup

* [prompt snippets]: remove redundant disposable registrations, cleanup more formatting changes

* [prompt snippets]: improve cross-platform newline handling, add `vertical tab` and `form feed` tokens

* [prompt snippets]: minor types naming cleanup

* [prompt snippets]: make `ChatPromptCodec` to be a global singleton object and improve doc comments

* [prompt snippets]: address PR feedback

* [prompt snippets]: remove (+N more) label, ensure that `ChatFileReferences` are scoped to files only

* [prompt snippets]: revert changes for the `ImplicitContext`

* [prompt snippets]: cleanup changes in `ChatDynamicVariableModel`

* [prompt snippets]: revert changes in the `ChatRequestParser`

* [prompt snippets]: improve history navigation

* [prompt snippets]: address PR feedback

* [prompt snippets]: allow non-prompt-snippet files to be referenced, but don't parse their contents
2024-12-16 15:07:15 -08:00
2024-12-10 11:24:44 +01:00
2024-12-16 11:38:23 +01:00
2024-12-16 20:49:25 +05:30
2024-12-11 09:19:48 +01:00
2024-12-16 15:07:15 -08:00
2024-11-28 16:04:02 +01:00
2024-12-03 09:47:36 +01:00

Visual Studio Code - Open Source ("Code - OSS")

Feature Requests Bugs Gitter

The Repository

This repository ("Code - OSS") is where we (Microsoft) develop the Visual Studio Code product together with the community. Not only do we work on code and issues here, we also publish our roadmap, monthly iteration plans, and our endgame plans. This source code is available to everyone under the standard MIT license.

Visual Studio Code

VS Code in action

Visual Studio Code is a distribution of the Code - OSS repository with Microsoft-specific customizations released under a traditional Microsoft product license.

Visual Studio Code combines the simplicity of a code editor with what developers need for their core edit-build-debug cycle. It provides comprehensive code editing, navigation, and understanding support along with lightweight debugging, a rich extensibility model, and lightweight integration with existing tools.

Visual Studio Code is updated monthly with new features and bug fixes. You can download it for Windows, macOS, and Linux on Visual Studio Code's website. To get the latest releases every day, install the Insiders build.

Contributing

There are many ways in which you can participate in this project, for example:

If you are interested in fixing issues and contributing directly to the code base, please see the document How to Contribute, which covers the following:

Feedback

See our wiki for a description of each of these channels and information on some other available community-driven channels.

Many of the core components and extensions to VS Code live in their own repositories on GitHub. For example, the node debug adapter and the mono debug adapter repositories are separate from each other. For a complete list, please visit the Related Projects page on our wiki.

Bundled Extensions

VS Code includes a set of built-in extensions located in the extensions folder, including grammars and snippets for many languages. Extensions that provide rich language support (code completion, Go to Definition) for a language have the suffix language-features. For example, the json extension provides coloring for JSON and the json-language-features extension provides rich language support for JSON.

Development Container

This repository includes a Visual Studio Code Dev Containers / GitHub Codespaces development container.

  • For Dev Containers, use the Dev Containers: Clone Repository in Container Volume... command which creates a Docker volume for better disk I/O on macOS and Windows.

    • If you already have VS Code and Docker installed, you can also click here to get started. This will cause VS Code to automatically install the Dev Containers extension if needed, clone the source code into a container volume, and spin up a dev container for use.
  • For Codespaces, install the GitHub Codespaces extension in VS Code, and use the Codespaces: Create New Codespace command.

Docker / the Codespace should have at least 4 Cores and 6 GB of RAM (8 GB recommended) to run full build. See the development container README for more information.

Code of Conduct

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

License

Copyright (c) Microsoft Corporation. All rights reserved.

Licensed under the MIT license.

Description
Languages
TypeScript 90.2%
jsonc 4.5%
CSS 1.4%
JavaScript 0.9%
C 0.9%
Other 1.9%