jaredly / jaredly/reason-language-server

Syntax highlighting incorrect with "bs" attributes on records

Open
#325 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
OCaml
Stars
649
Forks
85
PR merge metrics
No merged PRs in 30d

Description

Example from the bucklescript docs, where `deriving abstract` is used to map a record type to an object:
https://bucklescript.github.io/docs/en/object#optional-labels

```
[@bs.deriving abstract]
type person = {
[@bs.optional] name: string,
age: int,
job: string,
};
```

Screenshot of the same (I'm using flatland monokai theme):
![optional deriving field](https://user-images.githubusercontent.com/298292/63940047-f4900700-ca68-11e9-9780-e79fe3d323fc.png)

Note how `bs` picks up the field name highlighting which breaks all highlighting before the `:`

There are many possible attributes, all break the same way. I'm using `[@bs.as]` to rename a field.

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the BuckleScript record example from the linked documentation, including [@bs.deriving abstract] and [@bs.optional], in the language server's editor integration. Inspect how Reason attributes are tokenized and verify that the bs attribute does not consume the following field name or disrupt highlighting before the colon. Done means the shown attributes and the surrounding record fields receive correct syntax highlighting.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.