Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions extensions/vscode/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
out
node_modules
.vscode-test/
*.vsix
vscode*.d.ts
13 changes: 13 additions & 0 deletions extensions/vscode/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Run Extension",
"type": "extensionHost",
"request": "launch",
"args": ["--extensionDevelopmentPath=${workspaceFolder}"],
"outFiles": ["${workspaceFolder}/out/**/*.js"],
"preLaunchTask": "${defaultBuildTask}"
}
]
}
19 changes: 19 additions & 0 deletions extensions/vscode/.vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "build",
"command": "npm",
"args": ["run", "compile"],
"type": "shell",
"group": {
"kind": "build",
"isDefault": true
},
"presentation": {
"reveal": "silent"
},
"problemMatcher": "$tsc"
}
]
}
12 changes: 12 additions & 0 deletions extensions/vscode/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Chat Output Renderer sample

This VS Code extension sample demonstrates usage of the proposed chat output renderer API. This API allows extensions to
contribute custom rendered widgets into VS Code's chat interface. Language models can invoke tools to create these widgets. The widgets are rendered using VS Code's webview API.

## Running the Sample

- Make sure you are using VS Code 1.103 or newer.
- Run `npm install` in terminal to install dependencies

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I understand correctly, this needs to run from folder extensions\vscode. If so, mention it in the readme.

- Run the `Run Extension` target in the Debug View. This will:
- Start a task `npm: watch` to compile the code
- Run the extension in a new VS Code window
37 changes: 37 additions & 0 deletions extensions/vscode/esbuild.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
const { build } = require('esbuild')

const baseConfig = {
bundle: true,
minify: process.env.NODE_ENV === 'production',
sourcemap: process.env.NODE_ENV !== 'production',
}

const extensionConfig = {
...baseConfig,
platform: 'node',
mainFields: ['module', 'main'],
format: 'cjs',
entryPoints: ['./src/extension.ts'],
outfile: './out/extension.js',
external: ['vscode'],
}

const webviewConfig = {
...baseConfig,
target: 'es2020',
format: 'esm',
entryPoints: ['./src/webview/index.tsx'],
outfile: './out/webview/index.js',
};

(async () => {
try {
await build(extensionConfig)
await build(webviewConfig)
console.log('build complete')
}
catch (err) {
process.stderr.write(err.stderr)
process.exit(1)
}
})()
35 changes: 35 additions & 0 deletions extensions/vscode/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import stylistic from '@stylistic/eslint-plugin'
import tsEslint from 'typescript-eslint'
import js from '@eslint/js'

export default [
js.configs.recommended,
...tsEslint.configs.recommended,
stylistic.configs['recommended-flat'],
{
files: ['**/*.ts', '**/*.tsx'],
languageOptions: {
parser: tsEslint.parser,
parserOptions: {
ecmaFeatures: {
jsx: true,
},
project: './tsconfig.json',
},
},
rules: {
'@typescript-eslint/no-explicit-any': 'off',
'@stylistic/indent': ['error', 'tab', { SwitchCase: 1 }],
'@stylistic/no-tabs': 'off',
'@stylistic/jsx-indent-props': ['error', 'tab'],
'@typescript-eslint/no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
caughtErrorsIgnorePattern: '^_',
},
],
},
},
]
Loading