Skip to content

Commit e4d967d

Browse files
authored
Merge pull request #583 from Cloud-Code-AI/582-feat-add-a-vs-code-extension
582 feat add a vs code extension
2 parents cb15ec7 + cc6b2c1 commit e4d967d

31 files changed

+6460
-1
lines changed

.gitignore

+6-1
Original file line numberDiff line numberDiff line change
@@ -167,4 +167,9 @@ node_modules
167167
.cloudcode
168168
tree_sitter_languages/
169169

170-
.experiments/code_review/.*
170+
.experiments/code_review/.*
171+
172+
out
173+
node_modules
174+
.vscode-test/
175+
*.vsix

extensions/vscode/.vscode-test.mjs

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { defineConfig } from '@vscode/test-cli';
2+
3+
export default defineConfig({
4+
files: 'out/test/**/*.test.js',
5+
});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
// See http://go.microsoft.com/fwlink/?LinkId=827846
3+
// for the documentation about the extensions.json format
4+
"recommendations": ["dbaeumer.vscode-eslint", "connor4312.esbuild-problem-matchers", "ms-vscode.extension-test-runner"]
5+
}

extensions/vscode/.vscode/launch.json

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// A launch configuration that compiles the extension and then opens it inside a new window
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
{
6+
"version": "0.2.0",
7+
"configurations": [
8+
{
9+
"name": "Run Extension",
10+
"type": "extensionHost",
11+
"request": "launch",
12+
"args": [
13+
"--extensionDevelopmentPath=${workspaceFolder}"
14+
],
15+
"outFiles": [
16+
"${workspaceFolder}/dist/**/*.js"
17+
],
18+
"preLaunchTask": "${defaultBuildTask}"
19+
}
20+
]
21+
}
+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Place your settings in this file to overwrite default and user settings.
2+
{
3+
"files.exclude": {
4+
"out": false, // set this to true to hide the "out" folder with the compiled JS files
5+
"dist": false // set this to true to hide the "dist" folder with the compiled JS files
6+
},
7+
"search.exclude": {
8+
"out": true, // set this to false to include "out" folder in search results
9+
"dist": true // set this to false to include "dist" folder in search results
10+
},
11+
// Turn off tsc task auto detection since we have the necessary tasks as npm scripts
12+
"typescript.tsc.autoDetect": "off"
13+
}

extensions/vscode/.vscode/tasks.json

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
// See https://go.microsoft.com/fwlink/?LinkId=733558
2+
// for the documentation about the tasks.json format
3+
{
4+
"version": "2.0.0",
5+
"tasks": [
6+
{
7+
"label": "watch",
8+
"dependsOn": [
9+
"npm: watch:tsc",
10+
"npm: watch:esbuild"
11+
],
12+
"presentation": {
13+
"reveal": "never"
14+
},
15+
"group": {
16+
"kind": "build",
17+
"isDefault": true
18+
}
19+
},
20+
{
21+
"type": "npm",
22+
"script": "watch:esbuild",
23+
"group": "build",
24+
"problemMatcher": "$esbuild-watch",
25+
"isBackground": true,
26+
"label": "npm: watch:esbuild",
27+
"presentation": {
28+
"group": "watch",
29+
"reveal": "never"
30+
}
31+
},
32+
{
33+
"type": "npm",
34+
"script": "watch:tsc",
35+
"group": "build",
36+
"problemMatcher": "$tsc-watch",
37+
"isBackground": true,
38+
"label": "npm: watch:tsc",
39+
"presentation": {
40+
"group": "watch",
41+
"reveal": "never"
42+
}
43+
},
44+
{
45+
"type": "npm",
46+
"script": "watch-tests",
47+
"problemMatcher": "$tsc-watch",
48+
"isBackground": true,
49+
"presentation": {
50+
"reveal": "never",
51+
"group": "watchers"
52+
},
53+
"group": "build"
54+
},
55+
{
56+
"label": "tasks: watch-tests",
57+
"dependsOn": [
58+
"npm: watch",
59+
"npm: watch-tests"
60+
],
61+
"problemMatcher": []
62+
}
63+
]
64+
}

extensions/vscode/.vscodeignore

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
.vscode/**
2+
.vscode-test/**
3+
out/**
4+
node_modules/**
5+
src/**
6+
.gitignore
7+
.yarnrc
8+
esbuild.js
9+
vsc-extension-quickstart.md
10+
**/tsconfig.json
11+
**/eslint.config.mjs
12+
**/*.map
13+
**/*.ts
14+
**/.vscode-test.*

extensions/vscode/CHANGELOG.md

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Change Log
2+
3+
All notable changes to the "kaizen-cloudcode" extension will be documented in this file.
4+
5+
Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file.
6+
7+
## [Unreleased]
8+
9+
- Initial release

