| 160 | } |
| 161 | |
| 162 | LuaStyle FormatContext::GetStyle(std::string_view path) const { |
| 163 | std::shared_ptr<LuaEditorConfig> editorConfig = nullptr; |
| 164 | std::size_t matchProcess = 0; |
| 165 | for (auto &config: _configs) { |
| 166 | if (string_util::StartWith(path, config.Workspace)) { |
| 167 | if (config.Workspace.size() >= matchProcess) { |
| 168 | matchProcess = config.Workspace.size(); |
| 169 | editorConfig = config.Editorconfig; |
| 170 | } |
| 171 | } |
| 172 | } |
| 173 | |
| 174 | if (editorConfig) { |
| 175 | return editorConfig->Generate(path); |
| 176 | } |
| 177 | return _defaultStyle; |
| 178 | } |
| 179 | |
| 180 | WorkMode FormatContext::GetWorkMode() const { |
| 181 | return _workMode; |
no test coverage detected