robotdana / spellr

Spell check your source code
MIT License
34 stars 2 forks source link

Allow file-specific wordlists #59

Closed ellsclytn closed 4 years ago

ellsclytn commented 4 years ago

I often come across words that are very specific to a single file, and the probability of that same word being used elsewhere in the codebase legitimately is extremely low (low enough that it's more likely to be the result of a typo).

In this situation, it would be great to be able to have wordlists for specific files.

ellsclytn commented 4 years ago

Another alternative would be to allow the interface to easily create additional dictionaries on-the-fly. E.g. I'm using Logstash for some logging stuff. And so I've got some very specific files that are concerned with logging, and the concern of Logstash should remain within those very specific files. So when spellr tells me that "logstash" is an error, I could press some buttons to create a new "logging" wordlist, or "infrastructure" wordlist, or something like that, and only individual files or folders can be added into that wordlist.

robotdana commented 4 years ago

You can make wordlists that apply to a single file, just set it up as the only file for that language.

languages: 
  logstash: 
     includes:
         - path/to/logstash

there isn't yet a way to set up a wordlist during an interactive spell check session (single file or not), (this would require writing to the .spellr.yml and i don't want to accidentally clobber comments like package.json does). If you have any solution for this (perhaps a yaml parser that doesn't strip comments and keeps track of formatting, or a secondary file like .rubocop_todo.yml)

robotdana commented 4 years ago

I've added a documentation: 58e881f, and #66 for the more complicated dynamic/interactive aspect of this.