Skip to content

Commit 794d0b5

Browse files
committed
chore: vscode extension init
0 parents  commit 794d0b5

20 files changed

+3368
-0
lines changed

.gitignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
out
2+
dist
3+
node_modules
4+
.vscode-test/
5+
*.vsix

.idea/.gitignore

+5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/material_theme_project_new.xml

+10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.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+
});

.vscode/extensions.json

+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+
}

.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+
}

.vscode/settings.json

+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+
}

.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+
}

.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.*

.yarnrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
--ignore-engines true

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 "leetcode-practice-vscode" 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

README.md

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# leetcode-practice-vscode README
2+
3+
This is the README for your extension "leetcode-practice-vscode". 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!**

esbuild.js

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
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+
],
31+
bundle: true,
32+
format: 'cjs',
33+
minify: production,
34+
sourcemap: !production,
35+
sourcesContent: false,
36+
platform: 'node',
37+
outfile: 'dist/extension.js',
38+
external: ['vscode'],
39+
logLevel: 'silent',
40+
plugins: [
41+
/* add to the end of plugins array */
42+
esbuildProblemMatcherPlugin,
43+
],
44+
});
45+
if (watch) {
46+
await ctx.watch();
47+
} else {
48+
await ctx.rebuild();
49+
await ctx.dispose();
50+
}
51+
}
52+
53+
main().catch(e => {
54+
console.error(e);
55+
process.exit(1);
56+
});

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+
}];

package.json

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
{
2+
"name": "leetcode-practice-vscode",
3+
"displayName": "leetcode-practice",
4+
"description": "A extension on vs code for leetcode-practice.",
5+
"version": "0.0.1",
6+
"engines": {
7+
"vscode": "^1.96.0"
8+
},
9+
"categories": [
10+
"Other"
11+
],
12+
"activationEvents": [],
13+
"main": "./dist/extension.js",
14+
"contributes": {
15+
"commands": [
16+
{
17+
"command": "leetcode-practice-vscode.helloWorld",
18+
"title": "Hello World"
19+
}
20+
]
21+
},
22+
"scripts": {
23+
"vscode:prepublish": "yarn run package",
24+
"compile": "yarn run check-types && yarn run lint && node esbuild.js",
25+
"watch": "npm-run-all -p watch:*",
26+
"watch:esbuild": "node esbuild.js --watch",
27+
"watch:tsc": "tsc --noEmit --watch --project tsconfig.json",
28+
"package": "yarn run check-types && yarn run lint && node esbuild.js --production",
29+
"compile-tests": "tsc -p . --outDir out",
30+
"watch-tests": "tsc -p . -w --outDir out",
31+
"pretest": "yarn run compile-tests && yarn run compile && yarn run lint",
32+
"check-types": "tsc --noEmit",
33+
"lint": "eslint src",
34+
"test": "vscode-test"
35+
},
36+
"devDependencies": {
37+
"@types/vscode": "^1.96.0",
38+
"@types/mocha": "^10.0.10",
39+
"@types/node": "20.x",
40+
"@typescript-eslint/eslint-plugin": "^8.17.0",
41+
"@typescript-eslint/parser": "^8.17.0",
42+
"eslint": "^9.16.0",
43+
"esbuild": "^0.24.0",
44+
"npm-run-all": "^4.1.5",
45+
"typescript": "^5.7.2",
46+
"@vscode/test-cli": "^0.0.10",
47+
"@vscode/test-electron": "^2.4.1"
48+
}
49+
}

0 commit comments

Comments
 (0)