mirror of
https://github.com/Fabio286/antares.git
synced 2025-06-05 21:59:22 +02:00
feat: option to toggle editor auto completion
This commit is contained in:
@ -45,60 +45,83 @@
|
|||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-if="selectedTab === 'general'" class="panel-body py-4">
|
<div v-if="selectedTab === 'general'" class="panel-body py-4">
|
||||||
<form class="form-horizontal">
|
<div class="container">
|
||||||
<div class="col-8 col-sm-12">
|
<form class="form-horizontal columns">
|
||||||
<div class="form-group mb-4">
|
<div class="column col-12 h6 text-uppercase mb-1">
|
||||||
<div class="col-6 col-sm-12">
|
{{ $t('word.application') }}
|
||||||
<label class="form-label">
|
|
||||||
<i class="mdi mdi-18px mdi-translate mr-1" />
|
|
||||||
{{ $t('word.language') }}:
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
<div class="col-6 col-sm-12">
|
|
||||||
<select
|
|
||||||
v-model="localLocale"
|
|
||||||
class="form-select"
|
|
||||||
@change="changeLocale(localLocale)"
|
|
||||||
>
|
|
||||||
<option
|
|
||||||
v-for="(locale, key) in locales"
|
|
||||||
:key="key"
|
|
||||||
:value="locale.code"
|
|
||||||
>
|
|
||||||
{{ locale.name }}
|
|
||||||
</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="column col-8 col-sm-12 mb-2">
|
||||||
<div class="col-6 col-sm-12">
|
<div class="form-group mb-4">
|
||||||
<label class="form-label">
|
<div class="col-6 col-sm-12">
|
||||||
{{ $t('message.notificationsTimeout') }}:
|
<label class="form-label">
|
||||||
</label>
|
<i class="mdi mdi-18px mdi-translate mr-1" />
|
||||||
</div>
|
{{ $t('word.language') }}:
|
||||||
<div class="col-6 col-sm-12">
|
</label>
|
||||||
<div class="input-group">
|
</div>
|
||||||
<input
|
<div class="col-6 col-sm-12">
|
||||||
v-model="localTimeout"
|
<select
|
||||||
class="form-input"
|
v-model="localLocale"
|
||||||
type="number"
|
class="form-select"
|
||||||
min="1"
|
@change="changeLocale(localLocale)"
|
||||||
@focusout="checkNotificationsTimeout"
|
|
||||||
>
|
>
|
||||||
<span class="input-group-addon">{{ $t('word.seconds') }}</span>
|
<option
|
||||||
|
v-for="(locale, key) in locales"
|
||||||
|
:key="key"
|
||||||
|
:value="locale.code"
|
||||||
|
>
|
||||||
|
{{ locale.name }}
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="col-6 col-sm-12">
|
||||||
|
<label class="form-label">
|
||||||
|
{{ $t('message.notificationsTimeout') }}:
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div class="col-6 col-sm-12">
|
||||||
|
<div class="input-group">
|
||||||
|
<input
|
||||||
|
v-model="localTimeout"
|
||||||
|
class="form-input"
|
||||||
|
type="number"
|
||||||
|
min="1"
|
||||||
|
@focusout="checkNotificationsTimeout"
|
||||||
|
>
|
||||||
|
<span class="input-group-addon">{{ $t('word.seconds') }}</span>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
</form>
|
<div class="column col-12 h6 mt-4 text-uppercase mb-1">
|
||||||
|
{{ $t('word.editor') }}
|
||||||
|
</div>
|
||||||
|
<div class="column col-8 col-sm-12">
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="col-6 col-sm-12">
|
||||||
|
<label class="form-label">
|
||||||
|
{{ $t('word.autoCompletion') }}:
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div class="col-6 col-sm-12">
|
||||||
|
<label class="form-switch d-inline-block" @click.prevent="toggleAutoComplete">
|
||||||
|
<input type="checkbox" :checked="selectedAutoComplete">
|
||||||
|
<i class="form-icon" />
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-if="selectedTab === 'themes'" class="panel-body py-4">
|
<div v-if="selectedTab === 'themes'" class="panel-body py-4">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="columns">
|
<div class="columns">
|
||||||
<div class="column col-12 h5 mb-2 ">
|
<div class="column col-12 h6 text-uppercase mb-2">
|
||||||
{{ $t('message.applicationTheme') }}
|
{{ $t('message.applicationTheme') }}
|
||||||
</div>
|
</div>
|
||||||
<div class="column col-6 c-hand theme-block" :class="{'selected': applicationTheme === 'dark'}">
|
<div class="column col-6 c-hand theme-block" :class="{'selected': applicationTheme === 'dark'}">
|
||||||
@ -121,7 +144,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="columns mt-4">
|
<div class="columns mt-4">
|
||||||
<div class="column col-12 h5 mb-2">
|
<div class="column col-12 h6 text-uppercase mb-2 mt-4">
|
||||||
{{ $t('message.editorTheme') }}
|
{{ $t('message.editorTheme') }}
|
||||||
</div>
|
</div>
|
||||||
<div class="column col-6 h5 mb-4">
|
<div class="column col-6 h5 mb-4">
|
||||||
@ -256,6 +279,7 @@ export default {
|
|||||||
appVersion: 'application/appVersion',
|
appVersion: 'application/appVersion',
|
||||||
selectedSettingTab: 'application/selectedSettingTab',
|
selectedSettingTab: 'application/selectedSettingTab',
|
||||||
selectedLocale: 'settings/getLocale',
|
selectedLocale: 'settings/getLocale',
|
||||||
|
selectedAutoComplete: 'settings/getAutoComplete',
|
||||||
notificationsTimeout: 'settings/getNotificationsTimeout',
|
notificationsTimeout: 'settings/getNotificationsTimeout',
|
||||||
applicationTheme: 'settings/getApplicationTheme',
|
applicationTheme: 'settings/getApplicationTheme',
|
||||||
editorTheme: 'settings/getEditorTheme',
|
editorTheme: 'settings/getEditorTheme',
|
||||||
@ -308,6 +332,7 @@ ORDER BY
|
|||||||
...mapActions({
|
...mapActions({
|
||||||
closeModal: 'application/hideSettingModal',
|
closeModal: 'application/hideSettingModal',
|
||||||
changeLocale: 'settings/changeLocale',
|
changeLocale: 'settings/changeLocale',
|
||||||
|
changeAutoComplete: 'settings/changeAutoComplete',
|
||||||
changeEditorTheme: 'settings/changeEditorTheme',
|
changeEditorTheme: 'settings/changeEditorTheme',
|
||||||
updateNotificationsTimeout: 'settings/updateNotificationsTimeout'
|
updateNotificationsTimeout: 'settings/updateNotificationsTimeout'
|
||||||
}),
|
}),
|
||||||
@ -327,6 +352,9 @@ ORDER BY
|
|||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
if (e.key === 'Escape')
|
if (e.key === 'Escape')
|
||||||
this.closeModal();
|
this.closeModal();
|
||||||
|
},
|
||||||
|
toggleAutoComplete () {
|
||||||
|
this.changeAutoComplete(!this.selectedAutoComplete);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -34,21 +34,24 @@ export default {
|
|||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters({
|
...mapGetters({
|
||||||
editorTheme: 'settings/getEditorTheme'
|
editorTheme: 'settings/getEditorTheme',
|
||||||
|
autoComplete: 'settings/getAutoComplete'
|
||||||
}),
|
}),
|
||||||
tables () {
|
tables () {
|
||||||
return this.workspace.structure.filter(schema => schema.name === this.schema)
|
return this.workspace
|
||||||
.reduce((acc, curr) => {
|
? this.workspace.structure.filter(schema => schema.name === this.schema)
|
||||||
acc.push(...curr.tables);
|
.reduce((acc, curr) => {
|
||||||
return acc;
|
acc.push(...curr.tables);
|
||||||
}, []).map(table => {
|
return acc;
|
||||||
return {
|
}, []).map(table => {
|
||||||
name: table.name,
|
return {
|
||||||
comment: table.comment,
|
name: table.name,
|
||||||
type: table.type,
|
comment: table.comment,
|
||||||
fields: []
|
type: table.type,
|
||||||
};
|
fields: []
|
||||||
});
|
};
|
||||||
|
})
|
||||||
|
: [];
|
||||||
},
|
},
|
||||||
mode () {
|
mode () {
|
||||||
switch (this.workspace.client) {
|
switch (this.workspace.client) {
|
||||||
@ -90,6 +93,13 @@ export default {
|
|||||||
editorTheme () {
|
editorTheme () {
|
||||||
if (this.editor)
|
if (this.editor)
|
||||||
this.editor.setTheme(`ace/theme/${this.editorTheme}`);
|
this.editor.setTheme(`ace/theme/${this.editorTheme}`);
|
||||||
|
},
|
||||||
|
autoComplete () {
|
||||||
|
if (this.editor) {
|
||||||
|
this.editor.setOptions({
|
||||||
|
enableLiveAutocompletion: this.autoComplete
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted () {
|
mounted () {
|
||||||
@ -105,7 +115,7 @@ export default {
|
|||||||
this.editor.setOptions({
|
this.editor.setOptions({
|
||||||
enableBasicAutocompletion: true,
|
enableBasicAutocompletion: true,
|
||||||
enableSnippets: true,
|
enableSnippets: true,
|
||||||
enableLiveAutocompletion: true
|
enableLiveAutocompletion: this.autoComplete
|
||||||
});
|
});
|
||||||
|
|
||||||
this.editor.completers.push({
|
this.editor.completers.push({
|
||||||
|
@ -64,7 +64,10 @@ module.exports = {
|
|||||||
stay: 'Stay',
|
stay: 'Stay',
|
||||||
author: 'Author',
|
author: 'Author',
|
||||||
light: 'Light',
|
light: 'Light',
|
||||||
dark: 'Dark'
|
dark: 'Dark',
|
||||||
|
autoCompletion: 'Auto Completion',
|
||||||
|
application: 'Application',
|
||||||
|
editor: 'Editor'
|
||||||
},
|
},
|
||||||
message: {
|
message: {
|
||||||
appWelcome: 'Welcome to Antares SQL Client!',
|
appWelcome: 'Welcome to Antares SQL Client!',
|
||||||
|
@ -10,6 +10,7 @@ export default {
|
|||||||
locale: persistentStore.get('locale') || 'en-US',
|
locale: persistentStore.get('locale') || 'en-US',
|
||||||
explorebar_size: persistentStore.get('explorebar_size') || null,
|
explorebar_size: persistentStore.get('explorebar_size') || null,
|
||||||
notifications_timeout: persistentStore.get('notifications_timeout') || 5,
|
notifications_timeout: persistentStore.get('notifications_timeout') || 5,
|
||||||
|
auto_complete: persistentStore.get('auto_complete') || true,
|
||||||
application_theme: persistentStore.get('application_theme') || 'dark',
|
application_theme: persistentStore.get('application_theme') || 'dark',
|
||||||
editor_theme: persistentStore.get('editor_theme') || 'twilight'
|
editor_theme: persistentStore.get('editor_theme') || 'twilight'
|
||||||
},
|
},
|
||||||
@ -17,6 +18,7 @@ export default {
|
|||||||
getLocale: state => state.locale,
|
getLocale: state => state.locale,
|
||||||
getExplorebarSize: state => state.explorebar_size,
|
getExplorebarSize: state => state.explorebar_size,
|
||||||
getNotificationsTimeout: state => state.notifications_timeout,
|
getNotificationsTimeout: state => state.notifications_timeout,
|
||||||
|
getAutoComplete: state => state.auto_complete,
|
||||||
getApplicationTheme: state => state.application_theme,
|
getApplicationTheme: state => state.application_theme,
|
||||||
getEditorTheme: state => state.editor_theme
|
getEditorTheme: state => state.editor_theme
|
||||||
},
|
},
|
||||||
@ -30,6 +32,10 @@ export default {
|
|||||||
state.notifications_timeout = timeout;
|
state.notifications_timeout = timeout;
|
||||||
persistentStore.set('notifications_timeout', state.notifications_timeout);
|
persistentStore.set('notifications_timeout', state.notifications_timeout);
|
||||||
},
|
},
|
||||||
|
SET_AUTO_COMPLETE (state, val) {
|
||||||
|
state.auto_complete = val;
|
||||||
|
persistentStore.set('auto_complete', state.auto_complete);
|
||||||
|
},
|
||||||
SET_EXPLOREBAR_SIZE (state, size) {
|
SET_EXPLOREBAR_SIZE (state, size) {
|
||||||
state.explorebar_size = size;
|
state.explorebar_size = size;
|
||||||
persistentStore.set('explorebar_size', state.explorebar_size);
|
persistentStore.set('explorebar_size', state.explorebar_size);
|
||||||
@ -48,6 +54,9 @@ export default {
|
|||||||
changeExplorebarSize ({ commit }, size) {
|
changeExplorebarSize ({ commit }, size) {
|
||||||
commit('SET_EXPLOREBAR_SIZE', size);
|
commit('SET_EXPLOREBAR_SIZE', size);
|
||||||
},
|
},
|
||||||
|
changeAutoComplete ({ commit }, val) {
|
||||||
|
commit('SET_AUTO_COMPLETE', val);
|
||||||
|
},
|
||||||
changeEditorTheme ({ commit }, theme) {
|
changeEditorTheme ({ commit }, theme) {
|
||||||
commit('SET_EDITOR_THEME', theme);
|
commit('SET_EDITOR_THEME', theme);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user