Skip to content

Commit c98ce91

Browse files
committed
mass updates before release
1 parent 0935fa4 commit c98ce91

14 files changed

+267
-99
lines changed

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,7 @@
1+
out
12
node_modules
3+
.vscode-test/
4+
*.vsix
5+
releases/
6+
.DS_Store
7+
.vscode/settings.json

CHANGELOG.md

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
1-
# Changelog
2-
All notable changes to this project will be documented in this file.
1+
# Change Log
32

4-
The format is based on [Keep a Changelog] (http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
3+
All notable changes to the "highlight-string-code" extension will be documented in this file.
54

6-
### [1.1.0] - 2019-06-04
7-
- Added support for f-strings
5+
Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file.
86

9-
### [1.0.0] - 2019-03-29
10-
- Added snippet and keybinding
11-
12-
### [0.1.0] - 2019-03-28
13-
- Published on VS Code marketplace
14-
15-
## [0.0.1] - 2018-03-28
16-
### Added
17-
- First working version
7+
## [Unreleased]
8+
- Keep variables highlighter between `{` and `}` in string code.
9+
- Add usages
10+
- Add HTML highlighter
11+
- Add SQL highlighter
12+
- Initial
13+
- Forked from [ptweir/python-string-sql](https://github.com/ptweir/python-string-sql)

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2018 ptweir
3+
Copyright (c) 2018
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 31 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,45 @@
1-
# SQL highlighting in Python multiline strings for VS Code
1+
# Highlight String Code
22

3-
Adds syntax highlight support for python multiline SQL strings in VS Code.
3+
Syntax highlighting support for some specific language code in string.
44

5-
## Installation
6-
7-
Install `python-string-sql` from extensions (`ctrl + shift + x` or `cmd + shift + x` on mac).
8-
> Also available on [marketplace.visualstudio.com](https://marketplace.visualstudio.com/items?itemName=ptweir.python-string-sql)
9-
10-
## Example
11-
12-
[![Example](docs/demo.png)](docs/demo.py)
13-
14-
## Usage
15-
16-
Insert `--sql`, `--beginsql`, or `--begin-sql` at the beginning of the part of the string you would like highlighted and a semicolon, `--endsql`, or `--end-sql` at the end of the highlighted section.
5+
## Requirements
176

18-
### Snippets
19-
begin typing `sql` and the autocomplete snippet will appear:
7+
- Visual Studio Code v1.32.0 and above is recommended
208

21-
![Snippet](docs/snippet.gif)
9+
## Installation
2210

23-
### Keybindings
11+
- Install from [VSIX](https://github.com/iuyoy/highlight-string-code/releases) manually.
2412

25-
cmd+s (or ctrl+s on mac) - Insert the following snippet:
26-
```
27-
"""
28-
--sql
29-
SELECT
30-
;
31-
"""
32-
```
13+
## Features & Usages
3314

34-
## Requirements
15+
- SQL
16+
1. Insert sign pair `--sql` and `;` to highlight one SQL sequence.
17+
![single SQL stirng with Sign](./docs/single_SQL_with_Sign.png)
18+
2. Insert sign pair `--beginsql` or `--begin-sql` and `--endsql` or `--end-sql` to highlight one and more SQL suquences.
19+
![multi SQL stirng with Sign](./docs/multi_SQL_with_Sign.png)
20+
3. Any SQL sequence starts with **UPPERCASE** keyword (such as `SELECT`, `INSERT`, `UPDATE` and etc), and ends with `;` will be highlighted automatically.
21+
![SQL stirng no Sign](./docs/SQL_without_Sign.png)
22+
- HTML
23+
- Insert sign pair `<!--html-->` and `<!--!html-->` to highlight one and more HTML suquences. Other comments can be added after `html` and `-->`.
24+
![HTML with Sign](./docs/HTML_with_Sign.png)
25+
- Other
26+
- Highlight Variables in *highlighted* string code.
27+
![Variables](./docs/SQL_with_variable.png)
3528

36-
- Visual Studio Code v1.32.0 recommended
37-
- Comments at beginning and end of highlighted section in the string (see Usage section).
29+
## TODO Notes
3830

39-
## Community
40-
- 2018-09-04 forked from [es6-string-css](https://github.com/bashmish/es6-string-css)
31+
- [ ] Publish extension
32+
- [ ] Add switches for Highlight Signs
4133

4234
## Release Notes
4335

44-
### [1.1.0] - 2019-06-04
45-
- Added support for f-strings
46-
47-
### [1.0.0] - 2019-03-29
48-
- Added snippet and keybinding
49-
50-
### [0.1.0] - 2019-03-28
51-
- Published on VS Code marketplace
52-
53-
### [0.0.1] - 2019-03-28
54-
- Got it working based on [these instructions](https://code.visualstudio.com/api/language-extensions/syntax-highlight-guide)
36+
See [CHANGELOG.md](./CHANGELOG.md)
5537

56-
### [0.0.0] - 2018-09-04
57-
- Forked from es6-string-html
38+
## References
5839

40+
- Forked from [bashmish/es6-string-css](https://github.com/bashmish/es6-string-css) > [ptweir/python-string-sql](https://github.com/ptweir/python-string-sql)
41+
- Visual Studio Code Extension API
42+
- [syntax-highlight-guide](https://code.visualstudio.com/api/language-extensions/syntax-highlight-guide)
43+
- TextMate Manual
44+
- [Language Grammars](https://macromates.com/manual/en/language_grammars)
45+
- [Scope Selectors](https://macromates.com/manual/en/scope_selectors)

docs/HTML_with_Sign.png

23 KB
Loading

docs/SQL_with_variable.png

21.8 KB
Loading

docs/SQL_without_Sign.png

42 KB
Loading

docs/demo.py

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
single_SQL_with_Sign = """
2+
--sql Highlight
3+
select `last_name`, start_day, COUNT(*) AS num_entries
4+
FROM schema_name.table_name
5+
WHERE start_day >= '2019-01-01'
6+
GROUP BY last_name, start_day
7+
ORDER BY num_entries DESC
8+
LIMIT 10;
9+
-- Not Highlight
10+
select column_name from schema_name.table_name;
11+
"""
12+
13+
multi_SQL_with_Sign = '''
14+
--beginsql Highlight
15+
drop TABLE schema_name.table_name;
16+
insert INTO schema_name.table_name(id, grade) VALUES(1, 100);
17+
select `last_name`, start_day FROM schema_name.table_name;
18+
--endsql
19+
-- Not Highlight
20+
drop TABLE schema_name.table_name;
21+
insert INTO schema_name.table_name(id, grade) VALUES(1, 100);
22+
'''
23+
24+
SQL_without_Sign = """
25+
-- Highlight
26+
DROP TABLE schema_name.table_name;
27+
INSERT INTO schema_name.table_name(id, grade) VALUES(1, 100);
28+
SELECT `last_name`, start_day
29+
FROM (SELECT * from schema_name.table_name) tmp;
30+
-- Not Highlight
31+
drop TABLE schema_name.table_name;
32+
insert INTO schema_name.table_name(id, grade) VALUES(1, 100);
33+
select column_name from schema_name.table_name;
34+
"""
35+
36+
#
37+
# --beginsql
38+
# DROP TABLE schema_name.table_name;
39+
# INSERT INTO schema_name.table_name(id, grade) VALUES(1, 100);
40+
# SELECT `last_name`, start_day
41+
# FROM schema_name.table_name
42+
# ;
43+
# --endsql
44+
#
45+
46+
sql = 'SELECT * FROM schema_name.table_name;'
47+
48+
HTML = """
49+
<!--html-->
50+
<h1>I am a lighlighted html</h1>
51+
hello
52+
<p>world</p>
53+
<!--!html-->
54+
<!--htmlcomment-->
55+
<h1>I am also a lighlighted html</h1>
56+
<!--!htmlcomment-->
57+
<h1>I amd not a lighlighted html</h1>
58+
"""
59+
60+
# ANCHOR variable test
61+
SQL_with_Variable = """
62+
SELECT
63+
`name`, birth
64+
FROM
65+
users
66+
WHERE birth > '{date}'
67+
AND `name` != '{banned}man'
68+
;
69+
""".format(banned='bat', date='2019-09-26')
70+

docs/multi_SQL_with_Sign.png

40.1 KB
Loading

docs/single_SQL_with_Sign.png

31.6 KB
Loading

0 commit comments

Comments
 (0)