mirror of
https://github.com/livebook-dev/livebook.git
synced 2025-12-18 14:09:38 +08:00
* Remove Code.Fragment backport * Fix tests compatibility with Elixir 1.13 * Implement signature intellisense * Don't show signatures on module attributes * Add tests for calls with do-end block * Unify spec formatting * Insert parentheses when completing a function call * Send all text until cursor in signature request * Add configuration for completion/signature popups (#693) * Add editor settings form * Add configuration for intellisense defaults * Read fresh settings when editor mounts * Scope attribute names * Fix disabled button styling * Simplify signature box and enable by default * Split settings into system and user sections * Update lib/livebook_web/live/settings_live.ex Co-authored-by: José Valim <jose.valim@dashbit.co> * Update lib/livebook_web/live/settings_live.ex Co-authored-by: José Valim <jose.valim@dashbit.co> Co-authored-by: José Valim <jose.valim@dashbit.co> * Fix spacing in documentation tests Co-authored-by: José Valim <jose.valim@dashbit.co>
34 lines
1.1 KiB
JavaScript
34 lines
1.1 KiB
JavaScript
import { loadLocalSettings, storeLocalSettings } from "../lib/settings";
|
|
|
|
/**
|
|
* A hook for the editor settings.
|
|
*
|
|
* Those settings are user-specific and only relevant on the client
|
|
* side, so we store them locally in the browser storage, so that
|
|
* they are persisted across application runs.
|
|
*/
|
|
const EditorSettings = {
|
|
mounted() {
|
|
const settings = loadLocalSettings();
|
|
|
|
const editorAutoCompletionCheckbox = this.el.querySelector(
|
|
`[name="editor_auto_completion"][value="true"]`
|
|
);
|
|
const editorAutoSignatureCheckbox = this.el.querySelector(
|
|
`[name="editor_auto_signature"][value="true"]`
|
|
);
|
|
|
|
editorAutoCompletionCheckbox.checked = settings.editor_auto_completion;
|
|
editorAutoSignatureCheckbox.checked = settings.editor_auto_signature;
|
|
|
|
editorAutoCompletionCheckbox.addEventListener("change", (event) => {
|
|
storeLocalSettings({ editor_auto_completion: event.target.checked });
|
|
});
|
|
|
|
editorAutoSignatureCheckbox.addEventListener("change", (event) => {
|
|
storeLocalSettings({ editor_auto_signature: event.target.checked });
|
|
});
|
|
},
|
|
};
|
|
|
|
export default EditorSettings;
|