Skip to content

Error discrepancy between dune build and ocaml-lsp for ppx expressions #1543

@RaoulHC

Description

@RaoulHC

For ppx's that deal with filepaths, you can often get errors reported in the lsp even though dune build reports nothing.

For the following contrived example using ppx_blob
lib/dune:

(library
 (name ppx_lsp_issue)
 (preprocess
  (pps ppx_blob))
 (preprocessor_deps ../dune-project))

lib/test.ml

let test = [%blob "lib/test.ml"]
let test_2 = [%blob "dune-project"]

dune build reports no errors, however ocamllsp reports errors with [%blob] could not find or load file (lib/test|dune-project).

You can use [%blob "test.ml"] and [%blob "dune-project"] because the extension handles relative paths as well, but I'm unsure anything should be different in ocamllsp. In this something extensions should handle better, or is there something in ocamllsp could be doing differently? Happy to dig into the source code if I'm given some pointers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions