imandra-ai / imandra-vscode

VSCode extension for developing imandra
Other
2 stars 0 forks source link

dune projects new file error #38

Open ewenmaclean opened 1 year ago

ewenmaclean commented 1 year ago

If the extension is running and functioning on a dune built project and you add to the open editors (in VSCode) a brand new file with contents e.g.

let f x = x + 1;;

then this causes the merlin server to crash.

(@Bronsa I wonder if you could possibly see if this is also the case in emacs - I suspect not, but it would help diagnose)

Bronsa commented 1 year ago

no, it doesn't looke like it crashes, it just returns an error.

this is the debug log for this case

# calling binary: "/home/bronsa/src/ai/borsa-italiana-optiq/_opam/bin/ocamlmerlin" with arguments: ("server" "errors" "-protocol" "sexp" "-log-file" "-" "-flags" "-open Imandra_prelude -addsuffix .iml:.imli -assocsuffix .iml:imandra" "-filename" "/home/bronsa/src/ai/borsa-italiana-optiq/model/foo.iml").
# stdout
((assoc) (class . "return") (value ((assoc) (type . "config") (sub) (valid . true) (message . "No config found for file \"foo.iml\" in \"model\". Try calling `dune build`.")) ((assoc) (start (assoc) (line . 1) (col . 14)) (end (assoc) (line . 1) (col . 15)) (type . "typer") (sub) (valid . true) (message . "Unbound module Z"))) (notifications) (timing (assoc) (clock . 74) (cpu . 74) (query . 74) (pp . 0) (reader . 0) (ppx . 0) (typer . 0) (error . 0)))
# stderr
# 0.01 Mconfig_dot - get_config
Querying dune (inital cwd: /home/bronsa/src/ai/borsa-italiana-optiq) for file: model/foo.iml.
Workdir: /home/bronsa/src/ai/borsa-italiana-optiq/model
# 0.01 Mconfig_dot - get_config
Querying dune (inital cwd: /home/bronsa/src/ai/borsa-italiana-optiq) for file: /home/bronsa/src/ai/borsa-italiana-optiq/model/foo.iml.
Workdir: /home/bronsa/src/ai/borsa-italiana-optiq/model
# 0.01 Mconfig - normalize
{
  "ocaml": {
    "include_dirs": [],
    "no_std_include": false,
    "unsafe": false,
    "classic": false,
    "principal": false,
    "real_paths": true,
    "recursive_types": false,
    "strict_sequence": false,
    "applicative_functors": true,
    "unsafe_string": false,
    "nopervasives": false,
    "strict_formats": false,
    "open_modules": [ "Imandra_prelude" ],
    "ppx": [],
    "pp": null,
    "warnings": {
      "actives": [
        1, 2, 3, 5, 8, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
        23, 24, 25, 26, 28, 31, 43, 46, 47, 49, 51, 52, 53, 54, 55, 56, 57,
        58, 59, 61, 62, 63, 64, 65
      ],
      "warn_error": [ 31 ],
      "alerts": { "alerts": [], "complement": true },
      "alerts_error": { "alerts": [], "complement": false }
    }
  },
  "merlin": {
    "build_path": [],
    "source_path": [],
    "cmi_path": [],
    "cmt_path": [],
    "flags_applied": [
      {
        "workdir": "/home/bronsa/src/ai/borsa-italiana-optiq/model",
        "workval": [
          "-open", "Imandra_prelude", "-addsuffix", ".iml:.imli",
          "-assocsuffix", ".iml:imandra"
        ]
      }
    ],
    "extensions": [],
    "suffixes": [
      { "impl": ".iml", "intf": ".imli" },
      { "impl": ".ml", "intf": ".mli" },
      { "impl": ".re", "intf": ".rei" }
    ],
    "stdlib": null,
    "reader": [],
    "protocol": "sexp",
    "log_file": "-",
    "log_sections": [],
    "flags_to_apply": [],
    "failures": [
      "No config found for file \"foo.iml\" in \"model\". Try calling `dune build`."
    ],
    "assoc_suffixes": [
      { "extension": ".iml", "reader": "imandra" },
      { "extension": ".re", "reader": "reason" },
      { "extension": ".rei", "reader": "reason" }
    ]
  },
  "query": {
    "filename": "foo.iml",
    "directory": "/home/bronsa/src/ai/borsa-italiana-optiq/model",
    "printer_width": 0,
    "verbosity": 0
  }
}
# 0.01 Mconfig - normalize
{
  "ocaml": {
    "include_dirs": [],
    "no_std_include": false,
    "unsafe": false,
    "classic": false,
    "principal": false,
    "real_paths": true,
    "recursive_types": false,
    "strict_sequence": false,
    "applicative_functors": true,
    "unsafe_string": false,
    "nopervasives": false,
    "strict_formats": false,
    "open_modules": [ "Imandra_prelude" ],
    "ppx": [],
    "pp": null,
    "warnings": {
      "actives": [
        1, 2, 3, 5, 8, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
        23, 24, 25, 26, 28, 31, 43, 46, 47, 49, 51, 52, 53, 54, 55, 56, 57,
        58, 59, 61, 62, 63, 64, 65
      ],
      "warn_error": [ 31 ],
      "alerts": { "alerts": [], "complement": true },
      "alerts_error": { "alerts": [], "complement": false }
    }
  },
  "merlin": {
    "build_path": [],
    "source_path": [],
    "cmi_path": [],
    "cmt_path": [],
    "flags_applied": [
      {
        "workdir": "/home/bronsa/src/ai/borsa-italiana-optiq/model",
        "workval": [
          "-open", "Imandra_prelude", "-addsuffix", ".iml:.imli",
          "-assocsuffix", ".iml:imandra"
        ]
      }
    ],
    "extensions": [],
    "suffixes": [
      { "impl": ".iml", "intf": ".imli" },
      { "impl": ".ml", "intf": ".mli" },
      { "impl": ".re", "intf": ".rei" }
    ],
    "stdlib": null,
    "reader": [],
    "protocol": "sexp",
    "log_file": "-",
    "log_sections": [],
    "flags_to_apply": [],
    "failures": [
      "No config found for file \"foo.iml\" in \"model\". Try calling `dune build`."
    ],
    "assoc_suffixes": [
      { "extension": ".iml", "reader": "imandra" },
      { "extension": ".re", "reader": "reason" },
      { "extension": ".rei", "reader": "reason" }
    ]
  },
  "query": {
    "filename": "foo.iml",
    "directory": "/home/bronsa/src/ai/borsa-italiana-optiq/model",
    "printer_width": 0,
    "verbosity": 0
  }
}
# 0.01 Pipeline - pop_cache
found entry for this configuration
# 0.01 New_commands - run(query)
{ "command": "errors" }
# 0.01 Mconfig - normalize
{
  "ocaml": {
    "include_dirs": [],
    "no_std_include": false,
    "unsafe": false,
    "classic": false,
    "principal": false,
    "real_paths": true,
    "recursive_types": false,
    "strict_sequence": false,
    "applicative_functors": true,
    "unsafe_string": false,
    "nopervasives": false,
    "strict_formats": false,
    "open_modules": [ "Imandra_prelude" ],
    "ppx": [],
    "pp": null,
    "warnings": {
      "actives": [
        1, 2, 3, 5, 8, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
        23, 24, 25, 26, 28, 31, 43, 46, 47, 49, 51, 52, 53, 54, 55, 56, 57,
        58, 59, 61, 62, 63, 64, 65
      ],
      "warn_error": [ 31 ],
      "alerts": { "alerts": [], "complement": true },
      "alerts_error": { "alerts": [], "complement": false }
    }
  },
  "merlin": {
    "build_path": [],
    "source_path": [],
    "cmi_path": [],
    "cmt_path": [],
    "flags_applied": [
      {
        "workdir": "/home/bronsa/src/ai/borsa-italiana-optiq/model",
        "workval": [
          "-open", "Imandra_prelude", "-addsuffix", ".iml:.imli",
          "-assocsuffix", ".iml:imandra"
        ]
      }
    ],
    "extensions": [],
    "suffixes": [
      { "impl": ".iml", "intf": ".imli" },
      { "impl": ".ml", "intf": ".mli" },
      { "impl": ".re", "intf": ".rei" }
    ],
    "stdlib": null,
    "reader": [],
    "protocol": "sexp",
    "log_file": "-",
    "log_sections": [],
    "flags_to_apply": [],
    "failures": [
      "No config found for file \"foo.iml\" in \"model\". Try calling `dune build`."
    ],
    "assoc_suffixes": [
      { "extension": ".iml", "reader": "imandra" },
      { "extension": ".re", "reader": "reason" },
      { "extension": ".rei", "reader": "reason" }
    ]
  },
  "query": {
    "filename": "foo.iml",
    "directory": "/home/bronsa/src/ai/borsa-italiana-optiq/model",
    "printer_width": 0,
    "verbosity": 0
  }
}
# 0.01 Mreader_extend - parse
?for_completion:None imandra
# 0.01 Mconfig - build_path
2 items in path, 2 after deduplication
# 0.01 Mppx - changing_directory
/home/bronsa/src/ai/borsa-italiana-optiq/model
# 0.01 Mconfig - build_path
2 items in path, 2 after deduplication
# 0.01 File_cache(Cmi_cache) - get_cached_entry
reusing "/home/bronsa/src/ai/borsa-italiana-optiq/_opam/lib/ocaml/stdlib.cmi"
# 0.01 Mtyper - compatible_prefix
reusing 0 items, 1 new items to type
# 0.01 Mreader_extend - stop
imandra
# 0.01 New_merlin - run(result)
{
  "class": "return",
  "value": [
    {
      "type": "config",
      "sub": [],
      "valid": true,
      "message":
        "No config found for file \"foo.iml\" in \"model\". Try calling `dune build`."
    },
    {
      "start": { "line": 1, "col": 14 },
      "end": { "line": 1, "col": 15 },
      "type": "typer",
      "sub": [],
      "valid": true,
      "message": "Unbound module Z"
    }
  ],
  "notifications": [],
  "timing": {
    "clock": 74,
    "cpu": 74,
    "query": 74,
    "pp": 0,
    "reader": 0,
    "ppx": 0,
    "typer": 0,
    "error": 0
  }
}
ewenmaclean commented 1 year ago

thanks a lot!