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

Make it possible to store User Words into a dictionary file instead of settings.json #61

Closed
denis-ko opened this issue Jan 16, 2017 · 17 comments

Comments

@denis-ko
Copy link

denis-ko commented Jan 16, 2017

Is it possible to store words that currently appear in "cSpell.userWords" in a separate file?
After couple of days pressing "Add to dictionary" my user settings file became pretty large and is still growing.

@Jason3S
Copy link
Collaborator

Jason3S commented Jan 16, 2017

Yes, this is possible. Just copy the words into a text file and follow the step: how-to-add-your-own-dictionaries

The documentation is new, so if you have any feedback on how to improve it for understanding, please make some suggestions.

@denis-ko
Copy link
Author

Oh. I wasn't clear enough. The documentation is pretty clear regarding dictionaries. However, I was talking about overriding the behavior of "Add to dictionary".

Here is my scenario. I'm trying to use cSpell with LaTeX files. Apparently there is a lot of text and specific terminology that is unknown in advance. So I cannot create a static custom dictionary and add it via the current mechanism. Of course, I can manually copy/paste from the settings file each time it grows beyond some point, but it is a bit awkward.

@Jason3S
Copy link
Collaborator

Jason3S commented Jan 16, 2017

Ahh. you want to be able to configure the target for adding words from the UI.

Something like:

// At the user level
"cSpell.userDictionaryLocation": ".../dictionaries/my_personal_dictionary/words.txt",
// or at the project level
"cSpell.projectDictionaryLocation": "./words.txt",

And have the extension add to that dictionary instead of the settings.json file.

@denis-ko
Copy link
Author

denis-ko commented Jan 16, 2017

Yes. Though at the project level it might be meaningless.

@Jason3S Jason3S changed the title userWords vs dictionary Make it possible to store User Words into a dictionary file instead of settings.json Jan 20, 2017
@memeplex
Copy link

A problem with cluttering settings file like that is that new settings get added at the end of the file, so you have to scroll down to the end each time new settings are added.

@janosh
Copy link

janosh commented Jun 14, 2019

@Jason3S Another option would be to follow the example of Settings Sync and allow users to store their custom dictionary in a private gist on GitHub. I assume you could recycle much of their implementation and it would make away with having to handle local files on different OS's.

@DerekNonGeneric
Copy link

DerekNonGeneric commented Nov 16, 2019

Please implement something like cSpell.projectDictionaryLocation that accepts a path to a dictionary relative to the project/workspace root. 🙏 Also, it would be great to be able to have the option to "Add to a project dictionary" via the lightbulb tooltip. 💡 I'm not sure what the expected workflow is, but the current behavior of having "Add to folder dictionary" via the lightbulb tooltip add words to both the .vscode/settings.json and cSpell.json files is no bueno! Maintaining the exact same dictionaries in two separate locations is bound to eventually desync. This dictionary should be able to be appended to via the VS Code UI and referenced from a cSpell.json file, which can likewise be used by the cspell CLI tool. I'd be willing to make the PR if given the green light. 🚥

/to @Jason3S Thanks for all the hard work on these tools! 👋

@Jason3S
Copy link
Collaborator

Jason3S commented Nov 16, 2019

@DerekNonGeneric a pull request would be awesome!

@Jason3S
Copy link
Collaborator

Jason3S commented May 9, 2020

With 1.9.0, it will be possible to add a custom dictionary location. Would you try out: v1.9.0-alpha.0

@DerekNonGeneric
Copy link

DerekNonGeneric commented May 14, 2020

Thanks @Jason3S, you're the best! I was able to get it working perfectly! 🚀✨

@denis-ko
Copy link
Author

Works great. Thank's!

@janosh
Copy link

janosh commented May 14, 2020

@Jason3S Your work is much appreciated! Looking forward to the public release.

@Jason3S
Copy link
Collaborator

Jason3S commented May 18, 2020

I have made it slightly easier to use with v1.9.0-alpha.5

The custom dictionaries can refer to a predefined dictionary:

Example with a dictionary reference

cspell.json

"dictionaryDefinitions": [
    {
        "name": "cities",
        "path": "./sampleDictionaries/cities.txt"
    },
    {
        "name": "project-terms",
        "path": "./words.txt"
    }
]

VS Code settings.json

"cSpell.customWorkspaceDictionaries": ["project-terms"]

@muuvmuuv
Copy link

@Jason3S I would also add "cSpell.customWorkspaceDictionaries": ["*"] which would add all. So I don't need to edit two places if not needed.

@Jason3S
Copy link
Collaborator

Jason3S commented May 18, 2020

What would "*" mean? There are a lot of active dictionaries. You want to write words to all of them? Please describe the behavior you are looking for.

You can also add customWorkspaceDictionaries to the cspell.json file.

@muuvmuuv
Copy link

The asterisk would mean to use all dictionaries. But anyway I think I misunderstood customWorkspaceDictionaries. I will try a few things out and if my use-case does not fit I will come back ^^.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2022

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 5, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants