Skip to content

Commit

Permalink
Call the LSP from the LPython driver
Browse files Browse the repository at this point in the history
  • Loading branch information
certik committed Jul 6, 2022
1 parent 5e95ff0 commit 423bed3
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/bin/lpython.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include <lpython/python_serialization.h>
#include <lpython/parser/tokenizer.h>
#include <lpython/parser/parser.h>
#include <libasr/lsp/LPythonServer.hpp>

#include <cpp-terminal/terminal.h>
#include <cpp-terminal/prompt0.h>
Expand Down Expand Up @@ -605,6 +606,8 @@ int main(int argc, char *argv[])
std::string arg_pywrap_file;
std::string arg_pywrap_array_order="f";

std::string arg_lsp_filename;

CompilerOptions compiler_options;
LCompilers::PassManager lpython_pass_manager;

Expand Down Expand Up @@ -688,6 +691,10 @@ int main(int argc, char *argv[])
pywrap.add_option("--array-order", arg_pywrap_array_order,
"Select array order (c, f)")->capture_default_str();

// Language Server Protocol
CLI::App &lsp = *app.add_subcommand("lsp", "Language Server Protocol");
lsp.add_option("filename", arg_lsp_filename, "Path to a filename")->required();


app.get_formatter()->column_width(25);
app.require_subcommand(0, 1);
Expand Down Expand Up @@ -754,6 +761,11 @@ int main(int argc, char *argv[])
return 1;
}

if (lsp) {
LPythonServer().run(arg_lsp_filename);
return 0;
}

if (arg_backend == "llvm") {
backend = Backend::llvm;
} else if (arg_backend == "cpp") {
Expand Down

0 comments on commit 423bed3

Please sign in to comment.