Skip to content

feat: add typo suggestions for types, contracts and top-level keywords - #3309

Open
R-Camacho wants to merge 8 commits into
c3lang:masterfrom
R-Camacho:better-syntax-errors
Open

feat: add typo suggestions for types, contracts and top-level keywords#3309
R-Camacho wants to merge 8 commits into
c3lang:masterfrom
R-Camacho:better-syntax-errors

Conversation

@R-Camacho

Copy link
Copy Markdown
Contributor
  • Introduce SuggestionKeywords to hold lists of keywords.
  • Add suggestion_init() to populate these lists.
  • Implement typo suggestions for:
  • Top-level declarations;
  • Base types;
  • Contract parameter names.
  • Move damerau_levenshtein_distance to stringutils.c.
  • Add str_find_closest to stringutils.c.
  • Add tests for implemented suggestions.

Closes #1420

- Introduce `SuggestionKeywords` to hold lists of keywords.
- Add `suggestion_init()` to populate these lists.
- Implement typo suggestions for:
- Top-level declarations;
- Base types;
- Contract parameter names.
- Move `damerau_levenshtein_distance` to `stringutils.c`.
- Add `str_find_closest` to `stringutils.c`.
- Add tests for implemented suggestions.

Closes c3lang#1420

Signed-off-by: Tomás Lopes <tomasrlopes@tecnico.ulisboa.pt>
Signed-off-by: Rodrigo Camacho <rodrigompcamacho@tecnico.ulisboa.pt>
Co-authored-by: Rodrigo Camacho <rodrigompcamacho@tecnico.ulisboa.pt>
@lerno

lerno commented Jun 10, 2026

Copy link
Copy Markdown
Collaborator

Pushed to 0.8.2

Comment thread src/compiler/compiler.c Outdated
Comment thread src/compiler/compiler.c Outdated
Comment thread src/compiler/sema_decls.c Outdated
@R-Camacho

Copy link
Copy Markdown
Contributor Author

Hi @lerno, thanks for the review! We have applied your suggestions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve error messages when keywords are misspelled

3 participants