Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Implement suggestions from tools #118

Merged
merged 7 commits into from
Apr 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions benchmark/benchmark.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ using json = nlohmann::json;
class diagnostic_counter : public hlasm_plugin::parser_library::diagnostics_consumer
{
public:
virtual void consume_diagnostics(hlasm_plugin::parser_library::diagnostic_list diagnostics) override
void consume_diagnostics(hlasm_plugin::parser_library::diagnostic_list diagnostics) override
{
for (size_t i = 0; i < diagnostics.diagnostics_size(); i++)
{
Expand All @@ -81,7 +81,7 @@ class diagnostic_counter : public hlasm_plugin::parser_library::diagnostics_cons
class metrics_collector : public hlasm_plugin::parser_library::performance_metrics_consumer
{
public:
virtual void consume_performance_metrics(const hlasm_plugin::parser_library::performance_metrics& metrics) override
void consume_performance_metrics(const hlasm_plugin::parser_library::performance_metrics& metrics) override
{
metrics_ = metrics;
}
Expand Down
4,243 changes: 1,373 additions & 2,870 deletions clients/vscode-hlasmplugin/package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions clients/vscode-hlasmplugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@
"@types/glob": "^5.0.35",
"@types/mocha": "^7.0.2",
"@types/vscode": "^1.32.3",
"conventional-changelog-conventionalcommits": "^4.3.0",
"conventional-changelog-conventionalcommits": "^4.5.0",
"decache": "^4.5.1",
"glob": "^7.1.6",
"mocha": "^7.1.1",
"nyc": "^15.0.1",
"puppeteer": "^4.0.0",
"semantic-release": "^17.0.7",
"semantic-release": "^17.4.2",
"shelljs": "^0.8.2",
"shx": "^0.3.2",
"typescript": "^3.5.3",
Expand Down
6 changes: 3 additions & 3 deletions language_server/src/lsp/feature_language_features.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ class feature_language_features : public feature
public:
feature_language_features(parser_library::workspace_manager& ws_mngr, response_provider& response_provider);

void virtual register_methods(std::map<std::string, method>& methods) override;
json virtual register_capabilities() override;
void virtual initialize_feature(const json& initialise_params) override;
void register_methods(std::map<std::string, method>& methods) override;
json register_capabilities() override;
void initialize_feature(const json& initialise_params) override;

private:
void definition(const json& id, const json& params);
Expand Down
4 changes: 2 additions & 2 deletions language_server/src/lsp/feature_text_synchronization.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ class feature_text_synchronization : public feature
// Adds the implemented methods into the map.
void register_methods(std::map<std::string, method>& methods) override;
// Returns set capabilities connected with text synchonization
json virtual register_capabilities() override;
json register_capabilities() override;
// Does nothing, not needed.
void virtual initialize_feature(const json& initialise_params) override;
void initialize_feature(const json& initialise_params) override;

private:
// Handles textDocument/didOpen notification.
Expand Down
4 changes: 2 additions & 2 deletions language_server/src/lsp/feature_workspace_folders.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ class feature_workspace_folders : public feature
// Adds workspace/* methods to the map.
void register_methods(std::map<std::string, method>&) override;
// Returns workspaces capability.
json virtual register_capabilities() override;
json register_capabilities() override;
// Opens workspace specified in the initialize request.
void virtual initialize_feature(const json& initialise_params) override;
void initialize_feature(const json& initialise_params) override;

private:
// Handles workspace/didChangeWorkspaceFolders notification.
Expand Down
2 changes: 1 addition & 1 deletion language_server/src/request_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class request_manager
// the request manager invalidates older requests on the
// same file, when a new request to the same file comes
std::string currently_running_file_;
std::atomic<server*> currently_running_server_;
std::atomic<server*> currently_running_server_ = nullptr;

void handle_request_(const std::atomic<bool>* end_loop);
std::string get_request_file_(json r, bool* is_parsing_required = nullptr) const;
Expand Down
10 changes: 5 additions & 5 deletions language_server/test/dispatcher_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ class server_mock : public server

std::vector<json> messages;

virtual void request(const json&, const std::string&, const json&, method) override {}
virtual void respond(const json&, const std::string&, const json&) override {}
virtual void notify(const std::string&, const json&) override {}
virtual void respond_error(const json&, const std::string&, int, const std::string&, const json&) override {}
virtual void message_received(const json& message) override
void request(const json&, const std::string&, const json&, method) override {}
void respond(const json&, const std::string&, const json&) override {}
void notify(const std::string&, const json&) override {}
void respond_error(const json&, const std::string&, int, const std::string&, const json&) override {}
void message_received(const json& message) override
{
++counter;
if (counter == messages_limit)
Expand Down
2 changes: 1 addition & 1 deletion language_server/test/regress_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ using server_notification = std::pair<std::string, json>;
class message_provider_mock : public send_message_provider
{
public:
virtual void reply(const json& result) override { notfs.push_back(result); }
void reply(const json& result) override { notfs.push_back(result); }

std::vector<json> notfs;
};
Expand Down
8 changes: 4 additions & 4 deletions language_server/test/request_manager_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ class server_mock_rm : public server
}
}

virtual void request(const json&, const std::string&, const json&, method) override {}
virtual void respond(const json&, const std::string&, const json&) override {}
virtual void notify(const std::string&, const json&) override {}
virtual void respond_error(const json&, const std::string&, int, const std::string&, const json&) override {}
void request(const json&, const std::string&, const json&, method) override {}
void respond(const json&, const std::string&, const json&) override {}
void notify(const std::string&, const json&) override {}
void respond_error(const json&, const std::string&, int, const std::string&, const json&) override {}

int messages_received = 0;

Expand Down
7 changes: 3 additions & 4 deletions parser_library/include/parser_library.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,16 @@
#include "parser_library_export.h"


namespace hlasm_plugin {
namespace parser_library {
namespace hlasm_plugin::parser_library {

class PARSER_LIBRARY_EXPORT parser_library
{
public:
parser_library() {};
void parse(const std::string&);
};
} // namespace parser_library
} // namespace hlasm_plugin

} // namespace hlasm_plugin::parser_library


#endif
6 changes: 2 additions & 4 deletions parser_library/include/range.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@

#include "parser_library_export.h"

namespace hlasm_plugin {
namespace parser_library {
namespace hlasm_plugin::parser_library {

using position_t = uint64_t;

Expand Down Expand Up @@ -74,6 +73,5 @@ struct PARSER_LIBRARY_EXPORT file_range
const std::string* file;
};

} // namespace parser_library
} // namespace hlasm_plugin
} // namespace hlasm_plugin::parser_library
#endif
9 changes: 5 additions & 4 deletions parser_library/include/workspace_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,13 @@
#include "parser_library_export.h"
#include "protocol.h"

namespace hlasm_plugin {
namespace parser_library {
namespace hlasm_plugin::parser_library {

namespace workspaces {
class workspace;
class parse_lib_provider;
} // namespace workspaces

using ws_id = workspaces::workspace*;

// Interface that can be implemented to be able to get list of
Expand Down Expand Up @@ -106,6 +107,6 @@ class PARSER_LIBRARY_EXPORT workspace_manager
private:
impl* impl_;
};
} // namespace parser_library
} // namespace hlasm_plugin

} // namespace hlasm_plugin::parser_library
#endif // !HLASMPLUGIN_PARSERLIBRARY_WORKSPACE_MANAGER_H
6 changes: 2 additions & 4 deletions parser_library/src/analyzer.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@
#include "processing/processing_manager.h"
#include "workspaces/parse_lib_provider.h"

namespace hlasm_plugin {
namespace parser_library {
namespace hlasm_plugin::parser_library {

// this class analyzes provided text and produces diagnostics and highlighting info with respect to provided context
class analyzer : public diagnosable_ctx
Expand Down Expand Up @@ -70,6 +69,5 @@ class analyzer : public diagnosable_ctx
void register_stmt_analyzer(processing::statement_analyzer* stmt_analyzer);
};

} // namespace parser_library
} // namespace hlasm_plugin
} // namespace hlasm_plugin::parser_library
#endif
12 changes: 6 additions & 6 deletions parser_library/src/checking/asm_instr_check.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@

#include <regex>

namespace hlasm_plugin {
namespace parser_library {
namespace checking {
namespace {
const std::vector<std::string> rmode_options = { "24", "31", "64", "ANY" };
}

namespace hlasm_plugin::parser_library::checking {

xattr::xattr(const std::vector<label_types>& allowed_types, const std::string& name_of_instruction)
: assembler_instruction(allowed_types, name_of_instruction, 1, -1) {};
Expand Down Expand Up @@ -1445,6 +1447,4 @@ bool acontrol::check(const std::vector<const asm_operand*>& to_check,
return true;
}

} // namespace checking
} // namespace parser_library
} // namespace hlasm_plugin
} // namespace hlasm_plugin::parser_library::checking
8 changes: 2 additions & 6 deletions parser_library/src/checking/asm_instr_check.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@
#include "asm_instr_class.h"
#include "data_definition/data_def_type_base.h"

namespace hlasm_plugin {
namespace parser_library {
namespace checking {
namespace hlasm_plugin::parser_library::checking {
/*
TO DO - notes
- dxd, dc, ds instructions - if evaluation and control takes places before checker, these instructions need only one
Expand Down Expand Up @@ -369,8 +367,6 @@ class process final : public assembler_instruction
const diagnostic_collector& add_diagnostic) const override;
};

} // namespace checking
} // namespace parser_library
} // namespace hlasm_plugin
} // namespace hlasm_plugin::parser_library::checking

#endif
11 changes: 2 additions & 9 deletions parser_library/src/checking/asm_instr_class.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@
#include "diagnosable.h"
#include "instr_operand.h"

namespace hlasm_plugin {
namespace parser_library {
namespace checking {
namespace hlasm_plugin::parser_library::checking {

// defining label types before instruction, used as parameter in assembler_instruction class
enum label_types
Expand Down Expand Up @@ -69,8 +67,6 @@ class assembler_instruction
virtual ~assembler_instruction() {};

protected:
const std::vector<std::string> rmode_options = { "24", "31", "64", "ANY" };

bool is_param_in_vector(const std::string& parameter, const std::vector<std::string>& options) const;

bool operands_size_corresponding(const std::vector<const asm_operand*>& to_check,
Expand Down Expand Up @@ -127,9 +123,6 @@ class assembler_instruction
bool check_assembler_process_operand(const asm_operand* input, const diagnostic_collector& add_diagnostic) const;
};


} // namespace checking
} // namespace parser_library
} // namespace hlasm_plugin
} // namespace hlasm_plugin::parser_library::checking

#endif
Loading