mirror of
https://github.com/livebook-dev/livebook.git
synced 2024-11-10 17:15:09 +08:00
e2490c0f7f
* 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>
13 lines
301 B
JavaScript
13 lines
301 B
JavaScript
/**
|
|
* Returns length of suffix in `string` that should be replaced
|
|
* with `newSuffix` to avoid duplication.
|
|
*/
|
|
export function replacedSuffixLength(string, newSuffix) {
|
|
let suffix = newSuffix;
|
|
|
|
while (!string.endsWith(suffix)) {
|
|
suffix = suffix.slice(0, -1);
|
|
}
|
|
|
|
return suffix.length;
|
|
}
|