Skip to content

Commit d608933

Browse files
committed
Add vscode extension
1 parent 672bbcc commit d608933

File tree

7 files changed

+74
-0
lines changed

7 files changed

+74
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Sqlorm intends to provide a solution where SQL stays front and center and where
1818
- Built-in SQL based migration system
1919
- Low coupling between different parts of the library which can be used directly with DBAPI Connections
2020
- Easy to understand code
21+
- VS Code syntax highlighting using [extension](https://marketplace.visualstudio.com/items?itemName=hyperflask.sqlorm-language-support)
2122

2223
[Read the documentation](https://hyperflask.github.io/sqlorm)
2324

docs/index.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,10 @@ with engine as tx:
122122
task.toggle()
123123
```
124124

125+
## Editor support
126+
127+
VS Code syntax highlighting using [extension](https://marketplace.visualstudio.com/items?itemName=hyperflask.sqlorm-language-support)
128+
125129
## Acknowledgements
126130

127131
sqlorm is inspired by the many great ORMs that already exists in Python and other languages.

vscode/.vscode/launch.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// A launch configuration that launches the extension inside a new window
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
{
6+
"version": "0.2.0",
7+
"configurations": [
8+
{
9+
"name": "Extension",
10+
"type": "extensionHost",
11+
"request": "launch",
12+
"args": [
13+
"--extensionDevelopmentPath=${workspaceFolder}"
14+
]
15+
}
16+
]
17+
}

vscode/.vscodeignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.vscode/**
2+
.vscode-test/**
3+
.gitignore
4+
vsc-extension-quickstart.md

vscode/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# sqlorm-syntax-highligting
2+
3+
Highlight SQL statements inside SQLORM sql functions
4+
5+
WARNING: this is a basic extension that highlights docstrings that start with an SQL keyword. works need to be done to make it better

vscode/package.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"name": "sqlorm-language-support",
3+
"displayName": "SQLORM Syntax Highlighting",
4+
"description": "Highlight SQL statements inside Python function docstrings",
5+
"version": "0.0.1",
6+
"engines": {
7+
"vscode": "^1.96.0"
8+
},
9+
"categories": [
10+
"Programming Languages"
11+
],
12+
"contributes": {
13+
"grammars": [{
14+
"path": "./syntaxes/injection.json",
15+
"scopeName": "sql-docstring.injection",
16+
"injectTo": ["source.python"],
17+
"embeddedLanguages": {
18+
"meta.embedded.sql": "sql"
19+
}
20+
}]
21+
}
22+
}

vscode/syntaxes/injection.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"scopeName": "sql-docstring.injection",
3+
"injectionSelector": "L:string.quoted.docstring.multi.python",
4+
"patterns": [
5+
{
6+
"begin": "\\b(SELECT|INSERT|UPDATE|DELETE|CREATE|DROP|ALTER|WITH)\\b",
7+
"end": "(?=\"\"\")|(?=''')",
8+
"beginCaptures": {
9+
"1": {
10+
"name": "keyword.other.sql"
11+
}
12+
},
13+
"contentName": "meta.embedded.sql",
14+
"patterns": [
15+
{
16+
"include": "source.sql"
17+
}
18+
]
19+
}
20+
]
21+
}

0 commit comments

Comments
 (0)