-
Notifications
You must be signed in to change notification settings - Fork 273
/
ExtHostDefinitionTest.re
68 lines (58 loc) · 1.66 KB
/
ExtHostDefinitionTest.re
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
open Oni_Core;
open Oni_Model;
open Oni_IntegrationTestLib;
open Feature_Editor;
// This test validates:
// - The 'oni-dev' extension gets activated
// - We get a definition response
runTestWithInput(
~name="ExtHostDefinitionTest", (input, dispatch, wait, _runEffects) => {
wait(~name="Capture initial state", (state: State.t) =>
Feature_Vim.mode(state.vim) == Vim.Mode.Normal
);
// Wait until the extension is activated
// Give some time for the exthost to start
wait(
~timeout=30.0,
~name="Validate the 'oni-dev' extension gets activated",
(state: State.t) =>
List.exists(
id => id == "oni-dev-extension",
state.extensions |> Feature_Extensions.activatedIds,
)
);
// Create a buffer
dispatch(Actions.OpenFileByPath("test.oni-dev", None, None));
// Wait for the oni-dev filetype
wait(
~timeout=30.0,
~name="Wait for oni-dev filetype to show up",
(state: State.t) => {
let fileType =
Selectors.getActiveBuffer(state)
|> Option.map(Buffer.getFileType)
|> Option.map(Buffer.FileType.toString);
fileType == Some("oni-dev");
},
);
// Enter some text
input("i");
input("a");
input("b");
input("c");
// Workaround a bug where cursor position is offset with <esc>
input("<esc>");
input("h");
// Should get a definition
wait(
~timeout=30.0,
~name="Validate we get some completions from the 'oni-dev' extension",
(state: State.t) => {
let editor = Feature_Layout.activeEditor(state.layout);
Feature_LanguageSupport.Definition.isAvailable(
~bufferId=Editor.getBufferId(editor),
state.languageSupport,
);
},
);
});