New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DRILL-5868: Support SQL syntax highlighting of queries #1084
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
3 changes: 1 addition & 2 deletions
3
exec/java-exec/src/main/resources/rest/static/js/ace-code-editor/ace.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
4 changes: 4 additions & 0 deletions
4
exec/java-exec/src/main/resources/rest/static/js/ace-code-editor/ext-language_tools.js
Large diffs are not rendered by default.
Oops, something went wrong.
199 changes: 199 additions & 0 deletions
199
exec/java-exec/src/main/resources/rest/static/js/ace-code-editor/mode-snippets.js
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,199 @@ | ||
ace.define("ace/mode/folding/coffee",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode","ace/range"], function(require, exports, module) { | ||
"use strict"; | ||
|
||
var oop = require("../../lib/oop"); | ||
var BaseFoldMode = require("./fold_mode").FoldMode; | ||
var Range = require("../../range").Range; | ||
|
||
var FoldMode = exports.FoldMode = function() {}; | ||
oop.inherits(FoldMode, BaseFoldMode); | ||
|
||
(function() { | ||
|
||
this.getFoldWidgetRange = function(session, foldStyle, row) { | ||
var range = this.indentationBlock(session, row); | ||
if (range) | ||
return range; | ||
|
||
var re = /\S/; | ||
var line = session.getLine(row); | ||
var startLevel = line.search(re); | ||
if (startLevel == -1 || line[startLevel] != "#") | ||
return; | ||
|
||
var startColumn = line.length; | ||
var maxRow = session.getLength(); | ||
var startRow = row; | ||
var endRow = row; | ||
|
||
while (++row < maxRow) { | ||
line = session.getLine(row); | ||
var level = line.search(re); | ||
|
||
if (level == -1) | ||
continue; | ||
|
||
if (line[level] != "#") | ||
break; | ||
|
||
endRow = row; | ||
} | ||
|
||
if (endRow > startRow) { | ||
var endColumn = session.getLine(endRow).length; | ||
return new Range(startRow, startColumn, endRow, endColumn); | ||
} | ||
}; | ||
this.getFoldWidget = function(session, foldStyle, row) { | ||
var line = session.getLine(row); | ||
var indent = line.search(/\S/); | ||
var next = session.getLine(row + 1); | ||
var prev = session.getLine(row - 1); | ||
var prevIndent = prev.search(/\S/); | ||
var nextIndent = next.search(/\S/); | ||
|
||
if (indent == -1) { | ||
session.foldWidgets[row - 1] = prevIndent!= -1 && prevIndent < nextIndent ? "start" : ""; | ||
return ""; | ||
} | ||
if (prevIndent == -1) { | ||
if (indent == nextIndent && line[indent] == "#" && next[indent] == "#") { | ||
session.foldWidgets[row - 1] = ""; | ||
session.foldWidgets[row + 1] = ""; | ||
return "start"; | ||
} | ||
} else if (prevIndent == indent && line[indent] == "#" && prev[indent] == "#") { | ||
if (session.getLine(row - 2).search(/\S/) == -1) { | ||
session.foldWidgets[row - 1] = "start"; | ||
session.foldWidgets[row + 1] = ""; | ||
return ""; | ||
} | ||
} | ||
|
||
if (prevIndent!= -1 && prevIndent < indent) | ||
session.foldWidgets[row - 1] = "start"; | ||
else | ||
session.foldWidgets[row - 1] = ""; | ||
|
||
if (indent < nextIndent) | ||
return "start"; | ||
else | ||
return ""; | ||
}; | ||
|
||
}).call(FoldMode.prototype); | ||
|
||
}); | ||
|
||
ace.define("ace/mode/snippets",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/text_highlight_rules","ace/mode/folding/coffee"], function(require, exports, module) { | ||
"use strict"; | ||
|
||
var oop = require("../lib/oop"); | ||
var TextMode = require("./text").Mode; | ||
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; | ||
|
||
var SnippetHighlightRules = function() { | ||
|
||
var builtins = "SELECTION|CURRENT_WORD|SELECTED_TEXT|CURRENT_LINE|LINE_INDEX|" + | ||
"LINE_NUMBER|SOFT_TABS|TAB_SIZE|FILENAME|FILEPATH|FULLNAME"; | ||
|
||
this.$rules = { | ||
"start" : [ | ||
{token:"constant.language.escape", regex: /\\[\$}`\\]/}, | ||
{token:"keyword", regex: "\\$(?:TM_)?(?:" + builtins + ")\\b"}, | ||
{token:"variable", regex: "\\$\\w+"}, | ||
{onMatch: function(value, state, stack) { | ||
if (stack[1]) | ||
stack[1]++; | ||
else | ||
stack.unshift(state, 1); | ||
return this.tokenName; | ||
}, tokenName: "markup.list", regex: "\\${", next: "varDecl"}, | ||
{onMatch: function(value, state, stack) { | ||
if (!stack[1]) | ||
return "text"; | ||
stack[1]--; | ||
if (!stack[1]) | ||
stack.splice(0,2); | ||
return this.tokenName; | ||
}, tokenName: "markup.list", regex: "}"}, | ||
{token: "doc.comment", regex:/^\${2}-{5,}$/} | ||
], | ||
"varDecl" : [ | ||
{regex: /\d+\b/, token: "constant.numeric"}, | ||
{token:"keyword", regex: "(?:TM_)?(?:" + builtins + ")\\b"}, | ||
{token:"variable", regex: "\\w+"}, | ||
{regex: /:/, token: "punctuation.operator", next: "start"}, | ||
{regex: /\//, token: "string.regex", next: "regexp"}, | ||
{regex: "", next: "start"} | ||
], | ||
"regexp" : [ | ||
{regex: /\\./, token: "escape"}, | ||
{regex: /\[/, token: "regex.start", next: "charClass"}, | ||
{regex: "/", token: "string.regex", next: "format"}, | ||
{"token": "string.regex", regex:"."} | ||
], | ||
charClass : [ | ||
{regex: "\\.", token: "escape"}, | ||
{regex: "\\]", token: "regex.end", next: "regexp"}, | ||
{"token": "string.regex", regex:"."} | ||
], | ||
"format" : [ | ||
{regex: /\\[ulULE]/, token: "keyword"}, | ||
{regex: /\$\d+/, token: "variable"}, | ||
{regex: "/[gim]*:?", token: "string.regex", next: "start"}, | ||
{"token": "string", regex:"."} | ||
] | ||
}; | ||
}; | ||
oop.inherits(SnippetHighlightRules, TextHighlightRules); | ||
|
||
exports.SnippetHighlightRules = SnippetHighlightRules; | ||
|
||
var SnippetGroupHighlightRules = function() { | ||
this.$rules = { | ||
"start" : [ | ||
{token: "text", regex: "^\\t", next: "sn-start"}, | ||
{token:"invalid", regex: /^ \s*/}, | ||
{token:"comment", regex: /^#.*/}, | ||
{token:"constant.language.escape", regex: "^regex ", next: "regex"}, | ||
{token:"constant.language.escape", regex: "^(trigger|endTrigger|name|snippet|guard|endGuard|tabTrigger|key)\\b"} | ||
], | ||
"regex" : [ | ||
{token:"text", regex: "\\."}, | ||
{token:"keyword", regex: "/"}, | ||
{token:"empty", regex: "$", next: "start"} | ||
] | ||
}; | ||
this.embedRules(SnippetHighlightRules, "sn-", [ | ||
{token: "text", regex: "^\\t", next: "sn-start"}, | ||
{onMatch: function(value, state, stack) { | ||
stack.splice(stack.length); | ||
return this.tokenName; | ||
}, tokenName: "text", regex: "^(?!\t)", next: "start"} | ||
]); | ||
|
||
}; | ||
|
||
oop.inherits(SnippetGroupHighlightRules, TextHighlightRules); | ||
|
||
exports.SnippetGroupHighlightRules = SnippetGroupHighlightRules; | ||
|
||
var FoldMode = require("./folding/coffee").FoldMode; | ||
|
||
var Mode = function() { | ||
this.HighlightRules = SnippetGroupHighlightRules; | ||
this.foldingRules = new FoldMode(); | ||
this.$behaviour = this.$defaultBehaviour; | ||
}; | ||
oop.inherits(Mode, TextMode); | ||
|
||
(function() { | ||
this.$indentWithTabs = true; | ||
this.lineCommentStart = "#"; | ||
this.$id = "ace/mode/snippets"; | ||
}).call(Mode.prototype); | ||
exports.Mode = Mode; | ||
|
||
|
||
}); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like you have the same code on lines 87-88. These code lines are included when only impersonation is enabled. So if I am not mistaken, you'll end up with two query editors when only impersonation is enabled. Please check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me take a look. This might have slipped past during a merge conflict.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Patched and Verified that with Impersonation enabled, there is only one editor for the profile page.