jaredly / jaredly/reason-language-server

Parse dune variable expansions

Open
#150 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
OCaml
Stars
649
Forks
85
PR merge metrics
No merged PRs in 30d

Description

I've been trying to use RLS while working on the dune project with each release. Comments work now, but there still seem to be some issues with parsing the dune files. I get the following error on opening the project now:

```
Unable to parse build file /home/zach/src/dune/src/jbuild
Unexpected char: % at 356
```

This is the contents of the dune file at path `~/src/dune/src/dune`:

```dune
(library
(name dune)
(libraries unix
stdune
fiber
xdg
dune_re
threads
opam_file_format
dune_lang
ocaml_config
which_program)
(synopsis "Internal Dune library, do not use!")
(preprocess (action
(run %{project_root}/src/let-syntax/pp.exe %{input-file}))))

(ocamllex meta_lexer glob_lexer dune_lexer)

(rule
(targets setup.ml)
(mode fallback)
(action (copy# setup.defaults.ml setup.ml)))
```

Looks like we're not yet handling the [variable expansions](https://dune.readthedocs.io/en/latest/dune-files.html?highlight=variable#variables-expansion) of the form `%{variable}`.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the reported src/dune example and the linked Dune variable-expansion documentation, then reproduce the unexpected '%' at position 356 while opening the project. Done means Dune files containing %{variable} expansions parse without this error.

Written by the indexing model from the issue text.

Assessment

Tech stack
ocaml
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.