Skip to content

Commit 463f3f5

Browse files
committed
[Enhancement] Support automatic prompt function of code editor
1 parent 9ed3c39 commit 463f3f5

7 files changed

Lines changed: 34 additions & 0 deletions

File tree

44.7 KB
Loading

docs/docs/development/version/1.16.0-development.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ DBM Version for `1.16.0` is development!
2222
![img.png](../../assets/images/versions/1.16.0/img_7.png) <br />
2323
![img.png](../../assets/images/versions/1.16.0/img_8.png) <br />
2424
![img.png](../../assets/images/versions/1.16.0/img_9.png) <br />
25+
- Support automatic prompt function of code editor <br />
26+
![img.png](../../assets/images/versions/1.16.0/img_10.png) <br />
2527

2628
#### UI
2729

electron-builder.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ releaseInfo:
1313
- SSH login is supported #40
1414
- Support query ClickHouse to dynamically add configuration
1515
- Support metadata management to filter the database
16+
- Support automatic prompt function of code editor
1617
1718
#### Docs
1819

src/renderer/app/pages/query/query/query.component.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@ export class QueryComponent extends BaseComponent implements AfterViewInit {
8686
setTimeout(() => {
8787
const codeMirror = this.codeEditors.get(this.containerSelected)['codeMirror'];
8888
// const queryInstance = this;
89+
codeMirror.on('inputRead', () => {
90+
codeMirror.showHint();
91+
})
8992
codeMirror.addKeyMap({
9093
'Ctrl-Enter': function(cm) {
9194
// queryInstance.handlerExecute(null);

src/renderer/editor.hints.css

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
.CodeMirror-hints {
2+
position: absolute;
3+
z-index: 10;
4+
overflow: hidden;
5+
list-style: none;
6+
7+
margin: 0;
8+
padding: 2px;
9+
10+
-webkit-box-shadow: 2px 3px 5px rgba(0, 0, 0, .2);
11+
-moz-box-shadow: 2px 3px 5px rgba(0, 0, 0, .2);
12+
box-shadow: 2px 3px 5px rgba(0, 0, 0, .2);
13+
border-radius: 3px;
14+
border: 1px solid silver;
15+
16+
background: white;
17+
font-size: 90%;
18+
font-family: monospace;
19+
20+
max-height: 20em;
21+
overflow-y: auto;
22+
}

src/renderer/editor.theme.scss

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,6 @@
3737
@import "~codemirror/theme/monokai.css";
3838
@import "~codemirror/theme/moxer.css";
3939
//@import "~codemirror/theme/";
40+
41+
// Wait for all themes to load after loading, load the hint style to prevent style confusion
42+
@import './editor.hints.css';

src/renderer/services/editor/editor.service.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ export class EditorService extends PersistenceService implements BaseService {
1818
lineWrapping: true,
1919
styleActiveLine: true,
2020
foldGutter: true,
21+
hintOptions: {
22+
completeSingle: false
23+
},
2124
lineComment: ['\/\/'],
2225
keyMap: 'sublime',
2326
gutters: ['CodeMirror-linenumbers', 'CodeMirror-foldgutter', 'CodeMirror-lint-markers']

0 commit comments

Comments
 (0)