Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(vim): Add infrastructure for additional mode context #2362

Merged
merged 2 commits into from
Aug 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions integration_test/ClipboardInsertModePasteEmptyTest.re
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ runTest(
~name="InsertMode test - effects batched to runEffects",
(dispatch, wait, runEffects) => {
wait(~name="Initial mode is normal", (state: State.t) =>
Feature_Vim.mode(state.vim) == Vim.Types.Normal
Feature_Vim.mode(state.vim) == Vim.Mode.Normal
);

dispatch(KeyboardInput({isText: true, input: "i"}));

wait(~name="Mode switches to insert", (state: State.t) =>
Feature_Vim.mode(state.vim) == Vim.Types.Insert
Feature_Vim.mode(state.vim) == Vim.Mode.Insert
);

setClipboard(None);
Expand Down
4 changes: 2 additions & 2 deletions integration_test/ClipboardInsertModePasteMultiLineTest.re
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ runTest(
~name="InsertMode test - effects batched to runEffects",
(dispatch, wait, runEffects) => {
wait(~name="Initial mode is normal", (state: State.t) =>
Feature_Vim.mode(state.vim) == Vim.Types.Normal
Feature_Vim.mode(state.vim) == Vim.Mode.Normal
);

dispatch(KeyboardInput({isText: true, input: "i"}));

wait(~name="Mode switches to insert", (state: State.t) =>
Feature_Vim.mode(state.vim) == Vim.Types.Insert
Feature_Vim.mode(state.vim) == Vim.Mode.Insert
);

setClipboard(Some("def\nghi"));
Expand Down
4 changes: 2 additions & 2 deletions integration_test/ClipboardInsertModePasteSingleLineTest.re
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ runTest(
~name="InsertMode test - effects batched to runEffects",
(dispatch, wait, runEffects) => {
wait(~name="Initial mode is normal", (state: State.t) =>
Feature_Vim.mode(state.vim) == Vim.Types.Normal
Feature_Vim.mode(state.vim) == Vim.Mode.Normal
);

dispatch(KeyboardInput({isText: true, input: "i"}));

wait(~name="Mode switches to insert", (state: State.t) =>
Feature_Vim.mode(state.vim) == Vim.Types.Insert
Feature_Vim.mode(state.vim) == Vim.Mode.Insert
);

setClipboard(Some("def"));
Expand Down
2 changes: 1 addition & 1 deletion integration_test/ClipboardNormalModePasteTest.re
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ runTest(
~name="InsertMode test - effects batched to runEffects",
(dispatch, wait, runEffects) => {
wait(~name="Initial mode is normal", (state: State.t) =>
Feature_Vim.mode(state.vim) == Vim.Types.Normal
Feature_Vim.mode(state.vim) == Vim.Mode.Normal
);

// '*' test case
Expand Down
4 changes: 2 additions & 2 deletions integration_test/ClipboardYankTest.re
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ runTest(~name="ClipboardYankTest", (dispatch, wait, runEffects) => {

dispatch(KeyboardInput({isText: true, input: "i"}));
wait(~name="Mode switches to insert", (state: State.t) =>
Feature_Vim.mode(state.vim) == Vim.Types.Insert
Feature_Vim.mode(state.vim) == Vim.Mode.Insert
);

dispatch(KeyboardInput({isText: true, input: "abc"}));
dispatch(KeyboardInput({isText: false, input: "<esc>"}));
runEffects();

wait(~name="Mode switches back to normal", (state: State.t) =>
Feature_Vim.mode(state.vim) == Vim.Types.Normal
Feature_Vim.mode(state.vim) == Vim.Mode.Normal
);

setClipboard(None);
Expand Down
2 changes: 1 addition & 1 deletion integration_test/EchoNotificationTest.re
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ open Oni_IntegrationTestLib;

runTest(~name="EchoNotificationTest", (dispatch, wait, _runEffects) => {
wait(~name="Initial mode is normal", (state: State.t) =>
Feature_Vim.mode(state.vim) == Vim.Types.Normal
Feature_Vim.mode(state.vim) == Vim.Mode.Normal
);

dispatch(VimExecuteCommand("echo 'hi from test'"));
Expand Down
2 changes: 1 addition & 1 deletion integration_test/EditorFontFromPathTest.re
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ runTest(
~name="EditorFontFromPath",
(_, wait, _) => {
wait(~name="Initial mode is normal", (state: State.t) =>
Feature_Vim.mode(state.vim) == Vim.Types.Normal
Feature_Vim.mode(state.vim) == Vim.Mode.Normal
);

print_endline("Using font: " ++ font);
Expand Down
2 changes: 1 addition & 1 deletion integration_test/EditorFontValidTest.re
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ if (Revery.Environment.os !== Revery.Environment.Linux) {
~name="EditorFontValid",
(_, wait, _) => {
wait(~name="Initial mode is normal", (state: State.t) =>
Feature_Vim.mode(state.vim) == Vim.Types.Normal
Feature_Vim.mode(state.vim) == Vim.Mode.Normal
);

wait(
Expand Down
2 changes: 1 addition & 1 deletion integration_test/EditorUtf8Test.re
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ open Feature_Editor;

runTestWithInput(~name="EditorUtf8Test", (input, dispatch, wait, _) => {
wait(~name="Initial mode is normal", (state: State.t) =>
Feature_Vim.mode(state.vim) == Vim.Types.Normal
Feature_Vim.mode(state.vim) == Vim.Mode.Normal
);

let testFile = getAssetPath("utf8.txt");
Expand Down
2 changes: 1 addition & 1 deletion integration_test/ExtHostBufferOpenTest.re
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module TS = TextSynchronization;
runTestWithInput(
~name="ExtHostBufferOpen", (_input, dispatch, wait, _runEffects) => {
wait(~name="Capture initial state", (state: State.t) =>
Feature_Vim.mode(state.vim) == Vim.Types.Normal
Feature_Vim.mode(state.vim) == Vim.Mode.Normal
);

// Wait until the extension is activated
Expand Down
2 changes: 1 addition & 1 deletion integration_test/ExtHostBufferUpdatesTest.re
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module TS = TextSynchronization;
runTestWithInput(
~name="ExtHostBufferUpdates", (input, dispatch, wait, _runEffects) => {
wait(~name="Capture initial state", (state: State.t) =>
Feature_Vim.mode(state.vim) == Vim.Types.Normal
Feature_Vim.mode(state.vim) == Vim.Mode.Normal
);

// Wait until the extension is activated
Expand Down
2 changes: 1 addition & 1 deletion integration_test/ExtHostCompletionTest.re
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ open Oni_IntegrationTestLib;
runTestWithInput(
~name="ExtHostCompletionTest", (input, dispatch, wait, _runEffects) => {
wait(~name="Capture initial state", (state: State.t) =>
Feature_Vim.mode(state.vim) == Vim.Types.Normal
Feature_Vim.mode(state.vim) == Vim.Mode.Normal
);

// Wait until the extension is activated
Expand Down
2 changes: 1 addition & 1 deletion integration_test/ExtHostDefinitionTest.re
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ open Feature_Editor;
runTestWithInput(
~name="ExtHostDefinitionTest", (input, dispatch, wait, _runEffects) => {
wait(~name="Capture initial state", (state: State.t) =>
Feature_Vim.mode(state.vim) == Vim.Types.Normal
Feature_Vim.mode(state.vim) == Vim.Mode.Normal
);

// Wait until the extension is activated
Expand Down
2 changes: 1 addition & 1 deletion integration_test/FontSizeChangeTest.re
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ open Oni_IntegrationTestLib;
// Validate that change the font size via config results in new metrics
runTest(~name="FontSizeChangeTest", (dispatch, wait, runEffects) => {
wait(~name="Mode switches back to normal", (state: State.t) =>
Feature_Vim.mode(state.vim) == Vim.Types.Normal
Feature_Vim.mode(state.vim) == Vim.Mode.Normal
);

wait(~name="Set configuration to small font size", (state: State.t) => {
Expand Down
4 changes: 2 additions & 2 deletions integration_test/InputIgnoreTest.re
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ module Log = (val Log.withNamespace("IntegrationTest.inputIgnore"));
// This test validates that certain keystrokes are ignored by our Vim layer
runTest(~name="InputIgnore test", (dispatch, wait, runEffects) => {
wait(~name="Initial mode is normal", (state: State.t) =>
Feature_Vim.mode(state.vim) == Vim.Types.Normal
Feature_Vim.mode(state.vim) == Vim.Mode.Normal
);

dispatch(KeyboardInput({isText: true, input: "i"}));

wait(~name="Mode switches to insert", (state: State.t) =>
Feature_Vim.mode(state.vim) == Vim.Types.Insert
Feature_Vim.mode(state.vim) == Vim.Mode.Insert
);

dispatch(KeyboardInput({isText: false, input: "<D-A->"}));
Expand Down
4 changes: 2 additions & 2 deletions integration_test/InsertModeTest.re
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ open Oni_IntegrationTestLib;

runTest(~name="InsertMode test", (dispatch, wait, _) => {
wait(~name="Initial mode is normal", (state: State.t) =>
Feature_Vim.mode(state.vim) == Vim.Types.Normal
Feature_Vim.mode(state.vim) == Vim.Mode.Normal
);

dispatch(KeyboardInput({isText: true, input: "i"}));

wait(~name="Mode switches to insert", (state: State.t) =>
Feature_Vim.mode(state.vim) == Vim.Types.Insert
Feature_Vim.mode(state.vim) == Vim.Mode.Insert
);
});
6 changes: 3 additions & 3 deletions integration_test/KeySequenceJJTest.re
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ runTest(
~name="KeySequenceJJTest",
(dispatch, wait, _) => {
wait(~name="Initial mode is normal", (state: State.t) =>
Feature_Vim.mode(state.vim) == Vim.Types.Normal
Feature_Vim.mode(state.vim) == Vim.Mode.Normal
);

let input = key => {
Expand All @@ -31,14 +31,14 @@ runTest(

input("i");
wait(~name="Mode is now insert", (state: State.t) =>
Feature_Vim.mode(state.vim) == Vim.Types.Insert
Feature_Vim.mode(state.vim) == Vim.Mode.Insert
);

input("j");
input("j");

wait(~name="Mode is back to normal", (state: State.t) =>
Feature_Vim.mode(state.vim) == Vim.Types.Normal
Feature_Vim.mode(state.vim) == Vim.Mode.Normal
);
// TODO: Figure out why this check is failing...
wait(~name="Validate buffer is empty", (state: State.t) => {
Expand Down
2 changes: 1 addition & 1 deletion integration_test/KeybindingsInvalidJsonTest.re
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ runTest(
~name="KeybindingsInvalidJson",
(_dispatch, wait, _) => {
wait(~name="Initial mode is normal", (state: State.t) =>
Feature_Vim.mode(state.vim) == Vim.Types.Normal
Feature_Vim.mode(state.vim) == Vim.Mode.Normal
);

let getErrorNotificationCount = (state: State.t) => {
Expand Down
2 changes: 1 addition & 1 deletion integration_test/LanguageCssTest.re
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ open Feature_LanguageSupport;
runTestWithInput(
~name="LanguageCssTest", (input, dispatch, wait, _runEffects) => {
wait(~name="Capture initial state", (state: State.t) =>
Feature_Vim.mode(state.vim) == Vim.Types.Normal
Feature_Vim.mode(state.vim) == Vim.Mode.Normal
);

ExtensionHelpers.waitForExtensionToActivate(
Expand Down
2 changes: 1 addition & 1 deletion integration_test/LanguageTypeScriptTest.re
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ open Feature_LanguageSupport;
runTestWithInput(
~name="LanguageTypeScriptTest", (input, dispatch, wait, _runEffects) => {
wait(~name="Capture initial state", (state: State.t) =>
Feature_Vim.mode(state.vim) == Vim.Types.Normal
Feature_Vim.mode(state.vim) == Vim.Mode.Normal
);

ExtensionHelpers.waitForExtensionToActivate(
Expand Down
2 changes: 1 addition & 1 deletion integration_test/LineEndingsCRLFTest.re
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ open Oni_IntegrationTestLib;

runTest(~name="LineEndingsCRLFTest", (dispatch, wait, _runEffects) => {
wait(~name="Capture initial state", (state: State.t) =>
Feature_Vim.mode(state.vim) == Vim.Types.Normal
Feature_Vim.mode(state.vim) == Vim.Mode.Normal
);

let testFile = getAssetPath("test.crlf");
Expand Down
2 changes: 1 addition & 1 deletion integration_test/LineEndingsLFTest.re
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ open Oni_IntegrationTestLib;

runTest(~name="LineEndingsLFTest", (dispatch, wait, _runEffects) => {
wait(~name="Capture initial state", (state: State.t) =>
Feature_Vim.mode(state.vim) == Vim.Types.Normal
Feature_Vim.mode(state.vim) == Vim.Mode.Normal
);

let testFile = getAssetPath("test.lf");
Expand Down
2 changes: 1 addition & 1 deletion integration_test/QuickOpenEventuallyCompletesTest.re
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ open Oni_IntegrationTestLib;

runTest(~name="QuickOpen eventually completes", (dispatch, wait, runEffects) => {
wait(~name="Initial mode is normal", (state: State.t) =>
Feature_Vim.mode(state.vim) == Vim.Types.Normal
Feature_Vim.mode(state.vim) == Vim.Mode.Normal
);

/* Switch to root directory */
Expand Down
2 changes: 1 addition & 1 deletion integration_test/Regression1671Test.re
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ runTestWithInput(
~name="Regression1671 - Opening new buffer loses changes in previous buffer",
(input, _dispatch, wait, _runEffects) => {
wait(~name="Capture initial state", (state: State.t) =>
Feature_Vim.mode(state.vim) == Vim.Types.Normal
Feature_Vim.mode(state.vim) == Vim.Mode.Normal
);

input(":e a-test-file");
Expand Down
2 changes: 1 addition & 1 deletion integration_test/Regression2349EnewTest.re
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ open Oni_IntegrationTestLib;

runTest(~name="Regression: Command line no completions", (dispatch, wait, _) => {
wait(~name="Initial mode is normal", (state: State.t) =>
Feature_Vim.mode(state.vim) == Vim.Types.Normal
Feature_Vim.mode(state.vim) == Vim.Mode.Normal
);

let initialEditorId = ref(None);
Expand Down
4 changes: 2 additions & 2 deletions integration_test/RegressionCommandLineNoCompletionTest.re
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ open Oni_IntegrationTestLib;

runTest(~name="Regression: Command line no completions", (dispatch, wait, _) => {
wait(~name="Initial mode is normal", (state: State.t) =>
Feature_Vim.mode(state.vim) == Vim.Types.Normal
Feature_Vim.mode(state.vim) == Vim.Mode.Normal
);

dispatch(KeyboardInput({isText: true, input: ":"}));

wait(~name="Mode switches to command line", (state: State.t) =>
Feature_Vim.mode(state.vim) == Vim.Types.CommandLine
Feature_Vim.mode(state.vim) == Vim.Mode.CommandLine
);

dispatch(KeyboardInput({isText: true, input: "e"}));
Expand Down
2 changes: 1 addition & 1 deletion integration_test/RegressionFileModifiedIndicationTest.re
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ runTestWithInput(
~name="RegressionFileModifiedIndication",
(input, dispatch, wait, runEffects) => {
wait(~name="Initial mode is normal", (state: State.t) =>
Feature_Vim.mode(state.vim) == Vim.Types.Normal
Feature_Vim.mode(state.vim) == Vim.Mode.Normal
);

let initialBuffer = Vim.Buffer.getCurrent();
Expand Down
2 changes: 1 addition & 1 deletion integration_test/SCMGitTest.re
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ open Oni_IntegrationTestLib;

runTest(~name="SCMGitTest", (_dispatch, wait, _runEffects) => {
wait(~name="Capture initial state", (state: State.t) =>
Feature_Vim.mode(state.vim) == Vim.Types.Normal
Feature_Vim.mode(state.vim) == Vim.Mode.Normal
);

// For now... just validate that the extension activated
Expand Down
4 changes: 2 additions & 2 deletions integration_test/SearchShowClearHighlightsTest.re
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ runTest(
~name="InsertMode test - effects batched to runEffects",
(dispatch, wait, runEffects) => {
wait(~name="Initial mode is normal", (state: State.t) =>
Feature_Vim.mode(state.vim) == Vim.Types.Normal
Feature_Vim.mode(state.vim) == Vim.Mode.Normal
);

// Edit
dispatch(KeyboardInput({isText: true, input: "i"}));

wait(~name="Mode switches to insert", (state: State.t) =>
Feature_Vim.mode(state.vim) == Vim.Types.Insert
Feature_Vim.mode(state.vim) == Vim.Mode.Insert
);

dispatch(KeyboardInput({isText: true, input: "a"}));
Expand Down
2 changes: 1 addition & 1 deletion integration_test/SyntaxHighlightTextMateTest.re
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ open Oni_IntegrationTestLib;
// Validate that textmate highlight runs
runTest(~name="SyntaxHighlightTextMateTest", (dispatch, wait, _runEffects) => {
wait(~name="Capture initial state", (state: State.t) =>
Feature_Vim.mode(state.vim) == Vim.Types.Normal
Feature_Vim.mode(state.vim) == Vim.Mode.Normal
);
wait(~name="Wait for syntax server", ~timeout=10.0, (state: State.t) => {
Feature_Syntax.isSyntaxServerRunning(state.syntaxHighlights)
Expand Down
2 changes: 1 addition & 1 deletion integration_test/SyntaxHighlightTreesitterTest.re
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ runTest(
~name="SyntaxHighlightTreesitterTest",
(dispatch, wait, _runEffects) => {
wait(~name="Capture initial state", (state: State.t) =>
Feature_Vim.mode(state.vim) == Vim.Types.Normal
Feature_Vim.mode(state.vim) == Vim.Mode.Normal
);

wait(~name="Wait for syntax server", ~timeout=10.0, (state: State.t) => {
Expand Down
4 changes: 2 additions & 2 deletions integration_test/TypingBatchedTest.re
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ runTest(
~name="InsertMode test - effects batched to runEffects",
(dispatch, wait, runEffects) => {
wait(~name="Initial mode is normal", (state: State.t) =>
Feature_Vim.mode(state.vim) == Vim.Types.Normal
Feature_Vim.mode(state.vim) == Vim.Mode.Normal
);

dispatch(KeyboardInput({isText: true, input: "i"}));

wait(~name="Mode switches to insert", (state: State.t) =>
Feature_Vim.mode(state.vim) == Vim.Types.Insert
Feature_Vim.mode(state.vim) == Vim.Mode.Insert
);

/* Simulate multiple events getting dispatched before running effects */
Expand Down
4 changes: 2 additions & 2 deletions integration_test/TypingUnbatchedTest.re
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ runTest(
~name="InsertMode test - effects batched to runEffects",
(dispatch, wait, runEffects) => {
wait(~name="Initial mode is normal", (state: State.t) =>
Feature_Vim.mode(state.vim) == Vim.Types.Normal
Feature_Vim.mode(state.vim) == Vim.Mode.Normal
);

dispatch(KeyboardInput({isText: true, input: "i"}));

wait(~name="Mode switches to insert", (state: State.t) =>
Feature_Vim.mode(state.vim) == Vim.Types.Insert
Feature_Vim.mode(state.vim) == Vim.Mode.Insert
);

/* Simulate multiple events getting dispatched before running effects */
Expand Down
Loading