-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use default shutdown time for gen_lsp_server
Erlang/OTP `supervisor` documentation says: [1] > It is also allowed to set it to `infinity`, if the child process is a > worker. > > Warning > > Be careful when setting the shutdown time to `infinity` when the child > process is a worker. Because, in this situation, the termination of > the supervision tree depends on the child process, it must be > implemented in a safe way and its cleanup procedure must always > return. Therefore, the shutdown time of `gen_lsp_server` is changed from `infinity` to default value, that is `5000` milliseconds for worker processes. Additionally, a sketch of the application supervision tree is added to module header of `vscode_lsp_app` for easier understanding. The `-behaviour` attributes are added to the corresponding modules, also for easier understanding. [1] https://www.erlang.org/doc/man/supervisor.html
- Loading branch information
Kornel Horvath
committed
Nov 21, 2024
1 parent
2a7b0e7
commit 787d006
Showing
10 changed files
with
100 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,62 @@ | ||
%%%------------------------------------------------------------------- | ||
%%% @doc Erlang Language Server Process (LSP) for Visual Studio Code. | ||
%%% | ||
%%% Application supervision tree: | ||
%%% | ||
%%% ``` | ||
%%% vscode_lsp_entry | ||
%%% | | ||
%%% | vscode_lsp [app.src] | ||
%%% | | ||
%%% vscode_lsp_app [app] | ||
%%% | | ||
%%% vscode_lsp_app_sup [sup] | ||
%%% | | ||
%%% +--gen_lsp_sup [sup] | ||
%%% | | | ||
%%% | +--gen_lsp_server [gen_server] | ||
%%% | | ||
%%% +--gen_lsp_doc_sup [sup] | ||
%%% | | - (D)ETS document_contents | ||
%%% | | - (D)ETS document_inlayhints | ||
%%% | | - (D)ETS dodged_syntax_tree | ||
%%% | | - ETS references | ||
%%% | | - (D)ETS syntax_tree | ||
%%% | | | ||
%%% | +--gen_lsp_doc_server [gen_server] | ||
%%% | | ||
%%% +--gen_lsp_config_sup [sup] | ||
%%% | | | ||
%%% | +--gen_lsp_config_server [gen_server] | ||
%%% | | ||
%%% +--gen_lsp_help_sup [sup] | ||
%%% | | ||
%%% +--gen_lsp_help_server [gen_server] | ||
%%% ''' | ||
%%% | ||
%%% @end | ||
%%%------------------------------------------------------------------- | ||
-module(vscode_lsp_app). | ||
|
||
-behavior(application). | ||
|
||
%% Application callbacks | ||
-export([start/2, stop/1]). | ||
|
||
|
||
get_port() -> | ||
case init:get_argument(vscode_port) of | ||
{ok, [[P]]} -> P; | ||
_ -> "0" | ||
{ok, [[P]]} -> P; | ||
_ -> "0" | ||
end. | ||
|
||
|
||
start(_Type, _Args) -> | ||
application:start(inets), | ||
%uncomment to monitor erlang processes | ||
%spawn(fun() -> observer:start() end), | ||
Port = get_port(), | ||
case vscode_lsp_app_sup:start_link(Port) of | ||
{ok, Pid} -> | ||
{ok, Pid}; | ||
_Any -> _Any | ||
{ok, Pid} -> {ok, Pid}; | ||
_Any -> _Any | ||
end. | ||
|
||
stop(_State) -> | ||
ok. | ||
ok. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters