Skip to content

Commit

Permalink
Merge pull request ethereum#13274 from ethereum/lsp-fix-include-path
Browse files Browse the repository at this point in the history
lsp: Fixes initialization phase if `include-paths` was not set at all then also no error should be generated.
  • Loading branch information
christianparpart authored Jul 13, 2022
2 parents f686294 + eb5a332 commit ed039ab
Showing 1 changed file with 17 additions and 14 deletions.
31 changes: 17 additions & 14 deletions libsolidity/lsp/LanguageServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,25 +149,28 @@ void LanguageServer::changeConfiguration(Json::Value const& _settings)
{
m_settingsObject = _settings;
Json::Value jsonIncludePaths = _settings["include-paths"];
int typeFailureCount = 0;

if (jsonIncludePaths && jsonIncludePaths.isArray())
if (jsonIncludePaths)
{
vector<boost::filesystem::path> includePaths;
for (Json::Value const& jsonPath: jsonIncludePaths)
int typeFailureCount = 0;
if (jsonIncludePaths.isArray())
{
if (jsonPath.isString())
includePaths.emplace_back(boost::filesystem::path(jsonPath.asString()));
else
typeFailureCount++;
vector<boost::filesystem::path> includePaths;
for (Json::Value const& jsonPath: jsonIncludePaths)
{
if (jsonPath.isString())
includePaths.emplace_back(boost::filesystem::path(jsonPath.asString()));
else
typeFailureCount++;
}
m_fileRepository.setIncludePaths(move(includePaths));
}
m_fileRepository.setIncludePaths(move(includePaths));
}
else
++typeFailureCount;
else
++typeFailureCount;

if (typeFailureCount)
m_client.trace("Invalid JSON configuration passed. \"include-paths\" must be an array of strings.");
if (typeFailureCount)
m_client.trace("Invalid JSON configuration passed. \"include-paths\" must be an array of strings.");
}
}

void LanguageServer::compile()
Expand Down

0 comments on commit ed039ab

Please sign in to comment.