Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support dashes in default.extend-identifiers #646

Closed
cbachhuber opened this issue Jan 1, 2023 · 5 comments
Closed

Support dashes in default.extend-identifiers #646

cbachhuber opened this issue Jan 1, 2023 · 5 comments

Comments

@cbachhuber
Copy link

Thank you for typos, this is an amazing app!

I'd like to be able to have identifiers with dashes in default.extend-identifiers. I need it for gcc's -Wno-hsa and clang-tidy's clang-analyzer-optin. (Note: Bare keys with dashes are supported by toml)

Does a dash separate two identifiers or is it part of one identifier, similar to an underscore? Should we add this info to the docs? I can't find this anywhere.

Minimal example:

.typos.toml:

[default.extend-identifiers]
wrongWrod = 'wrongWrod'
wrong_wrod = 'wrong_wrod'
wrong-wrod = 'wrong-wrod'  # doesn't have any effect and doesn't warn

example.txt:

wrongWrod
wrong_wrod
wrong-wrod
$ typos example.txt
error: `wrod` should be `word`
  --> file.txt:3:7
  |
3 | wrong-wrod
  |       ^^^^
  |
@hofbi
Copy link

hofbi commented Jan 2, 2023

Maybe the solution in #575 works here as well

epage added a commit that referenced this issue Jan 2, 2023
@epage
Copy link
Collaborator

epage commented Jan 2, 2023

I've updated the docs with the definition of an identifier (uncode XID_Continue) and word (split identifier).

Yes, these are cases where identifiers are split by a dash. The challenge is knowing when to treat them as identifiers or not and how to do so efficiently.

@cbachhuber
Copy link
Author

Maybe the solution in #575 works here as well

I don't think so: in #575, @epage suggests using extend-identifiers instead of extend-words. We're already working with extend-identifiers in this issue.

I've updated the docs with the definition of an identifier (uncode XID_Continue) and word (split identifier).

Thank you for this! While being correct, I find the unicode reference hard to read and to derive common cases from. For example, within 5 minutes, I wasn't able to find that a dash separates two identifiers. What do you think about #648?

The challenge is knowing when to treat them [dashes] as identifiers or not and how to do so efficiently.

Generally, dashes split identifiers, right? In that case, and if it stays this way, we can close this issue with #648 imo.

@epage
Copy link
Collaborator

epage commented Jan 14, 2023

59c4713 handled the docs side of things and #400 is the issue for other word joiners besides _, so I think its safe to close this issue out. If there is something I missed, let me know.

@epage epage closed this as completed Jan 14, 2023
@tinmarino
Copy link

Duplicates: #400.

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

No branches or pull requests

4 participants