| 258 | } |
| 259 | |
| 260 | std::vector<SuggestItem> LuaCodeFormat::SpellCorrect(const std::string &word) { |
| 261 | std::string letterWord = word; |
| 262 | for (auto &c: letterWord) { |
| 263 | c = std::tolower(c); |
| 264 | } |
| 265 | bool upperFirst = false; |
| 266 | if (std::isupper(word.front())) { |
| 267 | upperFirst = true; |
| 268 | } |
| 269 | |
| 270 | auto suggests = _spellChecker.GetSuggests(letterWord); |
| 271 | |
| 272 | for (auto &suggest: suggests) { |
| 273 | if (!suggest.Term.empty()) { |
| 274 | if (upperFirst) { |
| 275 | suggest.Term[0] = std::toupper(suggest.Term[0]); |
| 276 | } |
| 277 | } |
| 278 | } |
| 279 | return suggests; |
| 280 | } |
| 281 | |
| 282 | LuaStyle &LuaCodeFormat::GetStyle(const std::string &uri) { |
| 283 | std::shared_ptr<LuaEditorConfig> editorConfig = nullptr; |
no test coverage detected