Skip to content

Commit

Permalink
copy all code from erlide_kernel and start renaming modules
Browse files Browse the repository at this point in the history
Now we have a starting point.
  • Loading branch information
vladdu committed Aug 16, 2017
1 parent 76710a7 commit 4580c7a
Show file tree
Hide file tree
Showing 97 changed files with 10,351 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
_build
erl_crash.dump

5 changes: 5 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"version": "0.1.0",
"configurations": [
]
}
9 changes: 9 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Place your settings in this file to overwrite default and user settings.
{
"files.exclude": {
"_build": true
},
"search.exclude": {
"_build": true
}
}
30 changes: 30 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// Available variables which can be used inside of strings.
// ${workspaceRoot}: the root folder of the team
// ${file}: the current opened file
// ${fileBasename}: the current opened file's basename
// ${fileDirname}: the current opened file's dirname
// ${fileExtname}: the current opened file's extension
// ${cwd}: the current working directory of the spawned process

// A task runner that calls a custom npm script that compiles the extension.
{
"version": "0.1.0",

// we want to run npm
"command": "npm",

// the command is a shell script
"isShellCommand": true,

// show the output window only if unrecognized errors occur.
"showOutput": "silent",

// we run the custom script "compile" as defined in package.json
"args": ["run", "compile", "--loglevel", "silent"],

// The tsc compiler is started in watching mode
"isBackground": true,

// use the standard tsc in watch mode problem matcher to find compile problems in the output.
"problemMatcher": "$tsc-watch"
}
5 changes: 5 additions & 0 deletions .vscodeignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.vscode/**
.gitignore
erl_crash.dump

.settings/**
17 changes: 17 additions & 0 deletions apps/erlang_ls/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>erlang_ls</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.erlide.core.erlbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.erlide.core.erlnature</nature>
</natures>
</projectDescription>
3 changes: 3 additions & 0 deletions apps/erlang_ls/.settings/org.eclipse.core.resources.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
encoding//src/erl_scan_local.erl=UTF-8
eclipse.preferences.version=1
encoding/<project>=ISO-8859-1
7 changes: 7 additions & 0 deletions apps/erlang_ls/.settings/org.erlide.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
backend_version=19.0
eclipse.preferences.version=1
external_includes=
external_modules=
include_dirs=include;
output_dir=ebin
source_dirs=src;
3 changes: 3 additions & 0 deletions apps/erlang_ls/.settings/org.erlide.model.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
builderData=INTERNAL|compile|clean|test|
configType=INTERNAL
eclipse.preferences.version=1
9 changes: 9 additions & 0 deletions apps/erlang_ls/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
erlang_ls
=====

An OTP application

Build
-----

$ rebar3 compile
7 changes: 7 additions & 0 deletions apps/erlang_ls/rebar.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

{deps, [

]}.

{escript_main_app, erlang_ls}.
{escript_comment, "%% v0.2.0\n"}.
16 changes: 16 additions & 0 deletions apps/erlang_ls/src/erlang_ls.app.src
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{application, erlang_ls,
[{description, "An OTP application"},
{vsn, "0.1.0"},
{registered, []},
{mod, { erlang_ls_app, []}},
{applications,
[kernel,
stdlib
]},
{env,[]},
{modules, []},

{maintainers, []},
{licenses, ["Apache 2.0"]},
{links, []}
]}.
33 changes: 33 additions & 0 deletions apps/erlang_ls/src/erlang_ls.erl
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
-module(erlang_ls).

-export([main/1]).

-define(DEFAULT_PORT, 9000).

main(Args) ->
case getopt:parse(cli_options(), Args) of
{ok, {Opts, _Other}} ->
Port = proplists:get_value(port, Opts, ?DEFAULT_PORT),

ok = application:load(lsp_server),
ok = application:set_env(lsp_server, port, Port),

case application:ensure_all_started(lsp_server, permanent) of
{ok, _R} ->
receive stop -> ok end,
ok;
_Err ->
io:format("Startup error: ~p~n", [_Err]),
ok
end;
_Err ->
io:format("Error: ~p~n", [_Err]),
getopt:usage(cli_options(), "lsp_server")
end,
ok.

cli_options() ->
[
{port, $p, "port", integer, "LSP server port"},
{verbose, $v, "verbose", integer, "Verbosity level"}
].
26 changes: 26 additions & 0 deletions apps/erlang_ls/src/erlang_ls_app.erl
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
%%%-------------------------------------------------------------------
%% @doc erlang_ls public API
%% @end
%%%-------------------------------------------------------------------

-module(erlang_ls_app).

-behaviour(application).

%% Application callbacks
-export([start/2, stop/1]).

%%====================================================================
%% API
%%====================================================================

start(_StartType, _StartArgs) ->
erlang_ls_sup:start_link().

%%--------------------------------------------------------------------
stop(_State) ->
ok.

%%====================================================================
%% Internal functions
%%====================================================================
35 changes: 35 additions & 0 deletions apps/erlang_ls/src/erlang_ls_sup.erl
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
%%%-------------------------------------------------------------------
%% @doc erlang_ls top level supervisor.
%% @end
%%%-------------------------------------------------------------------

-module(erlang_ls_sup).

-behaviour(supervisor).

%% API
-export([start_link/0]).

%% Supervisor callbacks
-export([init/1]).

-define(SERVER, ?MODULE).

%%====================================================================
%% API functions
%%====================================================================

start_link() ->
supervisor:start_link({local, ?SERVER}, ?MODULE, []).

%%====================================================================
%% Supervisor callbacks
%%====================================================================

%% Child :: {Id,StartFunc,Restart,Shutdown,Type,Modules}
init([]) ->
{ok, { {one_for_all, 0, 1}, []} }.

%%====================================================================
%% Internal functions
%%====================================================================
17 changes: 17 additions & 0 deletions apps/lsp_server/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>lsp_server</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.erlide.core.erlbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.erlide.core.erlnature</nature>
</natures>
</projectDescription>
3 changes: 3 additions & 0 deletions apps/lsp_server/.settings/org.eclipse.core.resources.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
encoding//src/erl_scan_local.erl=UTF-8
eclipse.preferences.version=1
encoding/<project>=ISO-8859-1
7 changes: 7 additions & 0 deletions apps/lsp_server/.settings/org.erlide.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
backend_version=19.0
eclipse.preferences.version=1
external_includes=
external_modules=
include_dirs=include;
output_dir=ebin
source_dirs=src;
3 changes: 3 additions & 0 deletions apps/lsp_server/.settings/org.erlide.model.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
builderData=INTERNAL|compile|clean|test|
configType=INTERNAL
eclipse.preferences.version=1
9 changes: 9 additions & 0 deletions apps/lsp_server/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
lsp_server
=====

An OTP application

Build
-----

$ rebar3 compile
Empty file added apps/lsp_server/include/.keep
Empty file.
Empty file added apps/lsp_server/priv/.keep
Empty file.
76 changes: 76 additions & 0 deletions apps/lsp_server/rebar.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
{require_otp_vsn, "20.*"}.

{plugins, [
rebar_covertool,
rebar3_hex
]}.

{deps, [
{jsx, "2.8.2"},
{getopt, "0.8.2"}
]}.

{erl_opts, [
warn_deprecated_function,
warn_export_all,
warn_export_vars,
warn_obsolete_guard,
warn_shadow_vars,
warn_unused_function,
warn_unused_import,
warn_unused_record,
warn_unused_vars,

nowarnings_as_errors
%warnings_as_errors
]}.
{erl_first_files, [
]}.

{edoc_opts,[{todo,true}]}.

{eunit_opts, [
verbose,
%nowarn_missing_spec,
nowarnings_as_errors,
{report,{eunit_surefire,[{dir,"."}]}}
]}.
{eunit_compile_opts, [
nowarn_missing_spec
]}.

{xref_warnings, true}.
{xref_checks, [
undefined_function_calls,
undefined_functions,
locals_not_used,
% exports_not_used,
deprecated_function_calls,
deprecated_functions
]}.

{dialyzer, [
%% Store PLT locally inside the project in .rebar (Default)
%% {plt_location, local},
%% Store PLT in custom directory
%% {plt_location, "custom_dir"},
{warnings, [unmatched_returns, error_handling, unknown]},
{base_plt_apps, [erts, kernel, stdlib, syntax_tools, tools]}
]}.

{cover_export_enabled, true}.
{cover_enabled, true}.
{cover_print_enable, true}.

{covertool_eunit, {"_build/test/cover/eunit.coverdata", "eunit.coverage.xml"}}.
{covertool_prefix_len, 0}.

{xref_checks,[
undefined_function_calls,
undefined_functions,
locals_not_used,
%exports_not_used,
deprecated_function_calls,
deprecated_functions
]}.

Loading

0 comments on commit 4580c7a

Please sign in to comment.