-
Notifications
You must be signed in to change notification settings - Fork 605
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add vim support for monaco/webeditor
- Loading branch information
1 parent
6e592a2
commit 1ec45e5
Showing
24 changed files
with
250 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<script lang="ts"> | ||
import { Settings } from 'lucide-svelte' | ||
import FormatOnSave from './FormatOnSave.svelte' | ||
import VimMode from './VimMode.svelte' | ||
import { Button, Popup } from './common' | ||
import CodeCompletionStatus from './copilot/CodeCompletionStatus.svelte' | ||
import type { EditorBarUi } from './custom_ui' | ||
export let customUi: EditorBarUi = {} | ||
</script> | ||
|
||
{#if customUi?.autoformatting != false || customUi?.vimMode != false || customUi?.aiCompletion != false} | ||
<Popup | ||
floatingConfig={{ strategy: 'absolute', placement: 'bottom-end' }} | ||
containerClasses="border rounded-lg shadow-lg p-4 bg-surface" | ||
> | ||
<svelte:fragment slot="button"> | ||
<Button | ||
btnClasses="text-tertiary" | ||
color="light" | ||
size="xs" | ||
nonCaptureEvent={true} | ||
startIcon={{ icon: Settings }} | ||
iconOnly | ||
title="Editor settings" | ||
/> | ||
</svelte:fragment> | ||
|
||
<div class="flex flex-col gap-y-2"> | ||
{#if customUi?.autoformatting != false} | ||
<div> | ||
<FormatOnSave /> | ||
</div> | ||
{/if} | ||
{#if customUi?.vimMode != false} | ||
<div> | ||
<VimMode /> | ||
</div> | ||
{/if} | ||
{#if customUi?.aiCompletion != false} | ||
<div> | ||
<CodeCompletionStatus /> | ||
</div> | ||
{/if} | ||
</div> | ||
</Popup> | ||
{/if} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,18 @@ | ||
<script lang="ts"> | ||
import { Paintbrush } from 'lucide-svelte' | ||
import Button from './common/button/Button.svelte' | ||
import { formatOnSave } from '$lib/stores' | ||
import Popover from './Popover.svelte' | ||
import { getLocalSetting, storeLocalSetting } from '$lib/utils' | ||
import PaintbrushOff from './icons/PaintbrushOff.svelte' | ||
const SETTING_NAME = 'formatOnSave' | ||
function loadSetting() { | ||
$formatOnSave = (getLocalSetting(SETTING_NAME) ?? 'true') == 'true' | ||
} | ||
import { FORMAT_ON_SAVE_SETTING_NAME, formatOnSave } from '$lib/stores' | ||
import { storeLocalSetting } from '$lib/utils' | ||
import Toggle from './Toggle.svelte' | ||
function storeSetting() { | ||
$formatOnSave = !$formatOnSave | ||
storeLocalSetting(SETTING_NAME, $formatOnSave.toString()) | ||
storeLocalSetting(FORMAT_ON_SAVE_SETTING_NAME, $formatOnSave.toString()) | ||
} | ||
loadSetting() | ||
</script> | ||
|
||
<Popover> | ||
<svelte:fragment slot="text" | ||
>{$formatOnSave ? 'Disable' : 'Enable'} auto-formatting</svelte:fragment | ||
> | ||
<Button | ||
size="xs" | ||
color="light" | ||
startIcon={{ | ||
icon: !$formatOnSave ? PaintbrushOff : Paintbrush | ||
}} | ||
btnClasses="text-tertiary" | ||
on:click={() => { | ||
storeSetting() | ||
}} | ||
/> | ||
</Popover> | ||
<Toggle | ||
size="xs" | ||
bind:checked={$formatOnSave} | ||
on:change={() => { | ||
storeSetting() | ||
}} | ||
options={{ right: 'auto-formatting' }} | ||
/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.