-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create VS Code extension for AML (#333)
- Loading branch information
1 parent
e0806e0
commit afec779
Showing
87 changed files
with
7,334 additions
and
329 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,3 +35,4 @@ npm-debug.log | |
/priv/static/swagger*.json | ||
/assets/js/*.js | ||
/uploads | ||
/.vscode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
backend/lib/azimutt_web/templates/website/docs/getting-started.html.heex
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,9 @@ | ||
<%= render "docs/_header.html", conn: @conn, page: @page %> | ||
|
||
<%= doc_prose do %> | ||
<p class="lead"> | ||
Now let's dig into the main Azimutt topics. | ||
</p> | ||
<% end %> | ||
|
||
<%= render "docs/_footer.html", conn: @conn, page: @page, prev: @prev, next: @next %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
dist | ||
node_modules | ||
*.vsix |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
enable-pre-post-scripts = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
// See http://go.microsoft.com/fwlink/?LinkId=827846 | ||
// for the documentation about the extensions.json format | ||
"recommendations": [ | ||
"dbaeumer.vscode-eslint", | ||
"connor4312.esbuild-problem-matchers", | ||
"ms-vscode.extension-test-runner" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// 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": "extensionHost", | ||
"debugWebWorkerHost": true, | ||
"request": "launch", | ||
"args": [ | ||
"--extensionDevelopmentPath=${workspaceFolder}", | ||
"--extensionDevelopmentKind=web" | ||
], | ||
"outFiles": [ | ||
"${workspaceFolder}/dist/web/**/*.js" | ||
], | ||
"preLaunchTask": "${defaultBuildTask}" | ||
}, | ||
{ | ||
"name": "Extension Tests", | ||
"type": "extensionHost", | ||
"debugWebWorkerHost": true, | ||
"request": "launch", | ||
"args": [ | ||
"--extensionDevelopmentPath=${workspaceFolder}", | ||
"--extensionDevelopmentKind=web", | ||
"--extensionTestsPath=${workspaceFolder}/dist/web/test/suite/extensionTests" | ||
], | ||
"outFiles": [ | ||
"${workspaceFolder}/dist/web/**/*.js" | ||
], | ||
"preLaunchTask": "${defaultBuildTask}" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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": { | ||
"dist": false // set this to true to hide the "dist" folder with the compiled JS files | ||
}, | ||
"search.exclude": { | ||
"dist": true // set this to false to include "dist" folder in search results | ||
}, | ||
// Turn off tsc task auto detection since we have the necessary tasks as npm scripts | ||
"typescript.tsc.autoDetect": "off" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// See https://go.microsoft.com/fwlink/?LinkId=733558 | ||
// for the documentation about the tasks.json format | ||
{ | ||
"version": "2.0.0", | ||
"tasks": [ | ||
{ | ||
"label": "watch-web", | ||
"dependsOn": [ | ||
"npm: watch-web:tsc", | ||
"npm: watch-web:esbuild" | ||
], | ||
"presentation": { | ||
"reveal": "never" | ||
}, | ||
"group": { | ||
"kind": "build", | ||
"isDefault": true | ||
} | ||
}, | ||
{ | ||
"type": "npm", | ||
"script": "watch-web:esbuild", | ||
"group": "build", | ||
"problemMatcher": "$esbuild-watch", | ||
"isBackground": true, | ||
"label": "npm: watch-web:esbuild", | ||
"presentation": { | ||
"group": "watch", | ||
"reveal": "never" | ||
} | ||
}, | ||
{ | ||
"type": "npm", | ||
"script": "watch-web:tsc", | ||
"group": "build", | ||
"problemMatcher": "$tsc-watch", | ||
"isBackground": true, | ||
"label": "npm: watch-web:tsc", | ||
"presentation": { | ||
"group": "watch", | ||
"reveal": "never" | ||
} | ||
}, | ||
{ | ||
"label": "compile", | ||
"type": "npm", | ||
"script": "compile-web", | ||
"problemMatcher": [ | ||
"$tsc", | ||
"$esbuild" | ||
] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
.vscode/** | ||
.vscode-test-web/** | ||
resources/** | ||
src/** | ||
out/** | ||
node_modules/** | ||
dist/test/** | ||
.gitignore | ||
vsc-extension-quickstart.md | ||
webpack.config.js | ||
esbuild.js | ||
.yarnrc | ||
**/tsconfig.json | ||
**/eslint.config.mjs | ||
**/*.map | ||
**/*.ts | ||
**/.vscode-test.* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Change Log | ||
|
||
All notable changes to the "vscode-aml" extension will be documented in this file. | ||
|
||
Check [Keep a Changelog](http://keepachangelog.com) for recommendations on how to structure this file. | ||
|
||
## [Unreleased] | ||
|
||
|
||
## 0.1.0 | ||
|
||
### Added | ||
|
||
- AML syntax highlighting | ||
- AML suggestions via snippets | ||
- AML symbol navigation | ||
- Create AML file with sample content |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
# AML Support for VS Code | ||
|
||
[![VS Code Marketplace](https://img.shields.io/vscode-marketplace/v/azimutt.vscode-aml.svg?label=vscode%20marketplace&style=flat-square&color=007ec6)](https://marketplace.visualstudio.com/items?itemName=azimutt.vscode-aml) | ||
[![Star Azimutt on GitHub](https://img.shields.io/github/stars/azimuttapp/azimutt)](https://github.com/azimuttapp/azimutt) | ||
[![Follow @azimuttapp on Twitter](https://img.shields.io/twitter/follow/azimuttapp.svg?style=social)](https://twitter.com/intent/follow?screen_name=azimuttapp) | ||
|
||
A VS Code extension to design database schemas with [AML](https://azimutt.app/aml), a simple DSL that speed your design by 2x ✨ | ||
|
||
![AML in VS Code](https://raw.githubusercontent.com/azimuttapp/azimutt/refs/heads/main/extensions/vscode-aml/assets/screenshot.png) | ||
|
||
## Features | ||
|
||
- Syntax highlight and suggestions for AML code (`.aml` files) | ||
- Symbol navigation in AML | ||
|
||
|
||
## Usage | ||
|
||
1. Create an empty `.aml` file or use `AML: New database schema (ERD)` command | ||
2. Write your schema using AML, check [documentation](https://azimutt.app/docs/aml) is needed | ||
|
||
Here is how AML looks like: | ||
|
||
```aml | ||
users | ||
id uuid pk | ||
name varchar index | ||
email varchar unique | ||
role user_role(admin, guest)=guest | ||
posts | store all posts | ||
id uuid pk | ||
title varchar | ||
content text | allow markdown formatting | ||
author uuid -> users(id) # inline relation | ||
created_at timestamp=`now()` | ||
``` | ||
|
||
## Roadmap | ||
|
||
- diagram preview + open in Azimutt | ||
- convert AML to PostgreSQL, JSON, DOT, Mermaid, Markdown (Command Palette) | ||
- convert SQL and JSON to AML (Command Palette) | ||
- Add parsing errors ([createDiagnosticCollection](https://code.visualstudio.com/api/references/vscode-api#languages.createDiagnosticCollection)?) | ||
- auto-complete (cf [registerCompletionItemProvider](https://microsoft.github.io/monaco-editor/typedoc/functions/languages.registerCompletionItemProvider.html)) | ||
- rename (cf [registerRenameProvider](https://microsoft.github.io/monaco-editor/typedoc/functions/languages.registerRenameProvider.html)) | ||
- hover infos (cf [registerHoverProvider](https://microsoft.github.io/monaco-editor/typedoc/functions/languages.registerHoverProvider.html)) | ||
- go-to-definition (cf [registerDefinitionProvider](https://microsoft.github.io/monaco-editor/typedoc/functions/languages.registerDefinitionProvider.html) and [registerImplementationProvider](https://microsoft.github.io/monaco-editor/typedoc/functions/languages.registerImplementationProvider.html)) | ||
- quick-fixes (cf [registerCodeActionProvider](https://microsoft.github.io/monaco-editor/typedoc/functions/languages.registerCodeActionProvider.html)) | ||
- hints with actions (cf [registerCodeLensProvider](https://microsoft.github.io/monaco-editor/typedoc/functions/languages.registerCodeLensProvider.html)) | ||
- AML support in Markdown | ||
- Connect to a database | ||
|
||
|
||
## Issues & Contributing | ||
|
||
If you have any issue or bug, please [create an issue](https://github.com/azimuttapp/azimutt/issues). | ||
|
||
If you want to improve this extension, feel free to reach out or submit a pull request. | ||
|
||
|
||
## Development | ||
|
||
VS Code language extensions are made of several and quite independent part. | ||
For general knowledge, look at the [extension documentation](https://code.visualstudio.com/api) and more specifically the [language extension overview](https://code.visualstudio.com/api/language-extensions/overview). | ||
|
||
Here are the different parts of this extension: | ||
|
||
- [language-configuration.json](language-configuration.json) for language behavior like brackets, comments and folding (cf [doc](https://code.visualstudio.com/api/language-extensions/language-configuration-guide)) | ||
- [syntaxes/aml.tmLanguage.json](syntaxes/aml.tmLanguage.json) for basic syntax highlighting (cf [doc](https://code.visualstudio.com/api/language-extensions/syntax-highlight-guide)) and, later, [Semantic Highlighting](https://code.visualstudio.com/api/language-extensions/semantic-highlight-guide) in [src/web/extension.ts](src/web/extension.ts) | ||
- [snippets.json](snippets.json) for basic language suggestions (cf [extension doc](https://code.visualstudio.com/api/language-extensions/snippet-guide) and [snippet doc](https://code.visualstudio.com/docs/editor/userdefinedsnippets)) | ||
- [package.json](package.json) and [src/web/extension.ts](src/web/extension.ts) for defining commands and more advanced behaviors | ||
- [AmlDocumentSymbolProvider](src/web/extension.ts) for symbol detection | ||
- [previewAml](src/web/extension.ts) for AML preview | ||
|
||
Tips: | ||
|
||
- Debug extension via F5 (Run Web Extension) | ||
- Relaunch the extension from the debug toolbar after changing code in `src/web/extension.ts` | ||
- Reload (`Ctrl+R` or `Cmd+R` on Mac) the VS Code window with your extension to load your changes | ||
|
||
## Publication | ||
|
||
[Publish your extension](https://code.visualstudio.com/api/working-with-extensions/publishing-extension) on the VS Code extension marketplace. | ||
|
||
- Get Personal Access Token from [azimutt](https://dev.azure.com/azimutt) | ||
- Manage extension from the [marketplace](https://marketplace.visualstudio.com/manage/publishers/azimutt) | ||
- package the extension: `vsce package` | ||
- publish the extension: `vsce publish` | ||
- if needed, install vsce: `npm install -g @vscode/vsce` |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.