execute current query

This commit is contained in:
Jan Prochazka
2021-12-12 11:00:48 +01:00
parent 2309f99dad
commit ec94b99f4b
3 changed files with 50 additions and 6 deletions

View File

@@ -75,6 +75,18 @@
return editor;
}
export function getCurrentCommandText(): string {
if (currentPart != null) return currentPart.text;
if (!editor) return '';
const selectedText = editor.getSelectedText();
if (selectedText) return selectedText;
if (editor.getHighlightActiveLine()) {
const line = editor.getSelectionRange().start.row;
return editor.session.getLine(line);
}
return '';
}
const requireEditorPlugins = () => {};
requireEditorPlugins();
@@ -155,7 +167,18 @@
function changedCurrentQueryPart() {
if (queryParts.length <= 1) return;
const cursor = editor.getSelectionRange().start;
const selectionRange = editor.getSelectionRange();
if (
selectionRange.start.row != selectionRange.end.row ||
selectionRange.start.column != selectionRange.end.column
) {
removeCurrentPartMarker();
currentPart = null;
return;
}
const cursor = selectionRange.start;
const part = queryParts.find(
x =>
((cursor.row == x.startLine && cursor.column >= x.startColumn) || cursor.row > x.startLine) &&

View File

@@ -32,6 +32,10 @@
return domEditor.getEditor();
}
export function getCurrentCommandText(): string {
return domEditor.getCurrentCommandText();
}
$: effect = useEffect(() => {
const editor = domEditor?.getEditor();
if ($tabVisible && conid && database && !readOnly && editor) {