Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
magic-akari committed Aug 26, 2023
0 parents commit 99e9d67
Show file tree
Hide file tree
Showing 20 changed files with 1,348 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# EditorConfig is awesome: https://EditorConfig.org

# top-most EditorConfig file
root = true

[*]
indent_style = tab
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = false
insert_final_newline = false
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
out
dist
node_modules
.vscode-test-web/
*.vsix
.DS_Store
1 change: 1 addition & 0 deletions .node-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v18.17.1
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
enable-pre-post-scripts = true
23 changes: 23 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// A launch configuration that compiles the extension and then opens it inside a new window
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
{
"version": "0.2.0",
"configurations": [
{
"name": "Run Web Extension ",
"type": "pwa-extensionHost",
"debugWebWorkerHost": true,
"request": "launch",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}",
"--extensionDevelopmentKind=web"
],
"outFiles": [
"${workspaceFolder}/out/**/*.js"
],
"preLaunchTask": "npm: watch"
}
]
}
11 changes: 11 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Place your settings in this file to overwrite default and user settings.
{
"files.exclude": {
"out": false // set this to true to hide the "out" folder with the compiled JS files
},
"search.exclude": {
"out": true // set this to false to include "out" folder in search results
},
// Turn off tsc task auto detection since we have the necessary tasks as npm scripts
"typescript.tsc.autoDetect": "off"
}
21 changes: 21 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
{
"version": "2.0.0",
"tasks": [
{
"type": "npm",
"script": "compile",
"group": {
"kind": "build",
"isDefault": true
}
},
{
"type": "npm",
"script": "watch",
"group": "build",
"isBackground": true
}
]
}
13 changes: 13 additions & 0 deletions .vscodeignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.vscode/**
.vscode-test-web/**
src/**
out/**
node_modules/**
.gitignore
vsc-extension-quickstart.md
webpack.config.js
.yarnrc
**/tsconfig.json
**/.eslintrc.json
**/*.map
**/*.ts
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Change Log

All notable changes to the "wasm-fmt" extension will be documented in this file.

Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file.

## [Unreleased]

- Initial release
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 wasm-fmt

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
35 changes: 35 additions & 0 deletions esbuild.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/usr/bin/env node
import * as esbuild from "esbuild";
import process from "node:process";

/**
* @typedef {import("esbuild").BuildOptions} BuildOptions
*/

/**
* @type BuildOptions
*/
const options = {
entryPoints: ["src/extension.ts"],
outdir: "out",
publicPath: "out",
bundle: true,
target: "es2020",
loader: { ".wasm": "file" },
external: ["vscode"],
platform: "node",
};

if (process.argv.includes("--watch")) {
const ctxt = await esbuild.context(options);
ctxt.watch();
console.log("Watching for changes...");

process.on("SIGINT", () => {
ctxt.dispose();
console.log("Stopped and cleaned up.");
process.exit(0);
});
} else {
await esbuild.build(options);
}
49 changes: 49 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
"name": "wasm-fmt",
"displayName": "wasm-fmt",
"description": "Code Formatter powered by WebAssembly",
"author": "magic-akari",
"publisher": "wasm-fmt",
"version": "0.0.1",
"license": "MIT",
"engines": {
"vscode": "^1.81.0"
},
"categories": [
"Formatters"
],
"activationEvents": [
"onLanguage:c",
"onLanguage:cpp",
"onLanguage:csharp",
"onLanguage:go",
"onLanguage:java",
"onLanguage:javascript",
"onLanguage:json",
"onLanguage:jsonc",
"onLanguage:objective-c",
"onLanguage:objective-cpp",
"onLanguage:python",
"onLanguage:typescript",
"onLanguage:proto"
],
"browser": "./out/extension.js",
"contributes": {},
"scripts": {
"vscode:prepublish": "pnpm run compile",
"compile": "./esbuild.mjs",
"watch": "./esbuild.mjs --watch",
"run:browser": "vscode-test-web --browserType=chromium --extensionDevelopmentPath=. ."
},
"devDependencies": {
"@types/node": "^20.5.6",
"@types/vscode": "^1.81.0",
"@vscode/test-web": "^0.0.45",
"esbuild": "^0.19.2"
},
"dependencies": {
"@wasm-fmt/clang-format": "^0.1.0",
"@wasm-fmt/gofmt": "^0.4.0",
"@wasm-fmt/ruff_fmt": "^0.2.1"
}
}
Loading

0 comments on commit 99e9d67

Please sign in to comment.