diff --git a/packages/ide/vscode/README.md b/packages/ide/vscode/README.md index 44d12fd1..cf57bcc5 100644 --- a/packages/ide/vscode/README.md +++ b/packages/ide/vscode/README.md @@ -1,48 +1,62 @@ -# ZenStack VS Code Extension +# ZenStack V3 VS Code Extension -[ZenStack](https://zenstack.dev) is a toolkit that simplifies the development of a web app's backend. It enhances [Prisma ORM](https://prisma.io) with flexible Authorization and auto-generated, type-safe APIs/hooks, simplifying full-stack development. +[ZenStack](https://zenstack.dev) is the modern data layer for TypeScript applications. It provides a data modeling language, a type-safe ORM with built-in access control, and other utilities that help you streamline full-stack development. This VS Code extension provides code editing helpers for authoring ZenStack's schema files (`.zmodel` files). -This VS Code extension provides code editing helpers for authoring ZenStack's schema files (.zmodel files). +Use this extension if you are using ZenStack v3.x, otherwise use the [original extension](https://marketplace.visualstudio.com/items?itemName=zenstack.zenstack) that works with v2.x. See [Configuration](#configuration) for how to use both versions side by side. ## Features -- Syntax highlighting of `*.zmodel` files +- Syntax highlighting +- Inline error reporting +- Go-to definition +- Hover documentation +- Code section folding - - In case the schema file is not recognized automatically, add the following to your settings.json file: +## Configuration - ```json - "files.associations": { - "*.zmodel": "zmodel" - }, - ``` +### Side by side with the original ZenStack extension -- Auto formatting +If you have the [original ZenStack v2 extension](https://marketplace.visualstudio.com/items?itemName=zenstack.zenstack) installed, it may compete with this extension on handling `.zmodel` files. In this case, add the following settings to your `.vscode/settings.json` file to specify which extension should handle `.zmodel` files. - - To automatically format on save, add the following to your settings.json file: +To let this extension handle `.zmodel` files, add: - ```json - "editor.formatOnSave": true - ``` +```json +"files.associations": { + "*.zmodel": "zmodel-v3" +}, +``` - - To enable formatting in combination with prettier, add the following to your settings.json file: - ```json - "[zmodel]": { - "editor.defaultFormatter": "zenstack.zenstack" - }, - ``` +To let the v2 extension handle `.zmodel` files, add: -- Inline error reporting -- Go-to definition -- Hover documentation -- Code section folding +```json +"files.associations": { + "*.zmodel": "zmodel" +}, +``` + +### Auto formatting + +To automatically format on save, add the following to your `.vscode/settings.json` file: + +```json +"editor.formatOnSave": true +``` + +To enable formatting in combination with prettier, add the following to your `.vscode/settings.json` file: + +```json +"[zmodel-v3]": { + "editor.defaultFormatter": "zenstack.zenstack-v3" +}, +``` ## Links -- [Home](https://zenstack.dev) -- [Documentation](https://zenstack.dev/docs) +- [Home](https://zenstack.dev/v3) +- [Documentation](https://zenstack.dev/docs/3.x) - [Community chat](https://discord.gg/Ykhr738dUe) - [Twitter](https://twitter.com/zenstackhq) -- [Blog](https://dev.to/zenstack) +- [Blog](https://zenstack.dev/blog) ## Community diff --git a/packages/ide/vscode/package.json b/packages/ide/vscode/package.json index 8b183adc..e580f9f9 100644 --- a/packages/ide/vscode/package.json +++ b/packages/ide/vscode/package.json @@ -1,9 +1,9 @@ { - "name": "zenstack", + "name": "zenstack-v3", "publisher": "zenstack", - "version": "3.0.0-alpha.33", - "displayName": "ZenStack Language Tools", - "description": "VSCode extension for ZenStack ZModel language", + "version": "3.0.2", + "displayName": "ZenStack V3 Language Tools", + "description": "VSCode extension for ZenStack (v3) ZModel language", "private": true, "repository": { "type": "git", @@ -12,7 +12,7 @@ "scripts": { "build": "tsc --noEmit && tsup", "lint": "eslint src --ext ts", - "vscode:publish": "pnpm build && vsce publish --no-dependencies --pre-release --follow-symlinks", + "vscode:publish": "pnpm build && vsce publish --no-dependencies --follow-symlinks", "vscode:package": "pnpm build && vsce package --no-dependencies" }, "homepage": "https://zenstack.dev", @@ -49,7 +49,7 @@ ], "engines": { "vscode": "^1.63.0", - "node": ">=18.0.0" + "node": ">=20.0.0" }, "categories": [ "Programming Languages" @@ -57,7 +57,7 @@ "contributes": { "languages": [ { - "id": "zmodel", + "id": "zmodel-v3", "aliases": [ "ZenStack Model", "zmodel" @@ -74,14 +74,14 @@ ], "grammars": [ { - "language": "zmodel", + "language": "zmodel-v3", "scopeName": "source.zmodel", "path": "./syntaxes/zmodel.tmLanguage.json" } ] }, "activationEvents": [ - "onLanguage:zmodel" + "onLanguage:zmodel-v3" ], "main": "./dist/extension.js" } diff --git a/packages/ide/vscode/src/extension/main.ts b/packages/ide/vscode/src/extension/main.ts index fed30b20..a7fab381 100644 --- a/packages/ide/vscode/src/extension/main.ts +++ b/packages/ide/vscode/src/extension/main.ts @@ -43,11 +43,11 @@ function startLanguageClient(context: vscode.ExtensionContext): LanguageClient { // Options to control the language client const clientOptions: LanguageClientOptions = { - documentSelector: [{ scheme: '*', language: 'zmodel' }], + documentSelector: [{ language: 'zmodel-v3' }], }; // Create the language client and start the client. - const client = new LanguageClient('zmodel', 'ZModel', serverOptions, clientOptions); + const client = new LanguageClient('zmodel-v3', 'ZenStack Model V3', serverOptions, clientOptions); // Start the client. This will also launch the server client.start(); diff --git a/packages/language/src/generated/module.ts b/packages/language/src/generated/module.ts index 58849979..0c621d00 100644 --- a/packages/language/src/generated/module.ts +++ b/packages/language/src/generated/module.ts @@ -8,7 +8,7 @@ import { ZModelAstReflection } from './ast.js'; import { ZModelGrammar } from './grammar.js'; export const ZModelLanguageMetaData = { - languageId: 'zmodel', + languageId: 'zmodel-v3', fileExtensions: ['.zmodel'], caseInsensitive: false, mode: 'development' diff --git a/scripts/bump-version.ts b/scripts/bump-version.ts index ff4d353f..53057d4a 100644 --- a/scripts/bump-version.ts +++ b/scripts/bump-version.ts @@ -3,6 +3,8 @@ import { glob } from 'glob'; import * as path from 'node:path'; import * as yaml from 'yaml'; +const excludes = ['packages/ide/vscode/package.json']; + function getWorkspacePackageJsonFiles(workspaceFile: string): string[] { const workspaceYaml = fs.readFileSync(workspaceFile, 'utf8'); const workspace = yaml.parse(workspaceYaml) as { packages?: string[] }; @@ -23,7 +25,8 @@ function getWorkspacePackageJsonFiles(workspaceFile: string): string[] { // include root package.json files.add(path.resolve(__dirname, '../package.json')); - return Array.from(files); + const result = Array.from(files).filter((f) => !excludes.some((e) => f.endsWith(e))); + return result; } function incrementVersion(version: string): string {