Skip to content

Commit 526380f

Browse files
committed
refactor: add code-snippet wrapper extension during transition period
1 parent 735a7f1 commit 526380f

File tree

13 files changed

+193
-12
lines changed

13 files changed

+193
-12
lines changed

.gitignore

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,9 @@ lerna-debug.log
2424
packages/backend/dummy/main.js
2525

2626
# this folder should be initially empty when running the contributor snippet example.
27-
examples/dummy-scripts/.vscode
27+
examples/dummy-scripts/.vscode
28+
29+
# macOS
30+
.DS_Store
31+
32+
yarn-error.log

packages/backend/README.md

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
1-
# Code Snippet (Framework) VSCode Extension
1+
# Code Snippet Framework VSCode Extension
22

33
## Preview
44

5-
![form gui screenshot](./resources/preview.png)
5+
![Form GUI Screenshot](./resources/preview.png)
66

7-
## Description
7+
## Overview
88

9-
This component is the VSCode extension part of the VSCode Code Snippet Framework.
10-
It is responsible for:
9+
This package is the VSCode extension for the Code Snippet Framework. It enables:
1110

12-
- Loading code snippets contributions (plugins) (e.g [vscode-snippet-contrib](../../examples)).
13-
- Rendering the code snippet form GUI to display relevant questions to the end user:
14-
- inside a [VSCode webview](https://code.visualstudio.com/api/extension-guides/webview).
15-
- Note that the form GUI is developed, in a separate [sub-package](../frontend).
16-
- Bridging between the frontend GUI and the contributions/plugins, e.g:
11+
- Loading code snippet contributions (plugins) for extensibility.
12+
- Rendering a dynamic code snippet form GUI in a [VSCode webview](https://code.visualstudio.com/api/extension-guides/webview) to present relevant questions to users. The form GUI is developed as a separate sub-package.
13+
- Bridging between the frontend GUI and snippet contributions/plugins, including:
1714
- Invoking custom validation logic.
18-
- Sending the "answers" of the end user back to the contribution/plugin.
15+
- Sending user-provided answers back to the respective contribution/plugin.
16+
17+
This architecture supports interactive, extensible code snippet generation in VSCode, combining custom logic with a modern user interface.

packages/wrapper/.nycrc.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"require": ["ts-node/register/transpile-only"],
3+
"include": ["src/**/*.ts"],
4+
"reporter": ["lcov", "text"],
5+
"extension": [".ts"],
6+
"all": true,
7+
"temp-dir": "./reports/.nyc_output",
8+
"report-dir": "./reports/coverage",
9+
"check-coverage": true
10+
}

packages/wrapper/.vscodeignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
**
2+
!LICENSES
3+
!.reuse
4+
!LICENSE
5+
!README.md
6+
!package.json
7+
!logo.png
8+
!dist/media
9+
!dist/*.js
10+
!resources

packages/wrapper/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Change Log
2+
3+
All notable changes to this project will be documented in this file.
4+
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

packages/wrapper/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Code Snippet Wrapper VSCode Extension
2+
3+
> **Deprecated:** Please use [saposs.ccode-snippet-framework](https://marketplace.visualstudio.com/items?itemName=saposs.ccode-snippet-framework) instead.

packages/wrapper/logo.png

2.56 KB
Loading

packages/wrapper/package.json

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
{
2+
"name": "code-snippet",
3+
"displayName": "Code Snippet wrapper",
4+
"version": "2.0.0",
5+
"private": true,
6+
"description": "A VSCode extension that provides a simple way to add code snippets.",
7+
"categories": [
8+
"Other"
9+
],
10+
"keywords": [
11+
"code",
12+
"snippet",
13+
"snipping ",
14+
"tool",
15+
"sap"
16+
],
17+
"bugs": {
18+
"url": "https://github.com/SAP/code-snippet/issues"
19+
},
20+
"repository": {
21+
"type": "git",
22+
"url": "https://github.com/SAP/code-snippet.git"
23+
},
24+
"license": "Apache 2.0",
25+
"publisher": "SAPOSS",
26+
"main": "./dist/extension",
27+
"scripts": {
28+
"bundle": "webpack --mode production",
29+
"bundle-dev": "webpack --mode development --watch",
30+
"ci": "npm-run-all clean compile coverage bundle package coverage coverage:copy",
31+
"clean": "rimraf ./dist ./coverage *.vsix",
32+
"compile": "tsc -p ./",
33+
"coverage": "nyc mocha -p tsconfig.json --recursive test/**/*.spec.ts",
34+
"coverage:copy": "shx mkdir -p ../../coverage && shx cp -u ./reports/coverage/lcov.info ../../coverage/lcov_backend.info",
35+
"package": "vsce package --yarn .",
36+
"test": "mocha -p tsconfig.json --recursive test/**/*.spec.ts"
37+
},
38+
"activationEvents": [],
39+
"extensionDependencies": [
40+
"saposs.code-snippet-framework"
41+
],
42+
"devDependencies": {
43+
"@types/sinon": "^10.0.11",
44+
"copy-webpack-plugin": "^5.0.5",
45+
"sinon": "^9.2.1",
46+
"string-replace-loader": "^2.1.1",
47+
"ts-loader": "^8.0.14",
48+
"ts-node": "^9.1.1",
49+
"vsce": "^1.73.0",
50+
"webpack": "^5.89.0",
51+
"webpack-cli": "5.1.4"
52+
},
53+
"engines": {
54+
"vscode": "^1.44.2"
55+
},
56+
"icon": "logo.png"
57+
}

packages/wrapper/src/extension.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
export function activate(): void {
2+
console.log("Extension activated");
3+
}
4+
5+
export function deactivate(): void {
6+
console.log("Extension deactivated");
7+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { expect } from "chai";
2+
import * as sinon from "sinon";
3+
4+
import * as extension from "../src/extension";
5+
6+
describe("extension unit test", () => {
7+
let sandbox: any;
8+
9+
before(() => {
10+
sandbox = sinon.createSandbox();
11+
});
12+
13+
after(() => {
14+
sandbox.restore();
15+
});
16+
17+
describe("activate", () => {
18+
it("activation", () => {
19+
expect(extension.activate()).to.be.undefined;
20+
});
21+
});
22+
23+
it("deactivate", () => {
24+
expect(extension.deactivate()).to.be.undefined;
25+
});
26+
});

0 commit comments

Comments
 (0)