@@ -616,13 +616,13 @@ void mainLoop() {
616
616
617
617
SemaManager manager (
618
618
&project, &wfiles,
619
- [&]( std::string path, std::vector<Diagnostic> diagnostics) {
619
+ []( const std::string & path, std::vector<Diagnostic> diagnostics) {
620
620
PublishDiagnosticParam params;
621
621
params.uri = DocumentUri::fromPath (path);
622
- params.diagnostics = diagnostics;
622
+ params.diagnostics = std::move ( diagnostics) ;
623
623
notify (" textDocument/publishDiagnostics" , params);
624
624
},
625
- [](RequestId id) {
625
+ [](const RequestId & id) {
626
626
if (id.valid ()) {
627
627
ResponseError err;
628
628
err.code = ErrorCode::InternalError;
@@ -717,8 +717,9 @@ void standalone(const std::string &root) {
717
717
WorkingFiles wfiles;
718
718
VFS vfs;
719
719
SemaManager manager (
720
- nullptr , nullptr , [&](std::string, std::vector<Diagnostic>) {},
721
- [](RequestId id) {});
720
+ nullptr , nullptr ,
721
+ [](const std::string &, const std::vector<Diagnostic> &) {},
722
+ [](const RequestId &id) {});
722
723
IncludeComplete complete (&project);
723
724
724
725
MessageHandler handler;
@@ -756,7 +757,7 @@ void standalone(const std::string &root) {
756
757
void index (const std::string &path, const std::vector<const char *> &args,
757
758
IndexMode mode, bool must_exist, RequestId id) {
758
759
pending_index_requests++;
759
- index_request->pushBack ({path, args, mode, must_exist, id },
760
+ index_request->pushBack ({path, args, mode, must_exist, std::move (id) },
760
761
mode != IndexMode::Background);
761
762
}
762
763
@@ -800,7 +801,7 @@ void notifyOrRequest(const char *method, bool request,
800
801
for_stdout->pushBack (output.GetString ());
801
802
}
802
803
803
- static void reply (RequestId id, const char *key,
804
+ static void reply (const RequestId & id, const char *key,
804
805
const std::function<void (JsonWriter &)> &fn) {
805
806
rapidjson::StringBuffer output;
806
807
rapidjson::Writer<rapidjson::StringBuffer> w (output);
@@ -813,7 +814,7 @@ static void reply(RequestId id, const char *key,
813
814
w.Null ();
814
815
break ;
815
816
case RequestId::kInt :
816
- w.Int (atoll (id.value .c_str ()));
817
+ w.Int64 (atoll (id.value .c_str ()));
817
818
break ;
818
819
case RequestId::kString :
819
820
w.String (id.value .c_str (), id.value .size ());
@@ -828,11 +829,12 @@ static void reply(RequestId id, const char *key,
828
829
for_stdout->pushBack (output.GetString ());
829
830
}
830
831
831
- void reply (RequestId id, const std::function<void (JsonWriter &)> &fn) {
832
+ void reply (const RequestId & id, const std::function<void (JsonWriter &)> &fn) {
832
833
reply (id, " result" , fn);
833
834
}
834
835
835
- void replyError (RequestId id, const std::function<void (JsonWriter &)> &fn) {
836
+ void replyError (const RequestId &id,
837
+ const std::function<void (JsonWriter &)> &fn) {
836
838
reply (id, " error" , fn);
837
839
}
838
840
} // namespace pipeline
0 commit comments