@@ -25,44 +25,47 @@ let capabilities =
25
25
26
26
let getInitialState = params => {
27
27
let rootUri = Json . get("rootUri" , params) |?> Json . string |?> Uri2 . parse;
28
- let %try rootUri = rootUri |> RResult.orError("Not a uri");
29
- let rootPath = Uri2 . toPath(rootUri);
30
-
31
- Files . mkdirp(rootPath /+ "node_modules" /+ ".lsp" );
32
- Log . setLocation(rootPath /+ "node_modules" /+ ".lsp" /+ "debug.log" );
33
- Log . log("Hello - from " ++ Sys . executable_name);
34
-
35
- Rpc . sendNotification(
36
- stdout,
37
- "client/registerCapability" ,
38
- J . o([
39
- (
40
- "registrations" ,
41
- J . l([
42
- J . o([
43
- ("id" , J . s("watching" )),
44
- ("method" , J . s("workspace/didChangeWatchedFiles" )),
45
- (
46
- "registerOptions" ,
47
- J . o([
48
- (
49
- "watchers" ,
50
- J . l([
51
- J . o([ ("globPattern" , J . s("**/bsconfig.json" ))] ),
52
- J . o([ ("globPattern" , J . s("**/.merlin" ))] ),
53
- ] ),
54
- ),
55
- ] ),
56
- ),
28
+ switch (rootUri |> RResult . orError("Not a uri" )) {
29
+ | Error (e ) => Error (e)
30
+ | Ok (rootUri ) =>
31
+ let rootPath = Uri2 . toPath(rootUri);
32
+
33
+ Files . mkdirp(rootPath /+ "node_modules" /+ ".lsp" );
34
+ Log . setLocation(rootPath /+ "node_modules" /+ ".lsp" /+ "debug.log" );
35
+ Log . log("Hello - from " ++ Sys . executable_name);
36
+
37
+ Rpc . sendNotification(
38
+ stdout,
39
+ "client/registerCapability" ,
40
+ J . o([
41
+ (
42
+ "registrations" ,
43
+ J . l([
44
+ J . o([
45
+ ("id" , J . s("watching" )),
46
+ ("method" , J . s("workspace/didChangeWatchedFiles" )),
47
+ (
48
+ "registerOptions" ,
49
+ J . o([
50
+ (
51
+ "watchers" ,
52
+ J . l([
53
+ J . o([ ("globPattern" , J . s("**/bsconfig.json" ))] ),
54
+ J . o([ ("globPattern" , J . s("**/.merlin" ))] ),
55
+ ] ),
56
+ ),
57
+ ] ),
58
+ ),
59
+ ] ),
57
60
] ),
58
- ] ),
59
- ),
60
- ] ),
61
- );
61
+ ),
62
+ ] ),
63
+ );
62
64
63
- let state = TopTypes . empty() ;
65
+ let state = TopTypes . empty() ;
64
66
65
- Ok (state);
67
+ Ok (state);
68
+ };
66
69
};
67
70
68
71
let parseArgs = args => {
0 commit comments