Skip to content

[BUG]: Spell checker stops flagging errors depending on adjacent words #222

@sagohub

Description

@sagohub

Issue Description

Hey! First of all, thanks for this extension, it's been really helpful for catching typos in my code. I'm using it in Zed with PHP and I think I found a bug.

It seems like the spell checker inconsistently flags errors depending on what comes after (or around) the misspelled word. Here are two scenarios where I reproduced it:


Scenario 1 - Misspelled word inside a string

When the string path ends with an incomplete/invalid word, the error is flagged correctly:

return view('administraton/dashb', $data);

administraton (missing the "i") is correctly underlined. ✔️

Image

But when the path ends with a valid dictionary word, the error disappears:

return view('administraton/dashboard', $data);

administraton is no longer flagged, even though it's still misspelled.

Image

Expected result:

Image

Scenario 2 - Misspelled segment in a camelCase function name

When the function name ends with an incomplete/invalid word, the error is flagged:

public function getConseGroupSal() // I left out the 'e' in Sal()

Conse is correctly underlined. ✔️

Image

But when the function ends with a valid word, the error disappears:

public function getConseGroupSale()

Conse is no longer flagged.

Image

Expected result:

Image

Expected behavior
A misspelled word/token should be flagged regardless of what comes before or after it. The validity of adjacent tokens shouldn't affect the detection of an already-invalid one.

Environment

  • Editor: Zed
  • Language tested: PHP
  • Extension: codebook

Operating System

Windows

Editor

Zed

Codebook Version

0.3.31

Configuration

dictionaries = ["en_us"]

ignore_paths = ["target/**/*", "**/*.json", ".git/**/*"]

ignore_patterns = [
    '\b[ATCG]+\b',             # DNA sequences
    '\d{3}-\d{2}-\d{4}',       # Social Security Number format
    '^[A-Z]{2,}$',             # All caps words like "HTML", "CSS"
    'https?://[^\s]+'          # URLs
]

Steps to Reproduce

Open a PHP file

Expected Behavior

Image
Image

Actual Behavior

Scenario 1

Image Image

Scenario 2

Image Image

Code Sample

Scenario 1

return view('administraton/dashb', $data);
return view('administraton/dashboard', $data);


Scenario 2


public function getConseGroupSal() {}
public function getConseGroupSale() {}

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