From 4064c6a89748e584c89f8a7b13ac15335ea19e7c Mon Sep 17 00:00:00 2001 From: Patrick Sullivan Date: Sun, 10 Dec 2023 20:39:33 -0500 Subject: [PATCH] feat(ui-webview): Added a new library for webview components to be used in vscode --- packages/ui-webview/README.md | 7 + packages/ui-webview/eslint.config.js | 19 ++ packages/ui-webview/package.json | 12 + packages/ui-webview/project.json | 36 +++ packages/ui-webview/src/index.ts | 1 + .../ui-webview/src/lib/ui-webview.module.css | 7 + packages/ui-webview/src/lib/ui-webview.tsx | 31 +++ packages/ui-webview/tsconfig.json | 21 ++ packages/ui-webview/tsconfig.lib.json | 24 ++ packages/ui-webview/tsconfig.spec.json | 26 +++ packages/ui-webview/vite.config.ts | 66 ++++++ packages/vscode-extension/README.md | 216 ------------------ packages/vscode-extension/eslint.config.js | 40 ---- packages/vscode-extension/jest.config.ts | 7 - packages/vscode-extension/package.json | 124 ---------- packages/vscode-extension/project.json | 116 ---------- .../src/config/configuration-store.ts | 45 ---- .../vscode-extension/src/config/logger.ts | 20 -- packages/vscode-extension/src/config/store.ts | 7 - .../src/config/task-execution-messages.ts | 95 -------- .../vscode-extension/src/extension/main.ts | 182 --------------- .../src/extension/refresh-workspace.ts | 30 --- .../src/extension/run-target-tree-item.ts | 69 ------ packages/vscode-extension/src/index.ts | 10 - .../src/language-server/main.ts | 13 -- packages/vscode-extension/tsconfig.json | 11 - packages/vscode-extension/tsconfig.spec.json | 13 -- 27 files changed, 250 insertions(+), 998 deletions(-) create mode 100644 packages/ui-webview/README.md create mode 100644 packages/ui-webview/eslint.config.js create mode 100644 packages/ui-webview/package.json create mode 100644 packages/ui-webview/project.json create mode 100644 packages/ui-webview/src/index.ts create mode 100644 packages/ui-webview/src/lib/ui-webview.module.css create mode 100644 packages/ui-webview/src/lib/ui-webview.tsx create mode 100644 packages/ui-webview/tsconfig.json create mode 100644 packages/ui-webview/tsconfig.lib.json create mode 100644 packages/ui-webview/tsconfig.spec.json create mode 100644 packages/ui-webview/vite.config.ts delete mode 100644 packages/vscode-extension/README.md delete mode 100644 packages/vscode-extension/eslint.config.js delete mode 100644 packages/vscode-extension/jest.config.ts delete mode 100644 packages/vscode-extension/package.json delete mode 100644 packages/vscode-extension/project.json delete mode 100644 packages/vscode-extension/src/config/configuration-store.ts delete mode 100644 packages/vscode-extension/src/config/logger.ts delete mode 100644 packages/vscode-extension/src/config/store.ts delete mode 100644 packages/vscode-extension/src/config/task-execution-messages.ts delete mode 100644 packages/vscode-extension/src/extension/main.ts delete mode 100644 packages/vscode-extension/src/extension/refresh-workspace.ts delete mode 100644 packages/vscode-extension/src/extension/run-target-tree-item.ts delete mode 100644 packages/vscode-extension/src/index.ts delete mode 100644 packages/vscode-extension/src/language-server/main.ts delete mode 100644 packages/vscode-extension/tsconfig.json delete mode 100644 packages/vscode-extension/tsconfig.spec.json diff --git a/packages/ui-webview/README.md b/packages/ui-webview/README.md new file mode 100644 index 0000000..5a128d0 --- /dev/null +++ b/packages/ui-webview/README.md @@ -0,0 +1,7 @@ +# ui-webview + +This library was generated with [Nx](https://nx.dev). + +## Running unit tests + +Run `nx test ui-webview` to execute the unit tests via [Vitest](https://vitest.dev/). diff --git a/packages/ui-webview/eslint.config.js b/packages/ui-webview/eslint.config.js new file mode 100644 index 0000000..94c2748 --- /dev/null +++ b/packages/ui-webview/eslint.config.js @@ -0,0 +1,19 @@ +const baseConfig = require("../../eslint.config.js"); + +module.exports = [ + ...baseConfig, + { + files: ["**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx"], + parserOptions: { project: ["packages/ui-webview/tsconfig.*?.json"] }, + rules: {} + }, + { + files: ["**/*.ts", "**/*.tsx"], + rules: {} + }, + { + files: ["**/*.js", "**/*.jsx"], + rules: {} + }, + ...compat.extends("plugin:@nx/react") +]; diff --git a/packages/ui-webview/package.json b/packages/ui-webview/package.json new file mode 100644 index 0000000..80c0265 --- /dev/null +++ b/packages/ui-webview/package.json @@ -0,0 +1,12 @@ +{ + "name": "@acidic/ui-webview", + "version": "0.0.1", + "exports": { + ".": { + "import": "./index.mjs", + "require": "./index.js" + } + }, + "main": "./index.js", + "types": "./index.d.ts" +} diff --git a/packages/ui-webview/project.json b/packages/ui-webview/project.json new file mode 100644 index 0000000..6e91def --- /dev/null +++ b/packages/ui-webview/project.json @@ -0,0 +1,36 @@ +{ + "name": "ui-webview", + "$schema": "../../node_modules/nx/schemas/project-schema.json", + "sourceRoot": "packages/ui-webview/src", + "projectType": "library", + "tags": [], + "targets": { + "lint": { + "executor": "@nx/eslint:lint", + "outputs": ["{options.outputFile}"] + }, + "build": { + "executor": "@nx/vite:build", + "outputs": ["{options.outputPath}"], + "defaultConfiguration": "production", + "options": { + "outputPath": "dist/packages/ui-webview" + }, + "configurations": { + "development": { + "mode": "development" + }, + "production": { + "mode": "production" + } + } + }, + "test": { + "executor": "@nx/vite:test", + "outputs": ["{options.reportsDirectory}"], + "options": { + "reportsDirectory": "../../coverage/packages/ui-webview" + } + } + } +} diff --git a/packages/ui-webview/src/index.ts b/packages/ui-webview/src/index.ts new file mode 100644 index 0000000..74789b6 --- /dev/null +++ b/packages/ui-webview/src/index.ts @@ -0,0 +1 @@ +export * from "./lib/ui-webview"; diff --git a/packages/ui-webview/src/lib/ui-webview.module.css b/packages/ui-webview/src/lib/ui-webview.module.css new file mode 100644 index 0000000..45c2aa4 --- /dev/null +++ b/packages/ui-webview/src/lib/ui-webview.module.css @@ -0,0 +1,7 @@ +/* + * Replace this with your own classes + * + * e.g. + * .container { + * } +*/ diff --git a/packages/ui-webview/src/lib/ui-webview.tsx b/packages/ui-webview/src/lib/ui-webview.tsx new file mode 100644 index 0000000..57cef48 --- /dev/null +++ b/packages/ui-webview/src/lib/ui-webview.tsx @@ -0,0 +1,31 @@ +import styles from "./ui-webview.module.css"; + +/* eslint-disable-next-line */ +export interface UiWebviewProps {} + +export function UiWebview(props: UiWebviewProps) { + return ( +
+

