MCPcopy Create free account
hub / github.com/CppCXY/EmmyLuaCodeStyle / SpellCorrect

Method SpellCorrect

CodeFormatLib/src/LuaCodeFormat.cpp:260–280  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

258}
259
260std::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
282LuaStyle &LuaCodeFormat::GetStyle(const std::string &uri) {
283 std::shared_ptr<LuaEditorConfig> editorConfig = nullptr;

Callers 1

spell_suggestFunction · 0.45

Calls 3

frontMethod · 0.80
GetSuggestsMethod · 0.80
emptyMethod · 0.45

Tested by

no test coverage detected