extensions/vscode/README.md

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# kaizen-cloudcode README
2+
3+
This is the README for your extension "kaizen-cloudcode". After writing up a brief description, we recommend including the following sections.
4+
5+
## Features
6+
7+
Describe specific features of your extension including screenshots of your extension in action. Image paths are relative to this README file.
8+
9+
For example if there is an image subfolder under your extension project workspace:
10+
11+
\!\[feature X\]\(images/feature-x.png\)
12+
13+
> Tip: Many popular extensions utilize animations. This is an excellent way to show off your extension! We recommend short, focused animations that are easy to follow.
14+
15+
## Requirements
16+
17+
If you have any requirements or dependencies, add a section describing those and how to install and configure them.
18+
19+
## Extension Settings
20+
21+
Include if your extension adds any VS Code settings through the `contributes.configuration` extension point.
22+
23+
For example:
24+
25+
This extension contributes the following settings:
26+
27+
* `myExtension.enable`: Enable/disable this extension.
28+
* `myExtension.thing`: Set to `blah` to do something.
29+
30+
## Known Issues
31+
32+
Calling out known issues can help limit users opening duplicate issues against your extension.
33+
34+
## Release Notes
35+
36+
Users appreciate release notes as you update your extension.
37+
38+
### 1.0.0
39+
40+
Initial release of ...
41+
42+
### 1.0.1
43+
44+
Fixed issue #.
45+
46+
### 1.1.0
47+
48+
Added features X, Y, and Z.
49+
50+
---
51+
52+
## Following extension guidelines
53+
54+
Ensure that you've read through the extensions guidelines and follow the best practices for creating your extension.
55+
56+
* [Extension Guidelines](https://code.visualstudio.com/api/references/extension-guidelines)
57+
58+
## Working with Markdown
59+
60+
You can author your README using Visual Studio Code. Here are some useful editor keyboard shortcuts:
61+
62+
* Split the editor (`Cmd+\` on macOS or `Ctrl+\` on Windows and Linux).
63+
* Toggle preview (`Shift+Cmd+V` on macOS or `Shift+Ctrl+V` on Windows and Linux).
64+
* Press `Ctrl+Space` (Windows, Linux, macOS) to see a list of Markdown snippets.
65+
66+
## For more information
67+
68+
* [Visual Studio Code's Markdown Support](http://code.visualstudio.com/docs/languages/markdown)
69+
* [Markdown Syntax Reference](https://help.github.com/articles/markdown-basics/)
70+
71+
**Enjoy!**

extensions/vscode/esbuild.js

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
const esbuild = require("esbuild");
2+
3+
const production = process.argv.includes('--production');
4+
const watch = process.argv.includes('--watch');
5+
6+
/**
7+
* @type {import('esbuild').Plugin}
8+
*/
9+
const esbuildProblemMatcherPlugin = {
10+
name: 'esbuild-problem-matcher',
11+
12+
setup(build) {
13+
build.onStart(() => {
14+
console.log('[watch] build started');
15+
});
16+
build.onEnd((result) => {
17+
result.errors.forEach(({ text, location }) => {
18+
console.error(`✘ [ERROR] ${text}`);
19+
console.error(` ${location.file}:${location.line}:${location.column}:`);
20+
});
21+
console.log('[watch] build finished');
22+
});
23+
},
24+
};
25+
26+
async function main() {
27+
const ctx = await esbuild.context({
28+
entryPoints: [
29+
'src/extension.ts',
30+
'./src/sidebar.ts'
31+
],
32+
bundle: true,
33+
format: 'cjs',
34+
minify: production,
35+
sourcemap: !production,
36+
sourcesContent: false,
37+
platform: 'node',
38+
outdir: 'out',
39+
external: ['vscode'],
40+
logLevel: 'silent',
41+
plugins: [
42+
/* add to the end of plugins array */
43+
esbuildProblemMatcherPlugin,
44+
],
45+
});
46+
if (watch) {
47+
await ctx.watch();
48+
} else {
49+
await ctx.rebuild();
50+
await ctx.dispose();
51+
}
52+
}
53+
54+
main().catch(e => {
55+
console.error(e);
56+
process.exit(1);
57+
});

extensions/vscode/eslint.config.mjs

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import typescriptEslint from "@typescript-eslint/eslint-plugin";
2+
import tsParser from "@typescript-eslint/parser";
3+
4+
export default [{
5+
files: ["**/*.ts"],
6+
}, {
7+
plugins: {
8+
"@typescript-eslint": typescriptEslint,
9+
},
10+
11+
languageOptions: {
12+
parser: tsParser,
13+
ecmaVersion: 2022,
14+
sourceType: "module",
15+
},
16+
17+
rules: {
18+
"@typescript-eslint/naming-convention": ["warn", {
19+
selector: "import",
20+
format: ["camelCase", "PascalCase"],
21+
}],
22+
23+
curly: "warn",
24+
eqeqeq: "warn",
25+
"no-throw-literal": "warn",
26+
semi: "warn",
27+
},
28+
}];

extensions/vscode/media/logo.png

34.8 KB
Loading

extensions/vscode/media/sidebar.css

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#buttons {
2+
display: flex;
3+
flex-direction: column;
4+
gap: 10px;
5+
padding: 10px;
6+
}
7+
8+
.webview-button {
9+
width: 100%;
10+
padding: 8px 12px;
11+
text-align: left;
12+
background-color: var(--vscode-button-background);
13+
color: var(--vscode-button-foreground);
14+
border: none;
15+
border-radius: 2px;
16+
cursor: pointer;
17+
font-size: 14px;
18+
transition: background-color 0.2s ease;
19+
}
20+
21+
.webview-button:hover {
22+
background-color: var(--vscode-button-hoverBackground);
23+
}
24+
25+
.webview-button:active {
26+
background-color: var(--vscode-button-activeBackground);
27+
}

0 commit comments

Comments
 (0)