Welcome to UiWebview!

+
+ ); +} + +export default UiWebview; + +if (import.meta.vitest) { + // add tests related to your file here + // For more information please visit the Vitest docs site here: https://vitest.dev/guide/in-source.html + + const { it, expect, beforeEach } = import.meta.vitest; + let render: typeof import("@testing-library/react").render; + + beforeEach(async () => { + render = (await import("@testing-library/react")).render; + }); + + it("should render successfully", () => { + const { baseElement } = render(); + expect(baseElement).toBeTruthy(); + }); +} diff --git a/packages/ui-webview/tsconfig.json b/packages/ui-webview/tsconfig.json new file mode 100644 index 0000000..cc96381 --- /dev/null +++ b/packages/ui-webview/tsconfig.json @@ -0,0 +1,21 @@ +{ + "compilerOptions": { + "jsx": "react-jsx", + "allowJs": false, + "esModuleInterop": false, + "allowSyntheticDefaultImports": true, + "strict": true, + "types": ["vite/client", "vitest"] + }, + "files": [], + "include": [], + "references": [ + { + "path": "./tsconfig.lib.json" + }, + { + "path": "./tsconfig.spec.json" + } + ], + "extends": "../../tsconfig.base.json" +} diff --git a/packages/ui-webview/tsconfig.lib.json b/packages/ui-webview/tsconfig.lib.json new file mode 100644 index 0000000..0bbdf40 --- /dev/null +++ b/packages/ui-webview/tsconfig.lib.json @@ -0,0 +1,24 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../dist/out-tsc", + "types": [ + "node", + "@nx/react/typings/cssmodule.d.ts", + "@nx/react/typings/image.d.ts", + "vite/client", + "vitest/importMeta" + ] + }, + "exclude": [ + "**/*.spec.ts", + "**/*.test.ts", + "**/*.spec.tsx", + "**/*.test.tsx", + "**/*.spec.js", + "**/*.test.js", + "**/*.spec.jsx", + "**/*.test.jsx" + ], + "include": ["src/**/*.js", "src/**/*.jsx", "src/**/*.ts", "src/**/*.tsx"] +} diff --git a/packages/ui-webview/tsconfig.spec.json b/packages/ui-webview/tsconfig.spec.json new file mode 100644 index 0000000..3c002c2 --- /dev/null +++ b/packages/ui-webview/tsconfig.spec.json @@ -0,0 +1,26 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../dist/out-tsc", + "types": [ + "vitest/globals", + "vitest/importMeta", + "vite/client", + "node", + "vitest" + ] + }, + "include": [ + "vite.config.ts", + "vitest.config.ts", + "src/**/*.test.ts", + "src/**/*.spec.ts", + "src/**/*.test.tsx", + "src/**/*.spec.tsx", + "src/**/*.test.js", + "src/**/*.spec.js", + "src/**/*.test.jsx", + "src/**/*.spec.jsx", + "src/**/*.d.ts" + ] +} diff --git a/packages/ui-webview/vite.config.ts b/packages/ui-webview/vite.config.ts new file mode 100644 index 0000000..9ac92c5 --- /dev/null +++ b/packages/ui-webview/vite.config.ts @@ -0,0 +1,66 @@ +/// +import { nxViteTsPaths } from "@nx/vite/plugins/nx-tsconfig-paths.plugin"; +import react from "@vitejs/plugin-react-swc"; +import * as path from "path"; +import { defineConfig } from "vite"; +import dts from "vite-plugin-dts"; + +export default defineConfig({ + root: __dirname, + cacheDir: "../../node_modules/.vite/packages/ui-webview", + + plugins: [ + react(), + nxViteTsPaths(), + dts({ + entryRoot: "src", + tsConfigFilePath: path.join(__dirname, "tsconfig.lib.json"), + skipDiagnostics: true + }) + ], + + // Uncomment this if you are using workers. + // worker: { + // plugins: [ nxViteTsPaths() ], + // }, + + // Configuration for building your library. + // See: https://vitejs.dev/guide/build.html#library-mode + build: { + outDir: "../../dist/packages/ui-webview", + reportCompressedSize: true, + commonjsOptions: { + transformMixedEsModules: true + }, + lib: { + // Could also be a dictionary or array of multiple entry points. + entry: "src/index.ts", + name: "ui-webview", + fileName: "index", + // Change this to the formats you want to support. + // Don't forget to update your package.json as well. + formats: ["es", "cjs"] + }, + rollupOptions: { + // External packages that should not be bundled into your library. + external: ["react", "react-dom", "react/jsx-runtime"] + } + }, + define: { + "import.meta.vitest": undefined + }, + test: { + globals: true, + cache: { + dir: "../../node_modules/.vitest" + }, + environment: "jsdom", + include: ["src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}"], + includeSource: ["src/**/*.{js,mjs,cjs,ts,mts,cts,jsx,tsx}"], + reporters: ["default"], + coverage: { + reportsDirectory: "../../coverage/packages/ui-webview", + provider: "v8" + } + } +}); diff --git a/packages/vscode-extension/README.md b/packages/vscode-extension/README.md deleted file mode 100644 index 0cbc8e2..0000000 --- a/packages/vscode-extension/README.md +++ /dev/null @@ -1,216 +0,0 @@ - - - - - -
Acidic
- -
-
-Website | Contact | Report a Bug | Request a Feature | Request Documentation | Ask a Question -
- -
-๐Ÿงช Acidic is a modeling tool that can be used to describe and generate code for API end points, database tables, type definitions, client components, and so much more! -

- -โšกStorm Workspaces are built using Nx, a set of extensible dev tools for monorepos, which helps you develop like Google, Facebook, and Microsoft. Building on top of Nx, the Open System provides a set of tools and patterns that help you scale your monorepo to many teams while keeping the codebase maintainable. - -

๐Ÿ’ป Visit stormsoftware.org to stay up to date with this developer


- -[![Version](https://img.shields.io/badge/version-0.0.1-1fb2a6.svg?style=for-the-badge&color=1fb2a6)](https://prettier.io/)  -[![Nx](https://img.shields.io/badge/Nx-17.0.2-lightgrey?style=for-the-badge&logo=nx&logoWidth=20&&color=1fb2a6)](http://nx.dev/) [![NextJs](https://img.shields.io/badge/Next.js-14.0.2-lightgrey?style=for-the-badge&logo=nextdotjs&logoWidth=20&color=1fb2a6)](https://nextjs.org/) [![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=for-the-badge&logo=commitlint&color=1fb2a6)](http://commitizen.github.io/cz-cli/) ![Semantic-Release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=for-the-badge&color=1fb2a6) [![documented with docusaurus](https://img.shields.io/badge/documented_with-docusaurus-success.svg?style=for-the-badge&logo=readthedocs&color=1fb2a6)](https://docusaurus.io/) ![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/storm-software/storm-ops/cr.yml?style=for-the-badge&logo=github-actions&color=1fb2a6) - -

โš ๏ธ Attention โš ๏ธ This repository, and the apps, libraries, and tools contained within, is still in it's initial development phase. As a result, bugs and issues are expected with it's usage. When the main development phase completes, a proper release will be performed, the packages will be availible through NPM (and other distributions), and this message will be removed. However, in the meantime, please feel free to report any issues you may come across.


- - - - - - - -# vscode-extension - -An extension for Visual Studio Code to - -# Acidic Language Tools - -The ๐Ÿงช **Acidic language tools** extension is used to create schemas for your business models and generate static code based on those models Visual Studio Code. This package supports using Acidic in for local development. This language definition is used by the Acidic Language Server to provide support for other Acidic tools (CLI, Nx Plugins, etc.). Included is the specification of the syntax and semantics of Acidic. - -This extension provides the user with a great developer experience when working with Acidic models - - - - -## Installing - -Using [pnpm](http://pnpm.io): - -```bash -pnpm add -D @acidic/vscode-extension -``` - -
- Using npm - -```bash -npm install -D @acidic/vscode-extension -``` - -
- -
- Using yarn - -```bash -yarn add -D @acidic/vscode-extension -``` - -
- -## Reduced Package Size - -This project uses [tsup](https://tsup.egoist.dev/) to package the source code due to its ability to remove unused code and ship smaller javascript files thanks to code splitting. This helps to greatly reduce the size of the package and to make it easier to use in other projects. - -## Development - -This project is built using [Nx](https://nx.dev). As a result, many of the usual commands are available to assist in development. - -### Building - -Run `nx build vscode-extension` to build the library. - -### Running unit tests - -Run `nx test vscode-extension` to execute the unit tests via [Jest](https://jestjs.io). - -### Linting - -Run `nx lint vscode-extension` to run [ESLint](https://eslint.org/) on the package. - - - - - - -## Quick Features - -Some of the features of **Acidic** include the following: - -- Describe your whole service in a single model, but allow for fined grained control (database structure, Api requests/response, validations, auth, etc.) -- Generate code for your entire service from a single model -- Visual Studio Code extension -- CLI tools to drive processing -- Nx plugins for an improved development experience - -## Model-Driven Development - -**Acidic** refers to a collection of applications and libraries that are used to build server-side code from a user-defined model. The specification for this language can be found in the monorepo's [language package](/packages/language/). - -
Acidic Engine flow
-
- -More information can be found in the [๐Ÿ““ Acidic Documentation](https://acidic.io/docs). -
- -## Storm Workspaces - -Storm workspaces are built using Nx, a set of extensible dev tools for monorepos, which helps you develop like Google, Facebook, and Microsoft. Building on top of Nx, the Open System provides a set of tools and patterns that help you scale your monorepo to many teams while keeping the codebase maintainable. - -## Roadmap - -See the [open issues](https://github.com/storm-software/acidic/issues) for a list of proposed features (and known issues). - -- [Top Feature Requests](https://github.com/storm-software/acidic/issues?q=label%3Aenhancement+is%3Aopen+sort%3Areactions-%2B1-desc) (Add your votes using the ๐Ÿ‘ reaction) -- [Top Bugs](https://github.com/storm-software/acidic/issues?q=is%3Aissue+is%3Aopen+label%3Abug+sort%3Areactions-%2B1-desc) (Add your votes using the ๐Ÿ‘ reaction) -- [Newest Bugs](https://github.com/storm-software/acidic/issues?q=is%3Aopen+is%3Aissue+label%3Abug) - -## Support - -Reach out to the maintainer at one of the following places: - -- [Contact](https://stormsoftware.org/contact) -- [GitHub discussions](https://github.com/storm-software/acidic/discussions) -- - -## License - -This project is licensed under the **Apache License 2.0**. Feel free to edit and distribute this template as you like. - -See [LICENSE](LICENSE) for more information. - -## Changelog - -This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). Every release, along with the migration instructions, is documented in the [CHANGELOG](CHANGELOG.md) file - -## Contributing - -First off, thanks for taking the time to contribute! Contributions are what makes the open-source community such an amazing place to learn, inspire, and create. Any contributions you make will benefit everybody else and are **greatly appreciated**. - -Please try to create bug reports that are: - -- _Reproducible._ Include steps to reproduce the problem. -- _Specific._ Include as much detail as possible: which version, what environment, etc. -- _Unique._ Do not duplicate existing opened issues. -- _Scoped to a Single Bug._ One bug per report. - -Please adhere to this project's [code of conduct](.github/CODE_OF_CONDUCT.md). - -You can use [markdownlint-cli](https://github.com/storm-software/acidic/markdownlint-cli) to check for common markdown style inconsistency. - -## Contributors - -Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)): - - - - - - - - - - - - - - - - -
Patrick Sullivan
Patrick Sullivan

๐ŸŽจ ๐Ÿ’ป ๐Ÿ”ง ๐Ÿ“– โš ๏ธ
Tyler Benning
Tyler Benning

๐ŸŽจ
Stormie
Stormie

๐Ÿšง
- all-contributors logo - Add your contributions - -
- - - -This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome! - -
-
-
-Storm Software -
- -
-
-Website | Contact | LinkedIn | Medium | GitHub | OpenPGP Key -
- -
-

Fingerprint: 1BD2 7192 7770 2549 F4C9 F238 E6AD C420 DA5C 4C2D

-
-
- -**Storm Software** is an open source software development organization and creator of Acidic, StormStack and StormCloud. Our mission is to make software development more accessible. Our ideal future is one where anyone can create software without years of prior development experience serving as a barrier to entry. We hope to achieve this via LLMs, Generative AI, and intuitive, high-level data modeling/programming languages. - -If this sounds interesting, and you would like to help us in creating the next generation of development tools, please reach out on our [website](https://stormsoftware.org)! - -

๐Ÿ’ป Visit stormsoftware.org to stay up to date with this developer



- - - - - - diff --git a/packages/vscode-extension/eslint.config.js b/packages/vscode-extension/eslint.config.js deleted file mode 100644 index d7ed4be..0000000 --- a/packages/vscode-extension/eslint.config.js +++ /dev/null @@ -1,40 +0,0 @@ -const { FlatCompat } = require("@eslint/eslintrc"); -const baseConfig = require("../../eslint.config.js"); -const js = require("@eslint/js"); -const compat = new FlatCompat({ - baseDirectory: __dirname, - recommendedConfig: js.configs.recommended -}); -module.exports = [ - ...baseConfig, - { - files: [ - "packages/vscode-extension/**/*.ts", - "packages/vscode-extension/**/*.tsx", - "packages/vscode-extension/**/*.js", - "packages/vscode-extension/**/*.jsx" - ], - rules: {} - }, - { - files: [ - "packages/vscode-extension/**/*.ts", - "packages/vscode-extension/**/*.tsx" - ], - rules: {} - }, - { - files: [ - "packages/vscode-extension/**/*.js", - "packages/vscode-extension/**/*.jsx" - ], - rules: {} - }, - ...compat.config({ parser: "jsonc-eslint-parser" }).map(config => ({ - ...config, - "files": ["packages/vscode-extension/**/*.json"], - "rules": { - "@nx/dependency-checks": "error" - } - })) -]; diff --git a/packages/vscode-extension/jest.config.ts b/packages/vscode-extension/jest.config.ts deleted file mode 100644 index 7bb32a1..0000000 --- a/packages/vscode-extension/jest.config.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { getJestConfig } from "@storm-software/testing-tools"; - -export default getJestConfig( - "packages/vscode-extension", - true, - "vscode-extension" -); diff --git a/packages/vscode-extension/package.json b/packages/vscode-extension/package.json deleted file mode 100644 index 2025da4..0000000 --- a/packages/vscode-extension/package.json +++ /dev/null @@ -1,124 +0,0 @@ -{ - "name": "@acidic/vscode-extension", - "displayName": "Acidic Language Tools", - "version": "0.0.1", - "private": true, - "description": "๐Ÿงช Acidic is a modeling tool that can be used to describe and generate code for API end points, database tables, type definitions, client components, and so much more!", - "categories": [ - "Programming Languages", - "Data Science" - ], - "keywords": [ - "acidic", - "storm", - "stormstack", - "fullstack", - "react", - "typescript", - "data modeling", - "trpc", - "graphql", - "zenstack", - "prisma", - "zod", - "valibot" - ], - "homepage": "https://acidic.io", - "bugs": { - "url": "https://stormsoftware.org/support", - "email": "support@stormsoftware.org" - }, - "repository": { - "type": "github", - "url": "https://github.com/storm-software/acidic.git", - "directory": "packages/vscode-extension" - }, - "license": "Apache License 2.0", - "author": { - "name": "Storm Software", - "email": "contact@stormsoftware.org", - "url": "https://stormsoftware.org" - }, - "publisher": "storm-software", - "main": "./extension/main.js", - "contributes": { - "commands": [ - { - "command": "acidic.restart", - "title": "Acidic Engine: Restart" - }, - { - "command": "acidic.startEngine", - "title": "Acidic Engine: Start" - }, - { - "command": "acidic.stopEngine", - "title": "Acidic Engine: Stop" - } - ], - "grammars": [ - { - "language": "acidic", - "scopeName": "source.acidic", - "path": "./syntaxes/acidic.tmLanguage.json" - } - ], - "languages": [ - { - "id": "acidic", - "aliases": [ - "storm", - "acidic language", - "acidic schema", - "acidic model", - "storm acidic" - ], - "extensions": [ - ".acid", - ".acidic" - ], - "configuration": "./language-configuration.json", - "icon": { - "light": "./assets/light/icon.png", - "dark": "./assets/dark/icon.png" - } - } - ] - }, - "activationEvents": [ - "onLanguage:acidic" - ], - "dependencies": { - "@storm-software/config-tools": "latest", - "@storm-stack/errors": "latest", - "@storm-stack/file-system": "latest", - "@storm-stack/logging": "latest", - "express": "^4.18.2", - "langium": "^1.2.0", - "ts-pattern": "^5.0.5", - "vscode-jsonrpc": "^8.2.0", - "vscode-languageclient": "^9.0.1", - "vscode-languageserver": "^9.0.1", - "vscode-languageserver-textdocument": "^1.0.11", - "vscode-uri": "^3.0.8" - }, - "devDependencies": { - "@storm-software/testing-tools": "latest", - "@storm-software/workspace-tools": "latest", - "@types/node": "20.9.0", - "langium-cli": "^1.2.0" - }, - "engines": { - "vscode": "^1.67.0" - }, - "publishConfig": { - "directory": "dist/packages/vscode-extension", - "linkDirectory": true - }, - "icon": "./assets/light/icon.png", - "galleryBanner": { - "color": "#1E1E1E", - "theme": "dark" - }, - "preview": false -} diff --git a/packages/vscode-extension/project.json b/packages/vscode-extension/project.json deleted file mode 100644 index 9bef3bd..0000000 --- a/packages/vscode-extension/project.json +++ /dev/null @@ -1,116 +0,0 @@ -{ - "name": "vscode-extension", - "$schema": "../../node_modules/nx/schemas/project-schema.json", - "projectType": "library", - "sourceRoot": "packages/vscode-extension/src", - "targets": { - "build": { - "executor": "@nx/esbuild:esbuild", - "outputs": ["{options.outputPath}"], - "options": { - "outputPath": "dist/packages/vscode-extension", - "entry": "packages/vscode-extension/src/extension/main.ts", - "additionalEntryPoints": [ - "packages/vscode-extension/src/language-server/main.ts" - ], - "project": "packages/vscode-extension/package.json", - "tsConfig": "packages/vscode-extension/tsconfig.json", - "external": ["vscode"], - "platform": "node", - "metafile": true, - "bundle": true, - "sourcemap": true, - "minify": false, - "skipTypeCheck": true, - "deleteOutputPath": true, - "assets": [ - { - "input": "packages/vscode-extension", - "glob": "README.md", - "output": "." - }, - { - "input": ".", - "glob": "LICENSE", - "output": "." - }, - { - "input": "packages/vscode-extension/res", - "glob": "*.*", - "output": "res" - }, - { - "input": "assets/icons/light", - "glob": "icon.png", - "output": "assets/light" - }, - { - "input": "assets/icons/dark", - "glob": "icon.png", - "output": "assets/dark" - }, - { - "input": "packages/language/syntaxes", - "glob": "*.*", - "output": "syntaxes" - }, - { - "input": "packages/language", - "glob": "language-configuration.json", - "output": "." - }, - { - "input": "packages/language/examples", - "glob": "*.*", - "output": "examples" - } - ] - } - }, - "pack": { - "executor": "nx:run-commands", - "options": { - "commands": [ - "pnpm nx run vscode-extension:build", - "pnpm pack \"./packages/vscode-extension\" --pack-destination \"./dist/packages/vscode-extension\"" - ], - "parallel": false - } - }, - "publish-dev": { - "executor": "nx:run-commands", - "options": { - "commands": [ - "pnpm nx run vscode-extension:build", - "cd dist/packages/vscode-extension", - "pnpm publish --registry http://localhost:4873" - ], - "parallel": false - } - }, - "publish": { - "executor": "nx:run-commands", - "options": { - "commands": [ - "rimraf /S /Q \"package.json\" ", - "renamer --replace --find \"package.vsce.json\" --replace \"package.json\" *", - "npx vsce package --no-dependencies", - "npx vsce publish --no-dependencies" - ], - "parallel": false, - "cwd": "dist/packages/vscode-extension" - } - }, - "lint": { - "executor": "@nx/eslint:lint", - "outputs": ["{options.outputFile}"], - "options": { - "lintFilePatterns": [ - "packages/vscode-extension/**/*.ts", - "packages/vscode-extension/package.json" - ] - } - }, - "test": {} - } -} diff --git a/packages/vscode-extension/src/config/configuration-store.ts b/packages/vscode-extension/src/config/configuration-store.ts deleted file mode 100644 index 02ec81f..0000000 --- a/packages/vscode-extension/src/config/configuration-store.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { StormLog } from "@storm-stack/logging"; -import { ExtensionContext, Memento } from "vscode"; -import { Store } from "./store"; - -let CONFIG_STORE: ConfigurationStore; - -/** - * Configuration store that has config related to the opened workspace in vscode - */ -export class ConfigurationStore implements Store { - static fromContext( - context: ExtensionContext, - logger: StormLog - ): ConfigurationStore { - CONFIG_STORE = new ConfigurationStore(context.workspaceState); - return CONFIG_STORE; - } - - /** - * Returns the instance of WorkspaceConfigurationStore - */ - static get instance() { - if (!CONFIG_STORE) { - throw Error( - "Please create a configuration store with `fromContext` first" - ); - } - return CONFIG_STORE; - } - - constructor(private readonly state: Memento) {} - - delete(key: string): void { - this.state.update(key, undefined); - } - - get(key: string, defaultValue: T) { - const config = this.state.get(key, defaultValue); - return typeof config === "undefined" ? defaultValue : config; - } - - set(key: string, value: T): void { - this.state.update(key, value); - } -} diff --git a/packages/vscode-extension/src/config/logger.ts b/packages/vscode-extension/src/config/logger.ts deleted file mode 100644 index a3d63e3..0000000 --- a/packages/vscode-extension/src/config/logger.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { OutputChannel, window } from "vscode"; - -export interface Logger { - log(message: string): void; -} - -let _channel: OutputChannel; - -export function getOutputChannel(): OutputChannel { - if (!_channel) { - _channel = window.createOutputChannel("Acidic Workspace"); - } - return _channel; -} - -export const outputLogger: Logger = { - log(message) { - getOutputChannel().appendLine(message); - } -}; diff --git a/packages/vscode-extension/src/config/store.ts b/packages/vscode-extension/src/config/store.ts deleted file mode 100644 index 86aefe0..0000000 --- a/packages/vscode-extension/src/config/store.ts +++ /dev/null @@ -1,7 +0,0 @@ -export interface Store { - get(key: string, defaultValue?: any): any; - - set(key: string, value: any): void; - - delete(key: string): void; -} diff --git a/packages/vscode-extension/src/config/task-execution-messages.ts b/packages/vscode-extension/src/config/task-execution-messages.ts deleted file mode 100644 index 2b4aafb..0000000 --- a/packages/vscode-extension/src/config/task-execution-messages.ts +++ /dev/null @@ -1,95 +0,0 @@ -export interface GlobalConfigurationData { - enableTaskExecutionDryRunOnChange: boolean; -} - -// Task execution output messages -export type TaskExecutionOutputMessage = - | TaskExecutionFormInitOutputMessage - | TaskExecutionRunCommandOutputMessage; - -export enum TaskExecutionOutputMessageType { - TaskExecutionFormInit = "output-init", - RunCommand = "run-command" -} - -export class TaskExecutionRunCommandOutputMessage { - readonly payloadType = TaskExecutionOutputMessageType.RunCommand; - - constructor(public readonly payload: TaskExecutionMessage) {} -} - -export class TaskExecutionFormInitOutputMessage { - readonly payloadType = TaskExecutionOutputMessageType.TaskExecutionFormInit; -} - -// Task execution input messages -export type TaskExecutionInputMessage = - | TaskExecutionSchemaInputMessage - | TaskExecutionGlobalConfigurationInputMessage - | TaskExecutionSetStylesMessage; - -export enum TaskExecutionInputMessageType { - SetTaskExecutionSchema = "generator", - SetGlobalConfiguration = "config", - SetStyles = "style" -} - -export class TaskExecutionSchemaInputMessage { - readonly payloadType = TaskExecutionInputMessageType.SetTaskExecutionSchema; - - constructor(public readonly payload: TaskExecutionSchema) {} -} - -export class TaskExecutionGlobalConfigurationInputMessage { - readonly payloadType = TaskExecutionInputMessageType.SetGlobalConfiguration; - - constructor(public readonly payload: GlobalConfigurationData) {} -} - -export class TaskExecutionSetStylesMessage { - readonly payloadType = TaskExecutionInputMessageType.SetStyles; - - constructor( - public readonly payload: { - backgroundColor: string; - highlightTextColor: string; - secondaryTextColor: string; - fieldBackground: string; - fontFamily: string; - fontSize: string; - } - ) {} -} - -export interface TaskExecutionMessage { - command: string; - positional: string; - flags: string[]; -} - -export interface DefaultValue { - name: string; - defaultValue: string | undefined; -} - -export interface TargetConfiguration { - name: string; - defaultValues: DefaultValue[]; -} - -export interface TaskExecutionSchema { - name: string; - command: string; - collection?: string; - positional: string; - builder?: string; - description: string; - configurations?: TargetConfiguration[]; - options: any[]; - contextValues?: { - path?: string; - directory?: string; - project?: string; - projectName?: string; - }; -} diff --git a/packages/vscode-extension/src/extension/main.ts b/packages/vscode-extension/src/extension/main.ts deleted file mode 100644 index aa3b6f4..0000000 --- a/packages/vscode-extension/src/extension/main.ts +++ /dev/null @@ -1,182 +0,0 @@ -import { createStormConfig } from "@storm-software/config-tools"; -import { getCauseFromUnknown } from "@storm-stack/errors"; -import { StormLog } from "@storm-stack/logging"; -import * as path from "path"; -import { ExtensionContext, WebviewPanel, window, workspace } from "vscode"; -import { - LanguageClient, - LanguageClientOptions, - ServerOptions, - TransportKind -} from "vscode-languageclient/node"; -import { ConfigurationStore } from "../config/configuration-store"; -import { getOutputChannel } from "../config/logger"; - -let client: LanguageClient; - -// This function is called when the extension is activated. -export function activate(context: ExtensionContext): void { - const stormConfig = createStormConfig(); - const logger = StormLog.create(stormConfig, "Acidic Engine"); - - try { - let panel: WebviewPanel | undefined = undefined; - - //const notepadDataProvider = new NotepadDataProvider(notes); - - ConfigurationStore.fromContext(context, logger); - - // Create a tree view to contain the list of schema notes - const treeView = window.createTreeView("acidicWorkspace.schemaList", { - treeDataProvider: {} as any, - showCollapseAll: false - }); - - // Command to render a webview-based note view - /*const openNote = commands.registerCommand( - "acidicWorkspace.showNoteDetailView", - () => { - const selectedTreeViewItem = treeView.selection[0]; - const matchingNote = notes.find( - note => note.id === selectedTreeViewItem.id - ); - if (!matchingNote) { - window.showErrorMessage("No matching note found"); - return; - } - - // If no panel is open, create a new one and update the HTML - if (!panel) { - panel = window.createWebviewPanel( - "noteDetailView", - matchingNote.title, - ViewColumn.One, - { - // Enable JavaScript in the webview - enableScripts: true, - // Restrict the webview to only load resources from the `out` directory - localResourceRoots: [Uri.joinPath(context.extensionUri, "out")] - } - ); - } - - // If a panel is open, update the HTML with the selected item's content - panel.title = matchingNote.title; - panel.webview.html = getWebviewContent( - panel.webview, - context.extensionUri, - matchingNote - ); - - // If a panel is open and receives an update message, update the notes array and the panel title/html - panel.webview.onDidReceiveMessage(message => { - const command = message.command; - const note = message.note; - switch (command) { - case "updateNote": - const updatedNoteId = note.id; - const copyOfNotesArray = [...notes]; - const matchingNoteIndex = copyOfNotesArray.findIndex( - note => note.id === updatedNoteId - ); - copyOfNotesArray[matchingNoteIndex] = note; - notes = copyOfNotesArray; - notepadDataProvider.refresh(notes); - panel - ? ((panel.title = note.title), - (panel.webview.html = getWebviewContent( - panel.webview, - context.extensionUri, - note - ))) - : null; - break; - } - }); - - panel.onDidDispose( - () => { - // When the panel is closed, cancel any future updates to the webview content - panel = undefined; - }, - null, - context.subscriptions - ); - } - );*/ - - client = startLanguageClient(context); - } catch (error) { - logger.error(error); - - window.showErrorMessage( - "Acidic Engine encountered an error when activating (see output panel)" - ); - getOutputChannel().appendLine( - "Acidic Engine encountered an error when activating" - ); - getOutputChannel().appendLine(getCauseFromUnknown(error).stack); - } -} - -// This function is called when the extension is deactivated. -export function deactivate(): Thenable | undefined { - if (client) { - return client.stop(); - } - return undefined; -} - -function startLanguageClient(context: ExtensionContext): LanguageClient { - const serverModule = context.asAbsolutePath( - path.join("out", "language", "main") - ); - // The debug options for the server - // --inspect=6009: runs the server in Node's Inspector mode so VS Code can attach to the server for debugging. - // By setting `process.env.DEBUG_BREAK` to a truthy value, the language server will wait until a debugger is attached. - const debugOptions = { - execArgv: [ - "--nolazy", - `--inspect${process.env.DEBUG_BREAK ? "-brk" : ""}=${ - process.env.DEBUG_SOCKET || "6009" - }` - ] - }; - - // If the extension is launched in debug mode then the debug server options are used - // Otherwise the run options are used - const serverOptions: ServerOptions = { - run: { module: serverModule, transport: TransportKind.ipc }, - debug: { - module: serverModule, - transport: TransportKind.ipc, - options: debugOptions - } - }; - - const fileSystemWatcher = workspace.createFileSystemWatcher( - "**/{*.acid,*.acidic}" - ); - context.subscriptions.push(fileSystemWatcher); - - // Options to control the language client - const clientOptions: LanguageClientOptions = { - documentSelector: [{ scheme: "file", language: "acidic" }], - synchronize: { - // Notify the server about file changes to files contained in the workspace - fileEvents: fileSystemWatcher - } - }; - - // Create the language client and start the client. - const client = new LanguageClient( - "AcidicLanguageClient", - "Acidic Language Client", - serverOptions, - clientOptions - ); - - // Start the client. This will also launch the server - client.start(); - return client; -} diff --git a/packages/vscode-extension/src/extension/refresh-workspace.ts b/packages/vscode-extension/src/extension/refresh-workspace.ts deleted file mode 100644 index 471910f..0000000 --- a/packages/vscode-extension/src/extension/refresh-workspace.ts +++ /dev/null @@ -1,30 +0,0 @@ -//import { WorkspaceRefreshNotification } from "@nx-console/language-server/types"; -import { commands, EventEmitter, ExtensionContext } from "vscode"; -//import { sendNotification } from "./configure-lsp-client"; - -export const REFRESH_WORKSPACE = "acidicWorkspace.refresh"; - -const refreshedEventEmitter = new EventEmitter(); - -export function handleNxlsRefresh() { - refreshedEventEmitter.fire(); -} - -function handleVSCodeRefresh() { - //sendNotification(WorkspaceRefreshNotification); -} - -export function onWorkspaceRefreshed(callback: () => void) { - refreshedEventEmitter.event(callback); -} - -/** - * Refresh workspace by debouncing multiple calls to only trigger once - */ -export function initRefreshWorkspace(context: ExtensionContext) { - context.subscriptions.push( - commands.registerCommand(REFRESH_WORKSPACE, () => { - handleVSCodeRefresh(); - }) - ); -} diff --git a/packages/vscode-extension/src/extension/run-target-tree-item.ts b/packages/vscode-extension/src/extension/run-target-tree-item.ts deleted file mode 100644 index 1713e66..0000000 --- a/packages/vscode-extension/src/extension/run-target-tree-item.ts +++ /dev/null @@ -1,69 +0,0 @@ -import { joinPaths } from "@storm-stack/file-system"; -import { TreeItem, TreeItemCollapsibleState, TreeView, Uri } from "vscode"; - -const LIGHT_SVG_URL = "cli-light.svg"; -const DARK_SVG_URL = "cli-dark.svg"; - -export enum GeneratorType { - Application = "application", - Library = "library", - Other = "other" -} - -export class RunTargetTreeItem extends TreeItem { - revealWorkspaceRoute(currentWorkspace: TreeView) { - (currentWorkspace.visible - ? currentWorkspace.reveal(this, { - select: true, - focus: true - }) - : Promise.reject() - ).then( - () => { - // empty - }, - () => { - // empty - } - ); // Explicitly handle rejection - } - - constructor( - readonly commandString: string, - readonly extensionPath: string, - readonly generatorType?: GeneratorType, - readonly generator?: string - ) { - super(commandString, TreeItemCollapsibleState.None); - this.iconPath = RunTargetTreeItem.getIconUri(this.extensionPath); - this.command = { - title: commandString, - command: - commandString === "generate" - ? "acidic.revealWebViewPanel" - : "acidic.run", - tooltip: "", - arguments: - commandString === "generate" - ? [this] - : commandString === "run" - ? [] - : ["", this.commandString] - }; - - if (commandString === "generate" || commandString === "run") { - this.contextValue = "acidicCommand"; - } else { - this.contextValue = "runTarget"; - } - } - - static getIconUri( - extensionPath: string - ): { light: Uri; dark: Uri } | undefined { - return { - light: Uri.file(joinPaths(extensionPath, "assets", LIGHT_SVG_URL)), - dark: Uri.file(joinPaths(extensionPath, "assets", DARK_SVG_URL)) - }; - } -} diff --git a/packages/vscode-extension/src/index.ts b/packages/vscode-extension/src/index.ts deleted file mode 100644 index a534262..0000000 --- a/packages/vscode-extension/src/index.ts +++ /dev/null @@ -1,10 +0,0 @@ -/** - * The vscode-extension library used by Storm Software for building TypeScript applications. - * - * @remarks - * An extension for Visual Studio Code to provide a great developer experience when working with Acidic models - * - * @packageDocumentation - */ - -const variable = "vscode-extension"; diff --git a/packages/vscode-extension/src/language-server/main.ts b/packages/vscode-extension/src/language-server/main.ts deleted file mode 100644 index f6ecfd3..0000000 --- a/packages/vscode-extension/src/language-server/main.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { createAcidicServices } from "@acidic/language/acidic-module"; -import { startLanguageServer } from "langium"; -import { NodeFileSystem } from "langium/node"; -import { createConnection, ProposedFeatures } from "vscode-languageserver/node"; - -// Create a connection to the client -const connection: any = createConnection(ProposedFeatures.all); - -// Inject the shared services and language-specific services -const { shared } = createAcidicServices({ connection, ...NodeFileSystem }); - -// Start the language server with the shared services -startLanguageServer(shared); diff --git a/packages/vscode-extension/tsconfig.json b/packages/vscode-extension/tsconfig.json deleted file mode 100644 index f51f23c..0000000 --- a/packages/vscode-extension/tsconfig.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "extends": "../../tsconfig.base.json", - "compilerOptions": { - "outDir": "../../dist/out-tsc", - "noEmit": true, - "types": ["node", "vscode", "web-worker"] - }, - "files": [], - "include": ["src/**/*.ts", "src/**/*.js", "bin/**/*"], - "exclude": ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts"] -} diff --git a/packages/vscode-extension/tsconfig.spec.json b/packages/vscode-extension/tsconfig.spec.json deleted file mode 100644 index 56cad6b..0000000 --- a/packages/vscode-extension/tsconfig.spec.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "outDir": "../../dist/out-tsc", - "types": ["jest", "node", "vscode", "web-worker"] - }, - "include": [ - "jest.config.ts", - "src/**/*.test.ts", - "src/**/*.spec.ts", - "src/**/*.d.ts" - ] -}