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

How to teach typos about project specific terms? #4

Open
nirs opened this issue Nov 7, 2024 · 4 comments
Open

How to teach typos about project specific terms? #4

nirs opened this issue Nov 7, 2024 · 4 comments

Comments

@nirs
Copy link

nirs commented Nov 7, 2024

Thanks for typos, this is a wonderful extension!

One issue, it complains about terms like ODF (OpenShift Data Foundation):

Screenshot 2024-11-07 at 19 00 42

How can I teach it about ODF?

In vim I would add ODF to my local dictionary (zg) - quick an easy and works for many projects related to ODF on single machine.

@BaptisteRoseau
Copy link
Owner

BaptisteRoseau commented Nov 8, 2024

For now you can create a .typos.toml file at the root of your project's directory, then add the following into it:

[default.extend-words]
ODF = "ODF"

Then you need to reload the editor.

I might add a command to automatically do this in the future but for the time being this will fix your issue.
Let me know if that worked for you and if you need anything else :D

Note that the configuration will only apply to your project directory. Any other file opened outside of the repository in Zed will not see the .typos.toml configuration applied.

@nirs
Copy link
Author

nirs commented Nov 8, 2024

Thanks, adding a shortcut to add a word to the list would be nice.

But per project word may not be enough. Many projects have multiple repos so you will not update multiple project typos.toml files. There should be also a per machine configuration (like ~/.gitconfig and .git/config). Per machine config should be the most useful way, hopefully it can be synced between machines like other zed settings.

@nirs
Copy link
Author

nirs commented Nov 8, 2024

For reference, the relevant docs:
https://github.com/crate-ci/typos/blob/master/docs/reference.md

@BaptisteRoseau
Copy link
Owner

BaptisteRoseau commented Nov 13, 2024

Hello again, I dug a bit on how to solve this issue and the code action to add new words should be done in the LSP itself, not this zed-plugin which purpose is to add the "glue" to use the LSP.

There is already a WIP PR to implement this feature tekumara/typos-lsp#12, which should be automatically downloaded when the new version is released (if not, then that's a bug I should fix here).

I will ask on the PR if it's also possible to add an action into a global config, which would ultimately fix your problem, you're not the only one having it :D

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

2 participants