Skip to content
Open
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
2 changes: 1 addition & 1 deletion editor-extensions/vscode/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion editor-extensions/vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
"activationEvents": [
"onLanguage:reason",
"onLanguage:ocaml",
"onLanguage:reason_lisp"
"onLanguage:reason_lisp",
"onLanguage:bucklescript"
],
"main": "./src/index",
"contributes": {
Expand Down
4 changes: 2 additions & 2 deletions examples/example-project/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"editor.codeLens": true,
// "reason_language_server.location": "../../lib/bs/native/bin.native",
"reason_language_server.location": "../../_build/default/bin/Bin.exe",
"reason_language_server.location": "../../bin.exe",
// "reason_language_server.location": "../lib/bs/native/bin.native.exe",
"reason_language_server.reloadOnChange": true,
"reason_language_server.per_value_codelens": false,
"reason_language_server.per_value_codelens": true,
"reason_language_server.show_debug_errors": true,
// "reason_language_server.autoRebuild": false,
//"reason_language_server.show_module_path_on_hover": false
Expand Down
2 changes: 2 additions & 0 deletions examples/example-project/bsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
"warnings": {
"number": "-32-26-27-33"
},
"bs-dependencies": ["reason-react"],
"reason": { "react-jsx": 3 },
"namespace": "try-it",
"refmt": 3
}
11 changes: 8 additions & 3 deletions examples/example-project/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion examples/example-project/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"dependencies": {
"bs-platform": "^5.0.0"
"bs-platform": "8.2.0",
"reason-react": "^0.9.1"
},
"scripts": {
"build": "bsb -make-world",
Expand Down
4 changes: 0 additions & 4 deletions examples/example-project/src/Awesome.rei

This file was deleted.

4 changes: 2 additions & 2 deletions examples/example-project/src/Hello.re
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ let a = [
let div = (~x, ~y, ~children, ()) => 10;

let m = <div
x=10
y=20
x="10"
y="20"
/>;

let something = animal => switch animal {
Expand Down
16 changes: 16 additions & 0 deletions examples/example-project/src/ZZ.res
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@


let a = 12

let b = [1, 2, 3, a]


let c = <div />

// module M = {
// @react.component
// let make = (~x) => React.string(x)
// }


// let d = <M x="abc" />
12 changes: 10 additions & 2 deletions src/analyze/AsYouType.re
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ let format = (text, fmtCmd) => {
};

let justBscCommand = (~interface, ~reasonFormat, ~command, compilerPath, sourceFile, includes, flags) => {
// TestRes
let res = Filename.check_suffix(sourceFile, ".res") || Filename.check_suffix(sourceFile, ".resi");
let flags = reasonFormat ? {
/* Filter out -pp flags for Reason files. Refmt is the only preprocessor
that should apply to Reason files. */
Expand All @@ -82,7 +84,7 @@ let justBscCommand = (~interface, ~reasonFormat, ~command, compilerPath, sourceF
command,
includes |> List.map(i => Printf.sprintf("-I %s", Commands.shellEscape(i))) |> String.concat(" "),
flags ++ (reasonFormat ? " -bs-re-out" : ""),
interface ? "-intf" : "-impl",
res ? "" : (interface ? "-intf" : "-impl"),
sourceFile
)
};
Expand Down Expand Up @@ -173,7 +175,13 @@ let getAst = (~cacheLocation, ~compilerVersion, ~moduleName, ~uri) => {

let process = (~uri, ~moduleName, ~basePath, ~reasonFormat, text, ~cacheLocation, ~compilerVersion, ~allLocations, compilerPath, refmtPath, includes, flags) => {
let interface = Utils.endsWith(uri, "i");
// TestRes
let res = Utils.endsWith(uri, "res") || Utils.endsWith(uri, "resi");
let%try (syntaxError, astFile) = switch (refmtPath) {
| _ when res =>
let astFile = cacheLocation /+ moduleName ++ ".res" ++ (interface ? "i" : "");
let%try () = Files.writeFileResult(astFile, text);
Ok((None, astFile))
| Some(refmtPath) => runRefmt(~interface, ~moduleName, ~cacheLocation, text, refmtPath);
| None => {
let astFile = cacheLocation /+ moduleName ++ ".ast" ++ (interface ? "i" : "");
Expand Down Expand Up @@ -228,7 +236,7 @@ let process = (~uri, ~moduleName, ~basePath, ~reasonFormat, text, ~cacheLocation
// | _ => Log.log("Doesn't exist")
// };
let%try_wrap full = fullForCmt(cmtPath, uri, x => x);
Success(String.concat("\n", lines @ error), full)
Success(String.concat("\n", (res ? [] : lines) @ error), full)
}
}
};