Skip to content

Commit

Permalink
feat: support annotate '#' in console (#344)
Browse files Browse the repository at this point in the history
  • Loading branch information
hetao92 committed Nov 7, 2022
1 parent 1e38885 commit 2baa13e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion app/components/CodeMirror/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ export default class ReactCodeMirror extends React.PureComponent<IProps, any> {
}
renderLine = (_instance, line, _element) => {
const info = this.editor.lineInfo(line);
if(info?.text?.trim().startsWith('//')) {
const _text = info?.text?.trim();
if(_text?.startsWith('//') || _text?.startsWith('#')) {
// will trigger error info in codemirror without setTimeout
setTimeout(() => {
this.editor.addLineClass(line, 'wrap', 'notes');
Expand Down
2 changes: 1 addition & 1 deletion app/pages/Console/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ const Console = (props: IProps) => {
const handleRun = async () => {
if(editor.current) {
const value = editor.current!.editor.getValue();
const query = value.split('\n').filter(i => !i.trim().startsWith('//')).join('\n');
const query = value.split('\n').filter(i => !i.trim().startsWith('//') && !i.trim().startsWith('#')).join('\n');
if (!query) {
message.error(intl.get('common.sorryNGQLCannotBeEmpty'));
return;
Expand Down

0 comments on commit 2baa13e

Please sign in to comment.