Skip to content

Commit

Permalink
fix SQL display in debug bar
Browse files Browse the repository at this point in the history
  • Loading branch information
cconard96 authored and trasher committed Jan 13, 2024
1 parent 6cd407a commit 0599af7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion js/src/vue/Debug/Toolbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -250,11 +250,12 @@
function cleanSQLQuery(query) {
const newline_keywords = ['UNION', 'FROM', 'WHERE', 'INNER JOIN', 'LEFT JOIN', 'ORDER BY', 'SORT'];
const post_newline_keywords = ['UNION'];
query = query.replace(/\n/g, ' ');
return Promise.resolve(MonacoEditor.colorizeText(query, 'sql')).then((html) => {
// get all 'span' elements with mtk6 class (keywords) and insert the needed line breaks
const newline_before_selector = newline_keywords.map((keyword) => `span.mtk6:contains(${keyword})`).join(',');
const post_newline_selector = post_newline_keywords.map((keyword) => `span.mtk6:contains(${keyword})`).join(',');
return $($.parseHTML(html)).find(newline_before_selector).before('</br>').end().find(post_newline_selector).after('</br>').end().html();;
return $($.parseHTML(html)).find(newline_before_selector).before('</br>').end().find(post_newline_selector).after('</br>').end().html();
});
}
Expand Down

0 comments on commit 0599af7

Please sign in to comment.