ADTarm-ehast-experimentalenumforall-pointer-decayjacob/cs343-translationnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change
on this file since aa88cb9a was
ebe0f0d,
checked in by Thierry Delisle <tdelisle@…>, 5 years ago
|
Added basic language server which now properly communicates with the client
|
-
Property mode set to
100644
|
File size:
1.3 KB
|
Rev | Line | |
---|
[ebe0f0d] | 1 | #include "server.hpp" |
---|
| 2 | #include "log.hpp" |
---|
| 3 | |
---|
| 4 | namespace server { |
---|
| 5 | class server { |
---|
| 6 | public: |
---|
| 7 | void check_ready() { |
---|
| 8 | if(!ready) { |
---|
| 9 | throw json::obj({ |
---|
| 10 | { "code", -32002 }, |
---|
| 11 | { "message", "Server not initialized" } |
---|
| 12 | }); |
---|
| 13 | } |
---|
| 14 | } |
---|
| 15 | |
---|
| 16 | void init() { ready = true; }; |
---|
| 17 | private: |
---|
| 18 | bool ready = false; |
---|
| 19 | |
---|
| 20 | }; |
---|
| 21 | |
---|
| 22 | static server g_server; |
---|
| 23 | |
---|
| 24 | json::obj init( const json::obj & ) { |
---|
| 25 | g_server.init(); |
---|
| 26 | return { |
---|
| 27 | { "capabilities", { |
---|
| 28 | {"textDocumentSync", { |
---|
| 29 | {"openClose", true}, |
---|
| 30 | {"change", 1} |
---|
| 31 | }}, |
---|
| 32 | {"documentHighlightProvider", { |
---|
| 33 | {"workDoneProgress", false} |
---|
| 34 | }}, |
---|
| 35 | {"completionProvider", { |
---|
| 36 | {"triggerCharacters", json::obj::array()}, |
---|
| 37 | {"allCommitCharacters", json::obj::array()}, |
---|
| 38 | {"resolveProvider", true} |
---|
| 39 | }} |
---|
| 40 | } }, |
---|
| 41 | { "serverInfo", { |
---|
| 42 | { "name", "Cforall Language Server" }, |
---|
| 43 | { "version", "0.1" } |
---|
| 44 | }} |
---|
| 45 | }; |
---|
| 46 | } |
---|
| 47 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.