diff --git a/.vscode/tasks.json b/.vscode/tasks.json deleted file mode 100644 index ab8c7c59b1..0000000000 --- a/.vscode/tasks.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "version": "2.0.0", - "tasks": [ - { - "label": "Watch build", - "command": "node", - "options": { - "cwd": "${workspaceRoot}/jscomp" - }, - // "isShellCommand": true, - "type": "shell", - "group": { - "kind": "build", - "isDefault": true - }, - "args": ["../scripts/tasks.js"], - "presentation": { - "echo": true, - "reveal": "always", - "focus": false, - "panel": "shared", - "showReuseMessage": true, - "clear": false - }, - "isBackground": true, - "problemMatcher": { - "fileLocation": ["autodetect", "${workspaceRoot}/jscomp"], - "owner": "ocaml", - "background": { - "activeOnStart": false, - "beginsPattern": ">>>> Start compiling", - "endsPattern": ">>>> Finish compiling" - }, - "pattern": [ - { - "regexp": "^File \"(.*)\", line (\\d+)(?:, characters (\\d+)-(\\d+))?:$", - "file": 1, - "line": 2, - "column": 3, - "endColumn": 4 - }, - { - // "regexp": "^(?:(?:Parse\\s+)?(Warning|[Ee]rror)(?:\\s+\\d+)?:)?\\s+(.*)$", - "regexp": "^(?:(?:Parse\\s+)?(Warning|[Ee]rror)(?:\\s+(\\(warning \\d+\\)|\\(alert \\w+\\)))?(?:\\s+\\d+)?:)?\\s+(.*)$", - "severity": 1, - "message": 2, - "loop": true - } - ] - } - }, - { - "label": "check unused bsc", - "command": "node", - "options": { - "cwd": "${workspaceRoot}/lib" - }, - "args": ["../scripts/checkUnused.js", "whole_compiler"], - "problemMatcher": { - "base": "$ocamlc", - "fileLocation": "autoDetect", - "owner": "globalUnused" - } - }, - { - "label": "check unused bsb_helper", - "command": "node", - "options": { - "cwd": "${workspaceRoot}/lib" - }, - "args": ["../scripts/checkUnused.js", "bsb_helper"], - "problemMatcher": { - "base": "$ocamlc", - "fileLocation": "autoDetect", - "owner": "globalUnused" - } - } - ] -} diff --git a/jscomp/ml/builtin_attributes.ml b/jscomp/ml/builtin_attributes.ml index 391aa890b5..f53edbf906 100755 --- a/jscomp/ml/builtin_attributes.ml +++ b/jscomp/ml/builtin_attributes.ml @@ -61,9 +61,8 @@ let rec error_of_extension ext = let cat s1 s2 = if s2 = "" then s1 else - if Clflags.bs_vscode then s1 ^ " " ^ s2 (* 2 spaces indentation for the next line *) - else s1 ^ "\n " ^ s2 + s1 ^ "\n " ^ s2 let rec deprecated_of_attrs = function | [] -> None diff --git a/jscomp/ml/clflags.ml b/jscomp/ml/clflags.ml index 8e88d06671..b2b2a78db5 100644 --- a/jscomp/ml/clflags.ml +++ b/jscomp/ml/clflags.ml @@ -61,11 +61,6 @@ let unboxed_types = ref false type mli_status = Mli_exists | Mli_non_exists let assume_no_mli = ref Mli_non_exists -let bs_vscode = - try ignore @@ Sys.getenv "BS_VSCODE" ; true with _ -> false - (* We get it from environment variable mostly due to - we don't want to rebuild when flip on or off - *) let dont_record_crc_unit : string option ref = ref None let bs_gentype = ref false let no_assert_false = ref false diff --git a/jscomp/ml/clflags.mli b/jscomp/ml/clflags.mli index 1ef70eeb81..80b170422d 100644 --- a/jscomp/ml/clflags.mli +++ b/jscomp/ml/clflags.mli @@ -38,7 +38,6 @@ val reset_dump_state: unit -> unit type mli_status = Mli_exists | Mli_non_exists val assume_no_mli : mli_status ref -val bs_vscode : bool val dont_record_crc_unit : string option ref val bs_gentype : bool ref val no_assert_false : bool ref diff --git a/jscomp/super_errors/super_main.ml b/jscomp/super_errors/super_main.ml index 6ce27114a5..6dec8b4058 100644 --- a/jscomp/super_errors/super_main.ml +++ b/jscomp/super_errors/super_main.ml @@ -1,10 +1,6 @@ (* the entry point. This is used by rescript_compiler_main.ml *) let setup = - lazy (match Sys.getenv_opt "BS_VSCODE" with - | Some ("true" | "1") -> - () - | Some _ | None -> - Super_location.setup (); + lazy (Super_location.setup (); Super_typetexp.setup (); Super_typemod.setup (); Super_typecore.setup (); diff --git a/scripts/tasks.js b/scripts/tasks.js deleted file mode 100644 index 53eac5d4aa..0000000000 --- a/scripts/tasks.js +++ /dev/null @@ -1,146 +0,0 @@ -//@ts-check - -process.env["BS_VSCODE"] = "1"; - -var fs = require("fs"); -var path = require("path"); -var cp = require("child_process"); -var sourceDirs = [ - "ext", - "common", - "frontend", - "depends", - "core", - "super_errors", - "outcome_printer", - "bsb", - "main", - "others", - "stdlib-406", - "runtime", - "test", - "ml", - "ounit_tests", - "bsb_helper", - "napkin", - "js_parser", -]; - -var buildAppending = false; -var isBuilding = false; - -var jscompDir = path.join("..", "jscomp"); -/** - * - * @param {Date} d - */ -function showDate(d) { - return `${d.getHours()}:${d.getMinutes()}:${d.getSeconds()}`; -} -function rebuild() { - if (isBuilding) { - buildAppending = true; - } else { - console.log(">>>> Start compiling"); - isBuilding = true; - - cp.fork(path.join(__dirname, "ninja.js"), ["build"]).on( - "exit", - buildFinished - ); - } -} -/** - * - * @param {number} code - * @param {string} signal - */ -function buildFinished(code, signal) { - isBuilding = false; - if (buildAppending) { - buildAppending = false; - rebuild(); - } else { - if (code !== 0) { - // console.log(`File "package.json", line 1, characters 1-1:`); - // console.log(`Error: Failed to build ${showDate(new Date())}`); - } - console.log(">>>> Finish compiling (options: R|clean|config)"); - // TODO: check ninja exit error code - if (code === 0) { - // This is not always correct - // ninjaFile.updateDev(); - // This file is cached - cp.fork(path.join(__dirname, "ninja.js"), ["-dev"]); - } - } -} -/** - * - * @param {string} eventType - * @param {string} filename - */ -function onSourceChange(eventType, filename) { - // console.log('event ', eventType,filename) - if ( - filename.endsWith(".ml") || - filename.endsWith(".mli") || - filename.endsWith(".mll") || - filename.endsWith(".mly") || - filename.endsWith(".json") || - filename.endsWith(".res") || - filename.endsWith(".resi") - ) { - rebuild(); - } -} - -sourceDirs.forEach(x => { - fs.watch(path.join(jscompDir, x), "utf8", onSourceChange); -}); - -fs.watch(path.join("..", "package.json"), "utf8", onSourceChange); - -rebuild(); - -var readline = require("readline"); -readline - .createInterface({ - input: process.stdin, - output: process.stdout, - }) - .on("line", input => { - switch (input.toLowerCase()) { - case "r": - rebuild(); - break; - case "config": - if (isBuilding) { - console.log(`it's building`); - } else { - isBuilding = true; - cp.fork(path.join(__dirname, "ninja.js"), ["config"]).on( - "close", - () => { - isBuilding = false; - rebuild(); - } - ); - } - break; - case "clean": - if (isBuilding) { - console.log(`it's building`); - } else { - isBuilding = true; - cp.fork(path.join(__dirname, "ninja.js"), ["cleanbuild"]).on( - "close", - () => { - isBuilding = false; - } - ); - } - - break; - } - });