vscode-ocaml icon indicating copy to clipboard operation
vscode-ocaml copied to clipboard

customize bucklescript projects

Open bobzhang opened this issue 8 years ago • 3 comments

If we find it is a bucklescript project (see if it has bsconfig.json in toplevel), We disable ocaml.lintOnSave and use problem matcher as bewl, it is better than merlin for error reporting since it is project aware and more solid(And I solved column-1 based issue in bucklescript compiler). Currently I need type Tasks: Build to start a task, is there a way to automatically start when open such project? thanks!

{
    "version": "0.1.0",
    "command": "bsb",
    "options": {
        "cwd": "${workspaceRoot}"
    },
    "isShellCommand": true,
    "args": [
        "-w"
    ],
    "showOutput": "always",
    "isWatching": true,
    "problemMatcher": {
        "fileLocation": "absolute",
        "owner": "ocaml",
        "watching": {
            "activeOnStart": true,
            "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+(.*)$",
                "severity": 1,
                "message": 2,
                "loop": true
            }
        ]
    }
}

bobzhang avatar Apr 08 '17 16:04 bobzhang

I can't find that vscode provides any api for opening project event. but there is https://code.visualstudio.com/docs/extensionAPI/activation-events#_activationeventsworkspacecontains. So it's possible to achieve it by create another extension that execute "Build Task" command when it activate.

You can disable ocaml.lintOnSave by using workspace settings.

hackwaly avatar Apr 09 '17 02:04 hackwaly

@hackwaly Currently, whenever user create a new project, it still need create a tasks.json and copy it into that project such configuration, could we make it by default?

bobzhang avatar Apr 13 '17 19:04 bobzhang

Maybe we can submit some project generators for yeoman? So we can easily generate bucklescript project and other kind of projects.

hackwaly avatar Apr 14 '17 03:04 hackwaly