The syntax highlighting in Emacs is not great so I installed tree-sitter plugin to improve it and configured it like this,

;; Tree sitter
(use-package! tree-sitter
  (require 'tree-sitter-langs)
  (add-hook 'tree-sitter-after-on-hook #'tree-sitter-hl-mode))

It does work, but for some reason certain keywords like a call to a class method show up as font weight of bold, when they should show as normal weight.

enter image description here

As you can see all #include statements show as bold here and,

enter image description here

These methods also show as bold.

Is there a way to make them normal weight, without turning off the bold weight globally?

1 Answer 1


tree-sitter appears to be using the default faces for syntax highlighting. You can find out what face is applied by putting point (the cursor) on to the highlighted word, and calling M-x describe-face. The default value is the face applied to the word at point. You can then use that value to customize the face, where you will have the option of removing the bold-weight.

For example, if describe-face tells me I'm looking at font-lock-keyword-face, I can customize how it appears with M-x customize-face font-lock-keyword-face.

  • In my case if I highlight over the word that is shown bold and run describe face, it says the face is lsp-face-highlight-textual, which I tried to change, and it looks like it only changes the weight when the word is highlighted, as in when you put the cursor over the word and all the other similar words in view get highlighted as well. But if I move the cursor to another word its back to bold.
    – apoorv569
    May 26, 2021 at 19:46
  • That means which face is applied changes depending on whether or not the cursor is on the word. If you turn off lsp-mode, perhaps describe-face will tell you the right face to alter. Otherwise, you can browse through the faces provided by tree-sittter: M-x customize-group tree-sitter-hl, or maybe M-x customize-group tree-sitter-hl-faces
    – Tyler
    Jun 25, 2021 at 20:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.