v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
torque-language-server.cc
Go to the documentation of this file.
1// Copyright 2019 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include <fstream>
6#include <iostream>
7#include <sstream>
8
14
15namespace v8 {
16namespace internal {
17namespace torque {
18namespace ls {
19
20int WrappedMain(int argc, const char** argv) {
21 Logger::Scope log_scope;
22 TorqueFileList::Scope files_scope;
23 LanguageServerData::Scope server_data_scope;
24 SourceFileMap::Scope source_file_map_scope("");
25 DiagnosticsFiles::Scope diagnostics_files_scope;
26
27 for (int i = 1; i < argc; ++i) {
28 if (!strcmp("-l", argv[i])) {
29 Logger::Enable(argv[++i]);
30 break;
31 }
32 }
33
34 while (true) {
35 JsonValue message = ReadMessage();
36
37 // TODO(szuend): We should probably offload the actual message handling
38 // (even the parsing) to a background thread, so we can
39 // keep receiving messages. We might also receive
40 // $/cancelRequests or contet updates, that require restarts.
41 HandleMessage(std::move(message), &WriteMessage);
42 }
43}
44
45} // namespace ls
46} // namespace torque
47} // namespace internal
48} // namespace v8
49
50int main(int argc, const char** argv) {
52}
static void Enable(std::string path)
Definition globals.h:27
void WriteMessage(JsonValue message)
int WrappedMain(int argc, const char **argv)
void HandleMessage(JsonValue raw_message, MessageWriter writer)
int main(int argc, const char **argv)