is there a specific action required to enable it? The outline in my VSCode is still empty when I open .res and .resi files
Ok my bad. it was disabled again just before release since vscode shows stale data (vscode’s issue).
You are probably talking about JSX syntax highlighting, right? There’s no active work on that, but we’d consider any PR that doesn’t compromise on grammar correctness and doesn’t involve a lot of hard to maintain regexes. Biggest challenge afaik was collisions with generics and lower-cased JSX syntax. Also see this PR for inspiration.
The outline was disabled because it seems to be running into staleness issues (more details here). If you don’t care about a correct outline, you can monkey-patch it by going into your local plugin installation (~/.vscode/extensions/chenglou92.rescript-vscode-1.1.3
) and uncommenting the following line:
aw ok, I will wait then. I appreciate it that you disabled it until it is
How can one use the intelligent renaming feature using vim? I don’t see any vim command available for it. Thanks!
Unfortunately there’s no rescript-vim
-only command for that right now, so you’d need to use a vim LSP client to use it.
E.g. for coc-vim
I created a binding like this:
nmap <leader>rn <Plug>(coc-rename)
Now with this configuration enabled I can put my cursor on top of e.g. a binding name, press \rn
, and a dialog pops up.
@ryyppy Having JSX syntax highlighting would be marvelous but as you pointed out, getting it to work without bloating the grammar file will not be that easy
I had in mind other small changes that might improve syntax highlight for example: punctuation or record/object.
Something like this in here: Add type, external, let word coloring && unit as constant by Faliszek · Pull Request #85 · rescript-lang/rescript-vscode · GitHub - Is highlighting those parts of the language is on yours roadmap?
We don’t have any concrete plans to the syntax highlighting right now (usually our editor-support updates are rather low-key in comparison to the rest of the v10 roadmap).
I’ll have a look how we could have some progress there that works for everybody.
This (related) issue is a big reason I’m hesitant to start introducing ReScript code to my codebase
One of the big reasons to not adopt ReScript syntax is because of a TM grammar? I thought your major blocking issues are on the syntactic / language philosophy / political level…
If that’s such a big problem, for now I’d just recommend taking one of the PR’ed (but flawed) highlighting grammars and set it up on a company level. I mean it’s just a single config file that can easily be installed with a single curl command (that probably needs to be re-run every few months when we release a new plugin version)
It’s because of the screenshot I posted in my issue.
I am big on developer experience. I’ve worked on some very large codebases and our ReasonML codebase is well north of 80,000 lines of code now. Everyone is different, but I don’t understand how anyone can work on a large codebase when so much of the syntax is the same colour. It makes mentally figuring out what you’re looking at so much harder.
I also believe I will struggle to convince TypeScript developers on my team that ReScript has a better developer experience when the first thing they see is worse syntax highlighting.
TM grammars have a lot of problems, but the vscode plugin’s approach to highlighting is starting to come across as “perfect is the enemy of good”.
It’s a bit off topic here and I’ve been meaning to send you a private message about it. We’re approaching a go/no-go decision on rolling out something and while melange is a cool idea we can’t wait for it to get where we would need it to be. We need to make a choice and regardless of our other concerns ReScript seems to be the way to go.
That might work. I could even set up a command in our vscode workspace for it.
100% this.
I am right now far from working on Rescript codebase (maybe in the future(?)) but back in the days working with Bucklescript was marvellous experience. But from marketing point of view, this experience is not something that is seen from new developers introduced to Rescript (especially without experience functional/typed safe language) right away, for me the biggest selling point was ease of refactoring, but to get to this point you have to have some code to refactor, and most of the people will not be keen to even try it, if they are thrown off by a little details like this, people are really picky these days, especially when they can not see a big picture of value that rescript might provide. First impression really matters. I am really looking forward to see Rescript taking mainstream someday. Not saying you should change your roadmap. You do what you do best, and you have amazing results. Just my point of view, I hope it might be somehow helpful
Ouch.
Just kidding
Looking forward to next updates!
I think we all are! Our codebase is currently heading towards 50k LOC of ReScript. Highlighting is not perfect, but I think so far nobody threatened to migrate back to JS + Flow just because of the more colorful syntax.
Sorry if that sounded harsh. I wanted to be clear that all these changes are based on trade-offs and that it’s not that easy, otherwise the problem would have been solved a long time ago
if they are thrown off by a little details like this
I think it’s at least as distracting having wrong highlighting than no highlighting… but that’s probably just an opinion. Really hard to tell what is the correct way to do it, especially in situations where not only the grammar can be faulty, but also the color theme itself may cause issues
Anyways, we’ll see how things will improve in the future!
Our codebase is currently heading towards 50k LOC of ReScript. Highlighting is not perfect, but I think so far nobody threatened to migrate back to JS + Flow just because of the more colorful syntax.
Maybe once you’re deep into ReScript it’s fine. But in the last few years TypeScript has improved to the point where I’m getting a lot of pushback to the idea that ReScript is better. Little nitpicky things like this might be enough to sway the argument against it.
I have been using the patch you suggested to show the outline and it works pretty decent. It is definitely more useful than without it.
I wonder if having this patch on locally will prevent VSCode from updating this extension
You can use your own copy and rebase from upstream’s master to get latest updates.
Migrating from ReasonML codebase to Rescript felt like a major downgrade, the IDE with the current highlighting feels like I’m editing in notepad, it takes a lot of mental effort to process that exactly is going on.
Can we vote on the proposed PR or something? It’s been 8 months… Having flawed highliting is better than having none at all, grammar correctness is good and all but at the current state of affairs it almost feels like the IDE integration is broken.
Hi, thanks for the feedback. Do you mean this issue Add type, external, let word coloring && unit as constant by Faliszek · Pull Request #85 · rescript-lang/rescript-vscode (github.com) in particular?
Hi Hongbo, on unrelated note, thanks for amazing work you’ve done for the community, been using ReasonML for the last three years and really appreciate your efforts, really enjoyed it.
Yep, that’s the PR I’ve been talking about.
Indeed, it seems that the editor repo needs some more love from contributors.
The core part of editor plugin (the semantics part) is maintained by @cristianoc while the syntax highlighting part used to be maintained by @chenglou .
In general, we need some more maintainers to help, if you have some experience in past contributions and would like to share some responsibilities, you are welcome to PM so that we can share some workload with each other.