feat: autocomplete SQL al escribir en vez de Ctrl+Space
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
569bb43a62
commit
eb6bcebff8
@@ -107,7 +107,7 @@
|
|||||||
<div class="flex items-center justify-between px-3 py-1.5 border-b border-gray-100">
|
<div class="flex items-center justify-between px-3 py-1.5 border-b border-gray-100">
|
||||||
<span class="text-xs text-gray-500 font-mono" id="editor-label">SQL</span>
|
<span class="text-xs text-gray-500 font-mono" id="editor-label">SQL</span>
|
||||||
<div class="flex items-center gap-2">
|
<div class="flex items-center gap-2">
|
||||||
<span class="text-xs text-gray-400">Ctrl+Enter para ejecutar · Ctrl+Space autocomplete</span>
|
<span class="text-xs text-gray-400">Ctrl+Enter para ejecutar</span>
|
||||||
<button onclick="limpiar()" class="text-xs text-gray-400 hover:text-gray-600"><i class="fas fa-eraser"></i></button>
|
<button onclick="limpiar()" class="text-xs text-gray-400 hover:text-gray-600"><i class="fas fa-eraser"></i></button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -170,13 +170,17 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||||||
tabSize: 4,
|
tabSize: 4,
|
||||||
indentWithTabs: false,
|
indentWithTabs: false,
|
||||||
lineWrapping: true,
|
lineWrapping: true,
|
||||||
extraKeys: {
|
hintOptions: { tables: {}, completeSingle: false }
|
||||||
'Ctrl-Space': 'autocomplete',
|
|
||||||
'Cmd-Space': 'autocomplete',
|
|
||||||
},
|
|
||||||
hintOptions: { tables: {} }
|
|
||||||
});
|
});
|
||||||
editor.setSize(null, 180);
|
editor.setSize(null, 180);
|
||||||
|
|
||||||
|
// autocomplete al escribir
|
||||||
|
editor.on('inputRead', (cm, event) => {
|
||||||
|
if (event.origin === '+input' && event.text[0] && /[\w.]/.test(event.text[0])) {
|
||||||
|
cm.showHint({ completeSingle: false });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
editor.on('keydown', (cm, e) => {
|
editor.on('keydown', (cm, e) => {
|
||||||
if ((e.ctrlKey || e.metaKey) && e.key === 'Enter') {
|
if ((e.ctrlKey || e.metaKey) && e.key === 'Enter') {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|||||||
Reference in New Issue
Block a user