Skip to content

[BUG]: No spellchecking inside the JSX portions of a TSX file #226

@cmachetzki

Description

@cmachetzki

Issue Description

Codebook will spellcheck TSX files but not any portion that is JSX. In the example below spelling in the comment is flagged but not inside the div.

function App() {
  // sfdf test
  return <div>Hello sdfsf world? </div>
}

I originally assumed this was a problem with my LazyVim config, so I had AI look at the config. It said the problem is in Codebook. I don't know much about Rust or Treesitter. but looking through things the following does seem plausible:

This is an upstream bug in codebook-lsp, not a problem with your Neovim config.

Codebook uses Tree-sitter to parse files and only spellchecks specific AST nodes (comments, strings, variable names, JSX text, etc.). The tree-sitter-typescript crate exposes two separate grammars:

  • LANGUAGE_TYPESCRIPT — for .ts files
  • LANGUAGE_TSX — for .tsx files (includes JSX syntax)

Codebook maps both typescript and typescriptreact to LANGUAGE_TYPESCRIPT, which cannot parse JSX syntax. The JSX portions become parse errors, the Tree-sitter queries fail to match any nodes, and you get zero diagnostics.

Operating System

Linux (Arch)

Editor

Neovim

Codebook Version

0.3.32

Configuration

Steps to Reproduce

Just run codebook on the following TSX file:

function App() {
  // sfdf test
  return <div>Hello sdfsf world? </div>
}

Expected Behavior

Spellchecking inside JSX.

Actual Behavior

No spellchecking inside JSX.

Code Sample


Log Output

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions