Skip to content

Commit 73b671a

Browse files
committed
修改实现
1 parent 744a69e commit 73b671a

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

CodeFormatLib/src/LuaCodeFormat.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@
44
#include "CodeService/LuaFormatter.h"
55
#include "LuaParser/LuaParser.h"
66

7+
// workaround for C++17
8+
bool StartWith(const std::string& source, const std::string& str)
9+
{
10+
return source.find(str) == 0;
11+
}
12+
713
LuaCodeFormat& LuaCodeFormat::GetInstance()
814
{
915
static LuaCodeFormat instance;
@@ -42,9 +48,9 @@ void LuaCodeFormat::UpdateCodeStyle(const std::string& workspaceUri, const std::
4248

4349
void LuaCodeFormat::RemoveCodeStyle(const std::string& workspaceUri)
4450
{
45-
for(auto it = _editorConfigVector.begin();it != _editorConfigVector.end();++it)
51+
for (auto it = _editorConfigVector.begin(); it != _editorConfigVector.end(); ++it)
4652
{
47-
if(it->first == workspaceUri)
53+
if (it->first == workspaceUri)
4854
{
4955
_editorConfigVector.erase(it);
5056
return;
@@ -79,7 +85,7 @@ std::shared_ptr<LuaCodeStyleOptions> LuaCodeFormat::GetOptions(const std::string
7985
std::shared_ptr<LuaCodeStyleOptions> options = _defaultOptions;
8086
for (auto it = _editorConfigVector.begin(); it != _editorConfigVector.end(); it++)
8187
{
82-
if (uri.starts_with(it->first) && it->first.size() > matchLength)
88+
if (StartWith(uri, it->first) && it->first.size() > matchLength)
8389
{
8490
matchLength = it->first.size();
8591
options = it->second->Generate(uri);

0 commit comments

Comments
 (0)