Closed sangwoo-joh closed 11 months ago
Hi! Happy to help.
I believe this is the root issue:
Error retrieving language configuration for scope 'source.cpp': Language not found
I think you still need to add some Tree Sitter language parsers to your project so that this tool can find and use them. Unlike many syntax highlighters with built-in support for many popular languages, Tree Sitter relies on external language parser libraries to understand the grammar of each language. For example, tree-sitter/tree-sitter-cpp is the project for the Tree Sitter C++ parser library. More information on how that applies to this tool can be found here in the README, but feel free to let me know if you're still confused.
Also, I happen to know that it is especially complicated to set up the C++ parser library in particular, because that Tree Sitter grammar has a dependency on the Tree Sitter C grammar. It is possible to get it to work but I might suggest trying to get things working with basically any other language first.
Wow, thank you for the gentle explanation!!
As you said, I missed the README part.
I made ~/tree_sitter_parers
directory and cloned tree-sitter-c
, tree-sitter-cpp
, tree-sitter-python
. This time, I got different error message:
Jekyll Feed: Generating feed for posts
Conversion error: Jekyll::Converters::Markdown encountered an error while converting '_posts/2018-07-08-avl-tree.md':
Failed to read query file "node_modules/tree-sitter-c/queries/highlights.scm": No such file or directory (os error 2)
------------------------------------------------
Jekyll 4.2.0 Please append `--trace` to the `build` command
for any additional information or backtrace.
------------------------------------------------
Traceback (most recent call last):
46: from /Users/sangwoo-joh/.rbenv/versions/2.7.7/bin/bundle:23:in `<main>'
45: from /Users/sangwoo-joh/.rbenv/versions/2.7.7/bin/bundle:23:in `load'
44: from /Users/sangwoo-joh/.gems/gems/bundler-2.4.4/exe/bundle:33:in `<top (required)>'
43: from /Users/sangwoo-joh/.gems/gems/bundler-2.4.4/lib/bundler/friendly_errors.rb:117:in `with_friendly_errors'
42: from /Users/sangwoo-joh/.gems/gems/bundler-2.4.4/exe/bundle:45:in `block in <top (required)>'
41: from /Users/sangwoo-joh/.gems/gems/bundler-2.4.4/lib/bundler/cli.rb:28:in `start'
40: from /Users/sangwoo-joh/.gems/gems/bundler-2.4.4/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
39: from /Users/sangwoo-joh/.gems/gems/bundler-2.4.4/lib/bundler/cli.rb:34:in `dispatch'
38: from /Users/sangwoo-joh/.gems/gems/bundler-2.4.4/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
37: from /Users/sangwoo-joh/.gems/gems/bundler-2.4.4/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
36: from /Users/sangwoo-joh/.gems/gems/bundler-2.4.4/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
35: from /Users/sangwoo-joh/.gems/gems/bundler-2.4.4/lib/bundler/cli.rb:491:in `exec'
34: from /Users/sangwoo-joh/.gems/gems/bundler-2.4.4/lib/bundler/cli/exec.rb:23:in `run'
33: from /Users/sangwoo-joh/.gems/gems/bundler-2.4.4/lib/bundler/cli/exec.rb:58:in `kernel_load'
32: from /Users/sangwoo-joh/.gems/gems/bundler-2.4.4/lib/bundler/cli/exec.rb:58:in `load'
31: from /Users/sangwoo-joh/.gems/bin/jekyll:23:in `<top (required)>'
30: from /Users/sangwoo-joh/.gems/bin/jekyll:23:in `load'
29: from /Users/sangwoo-joh/.gems/gems/jekyll-4.2.0/exe/jekyll:15:in `<top (required)>'
28: from /Users/sangwoo-joh/.gems/gems/mercenary-0.4.0/lib/mercenary.rb:21:in `program'
27: from /Users/sangwoo-joh/.gems/gems/mercenary-0.4.0/lib/mercenary/program.rb:44:in `go'
26: from /Users/sangwoo-joh/.gems/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `execute'
25: from /Users/sangwoo-joh/.gems/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `each'
24: from /Users/sangwoo-joh/.gems/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `block in execute'
23: from /Users/sangwoo-joh/.gems/gems/jekyll-4.2.0/lib/jekyll/commands/build.rb:18:in `block (2 levels) in init_with_program'
22: from /Users/sangwoo-joh/.gems/gems/jekyll-4.2.0/lib/jekyll/command.rb:91:in `process_with_graceful_fail'
21: from /Users/sangwoo-joh/.gems/gems/jekyll-4.2.0/lib/jekyll/command.rb:91:in `each'
20: from /Users/sangwoo-joh/.gems/gems/jekyll-4.2.0/lib/jekyll/command.rb:91:in `block in process_with_graceful_fail'
19: from /Users/sangwoo-joh/.gems/gems/jekyll-4.2.0/lib/jekyll/commands/build.rb:36:in `process'
18: from /Users/sangwoo-joh/.gems/gems/jekyll-4.2.0/lib/jekyll/commands/build.rb:65:in `build'
17: from /Users/sangwoo-joh/.gems/gems/jekyll-4.2.0/lib/jekyll/command.rb:28:in `process_site'
16: from /Users/sangwoo-joh/.gems/gems/jekyll-4.2.0/lib/jekyll/site.rb:80:in `process'
15: from /Users/sangwoo-joh/.gems/gems/jekyll-4.2.0/lib/jekyll/site.rb:210:in `render'
14: from /Users/sangwoo-joh/.gems/gems/jekyll-4.2.0/lib/jekyll/site.rb:530:in `render_docs'
13: from /Users/sangwoo-joh/.gems/gems/jekyll-4.2.0/lib/jekyll/site.rb:530:in `each_value'
12: from /Users/sangwoo-joh/.gems/gems/jekyll-4.2.0/lib/jekyll/site.rb:531:in `block in render_docs'
11: from /Users/sangwoo-joh/.gems/gems/jekyll-4.2.0/lib/jekyll/site.rb:531:in `each'
10: from /Users/sangwoo-joh/.gems/gems/jekyll-4.2.0/lib/jekyll/site.rb:532:in `block (2 levels) in render_docs'
9: from /Users/sangwoo-joh/.gems/gems/jekyll-4.2.0/lib/jekyll/site.rb:547:in `render_regenerated'
8: from /Users/sangwoo-joh/.gems/gems/jekyll-4.2.0/lib/jekyll/renderer.rb:63:in `run'
7: from /Users/sangwoo-joh/.gems/gems/jekyll-4.2.0/lib/jekyll/renderer.rb:84:in `render_document'
6: from /Users/sangwoo-joh/.gems/gems/jekyll-4.2.0/lib/jekyll/renderer.rb:104:in `convert'
5: from /Users/sangwoo-joh/.gems/gems/jekyll-4.2.0/lib/jekyll/renderer.rb:104:in `reduce'
4: from /Users/sangwoo-joh/.gems/gems/jekyll-4.2.0/lib/jekyll/renderer.rb:104:in `each'
3: from /Users/sangwoo-joh/.gems/gems/jekyll-4.2.0/lib/jekyll/renderer.rb:106:in `block in convert'
2: from /Users/sangwoo-joh/.gems/gems/jekyll-4.2.0/lib/jekyll/converters/markdown.rb:85:in `convert'
1: from /Users/sangwoo-joh/.gems/gems/jekyll-4.2.0/lib/jekyll/cache.rb:109:in `getset'
/Users/sangwoo-joh/.gems/gems/jekyll-4.2.0/lib/jekyll/cache.rb:88:in `[]': unhandled exception
59: from /Users/sangwoo-joh/.rbenv/versions/2.7.7/bin/bundle:23:in `<main>'
58: from /Users/sangwoo-joh/.rbenv/versions/2.7.7/bin/bundle:23:in `load'
57: from /Users/sangwoo-joh/.gems/gems/bundler-2.4.4/exe/bundle:33:in `<top (required)>'
56: from /Users/sangwoo-joh/.gems/gems/bundler-2.4.4/lib/bundler/friendly_errors.rb:117:in `with_friendly_errors'
55: from /Users/sangwoo-joh/.gems/gems/bundler-2.4.4/exe/bundle:45:in `block in <top (required)>'
54: from /Users/sangwoo-joh/.gems/gems/bundler-2.4.4/lib/bundler/cli.rb:28:in `start'
53: from /Users/sangwoo-joh/.gems/gems/bundler-2.4.4/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
52: from /Users/sangwoo-joh/.gems/gems/bundler-2.4.4/lib/bundler/cli.rb:34:in `dispatch'
51: from /Users/sangwoo-joh/.gems/gems/bundler-2.4.4/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
50: from /Users/sangwoo-joh/.gems/gems/bundler-2.4.4/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
49: from /Users/sangwoo-joh/.gems/gems/bundler-2.4.4/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
48: from /Users/sangwoo-joh/.gems/gems/bundler-2.4.4/lib/bundler/cli.rb:491:in `exec'
47: from /Users/sangwoo-joh/.gems/gems/bundler-2.4.4/lib/bundler/cli/exec.rb:23:in `run'
46: from /Users/sangwoo-joh/.gems/gems/bundler-2.4.4/lib/bundler/cli/exec.rb:58:in `kernel_load'
45: from /Users/sangwoo-joh/.gems/gems/bundler-2.4.4/lib/bundler/cli/exec.rb:58:in `load'
44: from /Users/sangwoo-joh/.gems/bin/jekyll:23:in `<top (required)>'
43: from /Users/sangwoo-joh/.gems/bin/jekyll:23:in `load'
42: from /Users/sangwoo-joh/.gems/gems/jekyll-4.2.0/exe/jekyll:15:in `<top (required)>'
41: from /Users/sangwoo-joh/.gems/gems/mercenary-0.4.0/lib/mercenary.rb:21:in `program'
40: from /Users/sangwoo-joh/.gems/gems/mercenary-0.4.0/lib/mercenary/program.rb:44:in `go'
39: from /Users/sangwoo-joh/.gems/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `execute'
38: from /Users/sangwoo-joh/.gems/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `each'
37: from /Users/sangwoo-joh/.gems/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `block in execute'
36: from /Users/sangwoo-joh/.gems/gems/jekyll-4.2.0/lib/jekyll/commands/build.rb:18:in `block (2 levels) in init_with_program'
35: from /Users/sangwoo-joh/.gems/gems/jekyll-4.2.0/lib/jekyll/command.rb:91:in `process_with_graceful_fail'
34: from /Users/sangwoo-joh/.gems/gems/jekyll-4.2.0/lib/jekyll/command.rb:91:in `each'
33: from /Users/sangwoo-joh/.gems/gems/jekyll-4.2.0/lib/jekyll/command.rb:91:in `block in process_with_graceful_fail'
32: from /Users/sangwoo-joh/.gems/gems/jekyll-4.2.0/lib/jekyll/commands/build.rb:36:in `process'
31: from /Users/sangwoo-joh/.gems/gems/jekyll-4.2.0/lib/jekyll/commands/build.rb:65:in `build'
30: from /Users/sangwoo-joh/.gems/gems/jekyll-4.2.0/lib/jekyll/command.rb:28:in `process_site'
29: from /Users/sangwoo-joh/.gems/gems/jekyll-4.2.0/lib/jekyll/site.rb:80:in `process'
28: from /Users/sangwoo-joh/.gems/gems/jekyll-4.2.0/lib/jekyll/site.rb:210:in `render'
27: from /Users/sangwoo-joh/.gems/gems/jekyll-4.2.0/lib/jekyll/site.rb:530:in `render_docs'
26: from /Users/sangwoo-joh/.gems/gems/jekyll-4.2.0/lib/jekyll/site.rb:530:in `each_value'
25: from /Users/sangwoo-joh/.gems/gems/jekyll-4.2.0/lib/jekyll/site.rb:531:in `block in render_docs'
24: from /Users/sangwoo-joh/.gems/gems/jekyll-4.2.0/lib/jekyll/site.rb:531:in `each'
23: from /Users/sangwoo-joh/.gems/gems/jekyll-4.2.0/lib/jekyll/site.rb:532:in `block (2 levels) in render_docs'
22: from /Users/sangwoo-joh/.gems/gems/jekyll-4.2.0/lib/jekyll/site.rb:547:in `render_regenerated'
21: from /Users/sangwoo-joh/.gems/gems/jekyll-4.2.0/lib/jekyll/renderer.rb:63:in `run'
20: from /Users/sangwoo-joh/.gems/gems/jekyll-4.2.0/lib/jekyll/renderer.rb:84:in `render_document'
19: from /Users/sangwoo-joh/.gems/gems/jekyll-4.2.0/lib/jekyll/renderer.rb:104:in `convert'
18: from /Users/sangwoo-joh/.gems/gems/jekyll-4.2.0/lib/jekyll/renderer.rb:104:in `reduce'
17: from /Users/sangwoo-joh/.gems/gems/jekyll-4.2.0/lib/jekyll/renderer.rb:104:in `each'
16: from /Users/sangwoo-joh/.gems/gems/jekyll-4.2.0/lib/jekyll/renderer.rb:106:in `block in convert'
15: from /Users/sangwoo-joh/.gems/gems/jekyll-4.2.0/lib/jekyll/converters/markdown.rb:85:in `convert'
14: from /Users/sangwoo-joh/.gems/gems/jekyll-4.2.0/lib/jekyll/cache.rb:108:in `getset'
13: from /Users/sangwoo-joh/.gems/gems/jekyll-4.2.0/lib/jekyll/cache.rb:111:in `rescue in getset'
12: from /Users/sangwoo-joh/.gems/gems/jekyll-4.2.0/lib/jekyll/converters/markdown.rb:86:in `block in convert'
11: from /Users/sangwoo-joh/.gems/gems/jekyll-4.2.0/lib/jekyll/converters/markdown/kramdown_parser.rb:110:in `convert'
10: from /Users/sangwoo-joh/.gems/gems/jekyll-4.2.0/lib/jekyll/converters/markdown/kramdown_parser.rb:62:in `to_html'
9: from /Users/sangwoo-joh/.gems/gems/kramdown-2.3.1/lib/kramdown/converter/base.rb:107:in `convert'
8: from /Users/sangwoo-joh/.gems/gems/kramdown-2.3.1/lib/kramdown/converter/html.rb:58:in `convert'
7: from /Users/sangwoo-joh/.gems/gems/kramdown-2.3.1/lib/kramdown/converter/html.rb:373:in `convert_root'
6: from /Users/sangwoo-joh/.gems/gems/kramdown-2.3.1/lib/kramdown/converter/html.rb:70:in `inner'
5: from /Users/sangwoo-joh/.gems/gems/kramdown-2.3.1/lib/kramdown/converter/html.rb:70:in `each'
4: from /Users/sangwoo-joh/.gems/gems/kramdown-2.3.1/lib/kramdown/converter/html.rb:71:in `block in inner'
3: from /Users/sangwoo-joh/.gems/gems/kramdown-2.3.1/lib/kramdown/converter/html.rb:115:in `convert_codeblock'
2: from /Users/sangwoo-joh/.gems/gems/kramdown-2.3.1/lib/kramdown/converter/base.rb:197:in `highlight_code'
1: from /Users/sangwoo-joh/.gems/gems/kramdown-syntax_tree_sitter-0.5.0/lib/kramdown/converter/syntax_highlighter/tree_sitter.rb:22:in `call'
/Users/sangwoo-joh/.gems/gems/kramdown-syntax_tree_sitter-0.5.0/lib/kramdown/converter/syntax_highlighter/tree_sitter.rb:22:in `highlight': Failed to read query file "node_modules/tree-sitter-c/queries/highlights.scm": No such file or directory (os error 2) (RuntimeError)
I also tried to install npm install tree-sitter tree-sitter-cli tree-sitter-{lang}
with -g
and without -g
, but it won't work.
Thank you!
I think you're now encountering the issue that makes the Tree Sitter C++ parser particularly complicated to use; namely, that it has a dependency on the Tree Sitter C parser, and that this dependency is not resolved by default. One successful workaround I have personally used is to symbolically link the Tree Sitter C++ node_modules
directory to the tree-sitter-parsers
directory that you created, for example via the following command:
ln -s .. ~/tree_sitter_parsers/tree-sitter-cpp/node_modules
This is what I do for my own Jekyll-based site, as described here. Hopefully that will work for you too!
Thank you! Ok.. Sorry to keep bothering you :sweat_smile: I've referenced your site's config.
kramdown:
syntax_highlighter: tree-sitter
syntax_highlighter_opts:
tree_sitter_parsers_dir: tree_sitter_parsers
I cloned every language I've written into this directory in my project. I then ran ln -s .. ~/tree_sitter_parsers/tree-sitter-cpp/node_modules
in the project's root.
Now I got the following message:
....
3: from /var/lib/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/reader.rb:52:in `block in read_directories'
2: from /var/lib/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/utils.rb:141:in `has_yaml_header?'
1: from /var/lib/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/utils.rb:141:in `open'
/var/lib/gems/2.7.0/gems/jekyll-4.1.1/lib/jekyll/utils.rb:141:in `initialize': Too many levels of symbolic links @ rb_sysopen - /home/sangwoo-joh/type/personal/sangwoo-joh.github.io/tree_sitter_parsers/tree-sitter-cpp/node_modules/tree-sitter-cpp/node_modules/tree-sitter-cpp/node_modules/tree-sitter-cpp/node_modules/tree-sitter-cpp/node_modules/tree-sitter-cpp/node_modules/tree-sitter-cpp/node_modules/tree-sitter-cpp/node_modules/tree-sitter-cpp/node_modules/tree-sitter-cpp/node_modules/tree-sitter-cpp/node_modules/tree-sitter-cpp/node_modules/tree-sitter-cpp/node_modules/tree-sitter-cpp/node_modules/tree-sitter-cpp/node_modules/tree-sitter-cpp/node_modules/tree-sitter-cpp/node_modules/tree-sitter-cpp/node_modules/tree-sitter-cpp/node_modules/tree-sitter-cpp/node_modules/tree-sitter-cpp/node_modules/tree-sitter-cpp/node_modules/tree-sitter-cpp/node_modules/tree-sitter-cpp/node_modules/tree-sitter-cpp/node_modules/tree-sitter-cpp/node_modules/tree-sitter-cpp/node_modules/tree-sitter-cpp/node_modules/tree-sitter-cpp/node_modules/tree-sitter-cpp/node_modules/tree-sitter-cpp/node_modules/tree-sitter-cpp/node_modules/tree-sitter-cpp/node_modules/tree-sitter-cpp/node_modules/tree-sitter-cpp/node_modules/tree-sitter-cpp/node_modules/tree-sitter-cpp/node_modules/tree-sitter-cpp/node_modules/tree-sitter-cpp/node_modules/tree-sitter-cpp/node_modules/tree-sitter-cpp/node_modules (Errno::ELOOP)
What am I missing? :cry:
Hmm that doesn't look so good.
I'm not exactly sure how your site is structured, but if my hunch is correct then think I encountered a similar issue in the past and solved it like this. Namely, I added the Tree Sitter parsers directory to my Jekyll exclude list so that Jekyll wouldn't traverse it while building my site. Maybe something similar will work for you?
Hmm that doesn't look so good.
I'm not exactly sure how your site is structured, but if my hunch is correct then think I encountered a similar issue in the past and solved it like this. Namely, I added the Tree Sitter parsers directory to my Jekyll exclude list so that Jekyll wouldn't traverse it while building my site. Maybe something similar will work for you?
Wow, thank you very much!! Finally I successfully built my blog!! And syntax highlighting with your plugin looks so great. Thank you!!
Hi. Thanks for this great plugin.
I'm trying to figure this out with my blog, but I failed to compile my jekyll blog. Here is the error log.
It seems like every language shows the same error.
I'm using
rustc
1.73.0,ruby
2.7.0p0 andjekyll
4.1.1 version.Here is my Gemfile:
, and my
_config.yml
:How do I fix this error? Looking forward to hearing.