react-diff-view: TypeError when trying to use `tokenize()` to highlight code
Hi,
I am not sure how much information I can provide but I am not able to make the syntax highlighting work with the version 2.0
of this lib. I use tokenize()
and the following options
:
const options = {
highlight: true,
language: 'js',
refractor: refractor,
};
refractor
is imported via:
import refractor from 'refractor';
Simply logging the result of tokenize()
fails:
console.log({ tokens: tokenize(hunks, options) });
If I set highlight
to false
in options
, I get the tokens
, but with highlighting enabled, I also get a TypeError
:
i is not a function
Because I use the npm package, I don’t have more information. I tried to debug and I know that it works until after this line: https://github.com/otakustay/react-diff-view/blob/6aa5399c52392e19f7f8fbe4af17b374b4339862/src/tokenize/index.js#L15. The toTokenTrees
returns similar results with highlight
set to true
or false
.
I am hoping that you might have ideas. 🤞
Thanks!
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 18 (6 by maintainers)
My fault, failed to merge this fix to master,
2.1.2
should fix