Skip to content

Commit 0337147

Browse files
authored
chore: separate extension and language id for vscode extension (#217)
* chore: separate extension and language id for vscode extension * update * update * update
1 parent 31873bf commit 0337147

File tree

5 files changed

+58
-41
lines changed

5 files changed

+58
-41
lines changed

packages/ide/vscode/README.md

Lines changed: 42 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,62 @@
1-
# ZenStack VS Code Extension
1+
# ZenStack V3 VS Code Extension
22

3-
[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.
3+
[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).
44

5-
This VS Code extension provides code editing helpers for authoring ZenStack's schema files (.zmodel files).
5+
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.
66

77
## Features
88

9-
- Syntax highlighting of `*.zmodel` files
9+
- Syntax highlighting
10+
- Inline error reporting
11+
- Go-to definition
12+
- Hover documentation
13+
- Code section folding
1014

11-
- In case the schema file is not recognized automatically, add the following to your settings.json file:
15+
## Configuration
1216

13-
```json
14-
"files.associations": {
15-
"*.zmodel": "zmodel"
16-
},
17-
```
17+
### Side by side with the original ZenStack extension
1818

19-
- Auto formatting
19+
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.
2020

21-
- To automatically format on save, add the following to your settings.json file:
21+
To let this extension handle `.zmodel` files, add:
2222

23-
```json
24-
"editor.formatOnSave": true
25-
```
23+
```json
24+
"files.associations": {
25+
"*.zmodel": "zmodel-v3"
26+
},
27+
```
2628

27-
- To enable formatting in combination with prettier, add the following to your settings.json file:
28-
```json
29-
"[zmodel]": {
30-
"editor.defaultFormatter": "zenstack.zenstack"
31-
},
32-
```
29+
To let the v2 extension handle `.zmodel` files, add:
3330

34-
- Inline error reporting
35-
- Go-to definition
36-
- Hover documentation
37-
- Code section folding
31+
```json
32+
"files.associations": {
33+
"*.zmodel": "zmodel"
34+
},
35+
```
36+
37+
### Auto formatting
38+
39+
To automatically format on save, add the following to your `.vscode/settings.json` file:
40+
41+
```json
42+
"editor.formatOnSave": true
43+
```
44+
45+
To enable formatting in combination with prettier, add the following to your `.vscode/settings.json` file:
46+
47+
```json
48+
"[zmodel-v3]": {
49+
"editor.defaultFormatter": "zenstack.zenstack-v3"
50+
},
51+
```
3852

3953
## Links
4054

41-
- [Home](https://zenstack.dev)
42-
- [Documentation](https://zenstack.dev/docs)
55+
- [Home](https://zenstack.dev/v3)
56+
- [Documentation](https://zenstack.dev/docs/3.x)
4357
- [Community chat](https://discord.gg/Ykhr738dUe)
4458
- [Twitter](https://twitter.com/zenstackhq)
45-
- [Blog](https://dev.to/zenstack)
59+
- [Blog](https://zenstack.dev/blog)
4660

4761
## Community
4862

packages/ide/vscode/package.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
2-
"name": "zenstack",
2+
"name": "zenstack-v3",
33
"publisher": "zenstack",
4-
"version": "3.0.0-alpha.33",
5-
"displayName": "ZenStack Language Tools",
6-
"description": "VSCode extension for ZenStack ZModel language",
4+
"version": "3.0.2",
5+
"displayName": "ZenStack V3 Language Tools",
6+
"description": "VSCode extension for ZenStack (v3) ZModel language",
77
"private": true,
88
"repository": {
99
"type": "git",
@@ -12,7 +12,7 @@
1212
"scripts": {
1313
"build": "tsc --noEmit && tsup",
1414
"lint": "eslint src --ext ts",
15-
"vscode:publish": "pnpm build && vsce publish --no-dependencies --pre-release --follow-symlinks",
15+
"vscode:publish": "pnpm build && vsce publish --no-dependencies --follow-symlinks",
1616
"vscode:package": "pnpm build && vsce package --no-dependencies"
1717
},
1818
"homepage": "https://zenstack.dev",
@@ -49,15 +49,15 @@
4949
],
5050
"engines": {
5151
"vscode": "^1.63.0",
52-
"node": ">=18.0.0"
52+
"node": ">=20.0.0"
5353
},
5454
"categories": [
5555
"Programming Languages"
5656
],
5757
"contributes": {
5858
"languages": [
5959
{
60-
"id": "zmodel",
60+
"id": "zmodel-v3",
6161
"aliases": [
6262
"ZenStack Model",
6363
"zmodel"
@@ -74,14 +74,14 @@
7474
],
7575
"grammars": [
7676
{
77-
"language": "zmodel",
77+
"language": "zmodel-v3",
7878
"scopeName": "source.zmodel",
7979
"path": "./syntaxes/zmodel.tmLanguage.json"
8080
}
8181
]
8282
},
8383
"activationEvents": [
84-
"onLanguage:zmodel"
84+
"onLanguage:zmodel-v3"
8585
],
8686
"main": "./dist/extension.js"
8787
}

packages/ide/vscode/src/extension/main.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ function startLanguageClient(context: vscode.ExtensionContext): LanguageClient {
4343

4444
// Options to control the language client
4545
const clientOptions: LanguageClientOptions = {
46-
documentSelector: [{ scheme: '*', language: 'zmodel' }],
46+
documentSelector: [{ language: 'zmodel-v3' }],
4747
};
4848

4949
// Create the language client and start the client.
50-
const client = new LanguageClient('zmodel', 'ZModel', serverOptions, clientOptions);
50+
const client = new LanguageClient('zmodel-v3', 'ZenStack Model V3', serverOptions, clientOptions);
5151

5252
// Start the client. This will also launch the server
5353
client.start();

packages/language/src/generated/module.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { ZModelAstReflection } from './ast.js';
88
import { ZModelGrammar } from './grammar.js';
99

1010
export const ZModelLanguageMetaData = {
11-
languageId: 'zmodel',
11+
languageId: 'zmodel-v3',
1212
fileExtensions: ['.zmodel'],
1313
caseInsensitive: false,
1414
mode: 'development'

scripts/bump-version.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import { glob } from 'glob';
33
import * as path from 'node:path';
44
import * as yaml from 'yaml';
55

6+
const excludes = ['packages/ide/vscode/package.json'];
7+
68
function getWorkspacePackageJsonFiles(workspaceFile: string): string[] {
79
const workspaceYaml = fs.readFileSync(workspaceFile, 'utf8');
810
const workspace = yaml.parse(workspaceYaml) as { packages?: string[] };
@@ -23,7 +25,8 @@ function getWorkspacePackageJsonFiles(workspaceFile: string): string[] {
2325
// include root package.json
2426
files.add(path.resolve(__dirname, '../package.json'));
2527

26-
return Array.from(files);
28+
const result = Array.from(files).filter((f) => !excludes.some((e) => f.endsWith(e)));
29+
return result;
2730
}
2831

2932
function incrementVersion(version: string): string {

0 commit comments

Comments
 (0)