ppx rewriter - current file path as the cwd
instead of the project root
#1173
Unanswered
anentropic
asked this question in
Q&A
Replies: 2 comments
-
I tried adding "ocaml.sandbox": {
"kind": "opam",
"switch": "${workspaceFolder:my-project}",
"root": "/Users/anentropic/Documents/Dev/my-project-root"
}, but it didn't help, even after closing and re-opening the IDE |
Beta Was this translation helpful? Give feedback.
0 replies
-
The workspace might help with that: https://code.visualstudio.com/docs/editor/workspaces |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I made a ppx extension rewriter
It takes a string constant as an arg, representing a file path.
If I use a relative path like
[%myppx "lib/myppx/data.json"]
then I get a red underline in VS Code, with the error:(this code would be in say
lib/myproject/some.ml
)However I can compile and run my code via
dune
no problem.VS Code project was opened from my project root.
So the issue seems to be that ocamllsp doesn't have the project root as the
cwd
?If I change the path to
[%myppx "../myppx/data.json"]
then ocamllsp is happy, but I can no longer build indune
. This implies ocamllsp is using the current file path as thecwd
instead of the project root.Is there a config setting I can use to fix this?
Beta Was this translation helpful? Give feedback.
All reactions