Skip to content

Commit eb5a332

Browse files
lsp: Fixes initialization phase if include-paths was not set at all, then also no error should be generated.
1 parent f686294 commit eb5a332

File tree

1 file changed

+17
-14
lines changed

1 file changed

+17
-14
lines changed

libsolidity/lsp/LanguageServer.cpp

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -149,25 +149,28 @@ void LanguageServer::changeConfiguration(Json::Value const& _settings)
149149
{
150150
m_settingsObject = _settings;
151151
Json::Value jsonIncludePaths = _settings["include-paths"];
152-
int typeFailureCount = 0;
153152

154-
if (jsonIncludePaths && jsonIncludePaths.isArray())
153+
if (jsonIncludePaths)
155154
{
156-
vector<boost::filesystem::path> includePaths;
157-
for (Json::Value const& jsonPath: jsonIncludePaths)
155+
int typeFailureCount = 0;
156+
if (jsonIncludePaths.isArray())
158157
{
159-
if (jsonPath.isString())
160-
includePaths.emplace_back(boost::filesystem::path(jsonPath.asString()));
161-
else
162-
typeFailureCount++;
158+
vector<boost::filesystem::path> includePaths;
159+
for (Json::Value const& jsonPath: jsonIncludePaths)
160+
{
161+
if (jsonPath.isString())
162+
includePaths.emplace_back(boost::filesystem::path(jsonPath.asString()));
163+
else
164+
typeFailureCount++;
165+
}
166+
m_fileRepository.setIncludePaths(move(includePaths));
163167
}
164-
m_fileRepository.setIncludePaths(move(includePaths));
165-
}
166-
else
167-
++typeFailureCount;
168+
else
169+
++typeFailureCount;
168170

169-
if (typeFailureCount)
170-
m_client.trace("Invalid JSON configuration passed. \"include-paths\" must be an array of strings.");
171+
if (typeFailureCount)
172+
m_client.trace("Invalid JSON configuration passed. \"include-paths\" must be an array of strings.");
173+
}
171174
}
172175

173176
void LanguageServer::compile()

0 commit comments

Comments
 (0)