From 453ff083055634e5ba04458e146fb5ed711347d1 Mon Sep 17 00:00:00 2001 From: Pierrick Gourlain Date: Sat, 22 Feb 2025 13:57:15 +0100 Subject: [PATCH 1/3] specify langageId on output channel creation --- lib/RebarRunner.ts | 2 +- lib/lsp/lspclientextension.ts | 2 +- lib/vscodeAdapter.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/RebarRunner.ts b/lib/RebarRunner.ts index ed9580c..00af572 100644 --- a/lib/RebarRunner.ts +++ b/lib/RebarRunner.ts @@ -232,7 +232,7 @@ export class RebarRunner implements vscode.Disposable { public static get RebarOutput(): vscode.OutputChannel { if (!rebarOutputChannel) { - rebarOutputChannel = vscode.window.createOutputChannel('rebar'); + rebarOutputChannel = vscode.window.createOutputChannel('rebar', 'erlang'); } return rebarOutputChannel; } diff --git a/lib/lsp/lspclientextension.ts b/lib/lsp/lspclientextension.ts index 22e5642..b196a1f 100644 --- a/lib/lsp/lspclientextension.ts +++ b/lib/lsp/lspclientextension.ts @@ -204,7 +204,7 @@ function getPort(callback) { export function activate(context: ExtensionContext) { let erlangCfg = getElangConfigConfiguration(); if (erlangCfg.verbose) - lspOutputChannel = Window.createOutputChannel('Erlang Language Server'); + lspOutputChannel = Window.createOutputChannel('Erlang Language Server', 'erlang'); lspValue.activate(context, lspOutputChannel); lspRename.activate(context, lspOutputChannel); diff --git a/lib/vscodeAdapter.ts b/lib/vscodeAdapter.ts index c30af14..cb1337a 100644 --- a/lib/vscodeAdapter.ts +++ b/lib/vscodeAdapter.ts @@ -6,7 +6,7 @@ var erlangOutputChannel : vscode.OutputChannel; export function ErlangOutput() : vscode.OutputChannel { if (!erlangOutputChannel) { - erlangOutputChannel = vscode.window.createOutputChannel('erlang'); + erlangOutputChannel = vscode.window.createOutputChannel('erlang', 'erlang'); } return erlangOutputChannel; } From 51fc4393a0084f6db1939ce784fb7ffd4326c14c Mon Sep 17 00:00:00 2001 From: Pierrick Gourlain Date: Sat, 22 Feb 2025 13:57:28 +0100 Subject: [PATCH 2/3] remove warnings --- apps/erlangbridge/src/gen_lsp_doc_server.erl | 5 +- apps/erlangbridge/src/lsp_syntax.erl | 114 +++++++++---------- 2 files changed, 59 insertions(+), 60 deletions(-) diff --git a/apps/erlangbridge/src/gen_lsp_doc_server.erl b/apps/erlangbridge/src/gen_lsp_doc_server.erl index 2aa7c28..f6a2fc8 100644 --- a/apps/erlangbridge/src/gen_lsp_doc_server.erl +++ b/apps/erlangbridge/src/gen_lsp_doc_server.erl @@ -469,11 +469,10 @@ safe_new_table(Name, dets, Type, ExtraCreateOpts) -> delete_cache_file(Name) -> case dets:info(Name, filename) of + undefined -> ok; FileName -> dets:close(Name), - file:delete(FileName); - _ -> - ok + file:delete(FileName) end. parse_and_store(File, ContentsFile) -> diff --git a/apps/erlangbridge/src/lsp_syntax.erl b/apps/erlangbridge/src/lsp_syntax.erl index 1ace80c..d2e93a3 100644 --- a/apps/erlangbridge/src/lsp_syntax.erl +++ b/apps/erlangbridge/src/lsp_syntax.erl @@ -119,69 +119,69 @@ lint(FileSyntaxTree, File) -> #{parse_result => false, error_message => <<"lint error">>} end. -combine_lint(LintResult, SyntaxTree, File) -> - case LintResult of - #{parse_result := ParseResult, errors_warnings := ErrorsWarnings} - when ParseResult =:= true -> - % combine only if previous parse is successfull - #{ - parse_result => ParseResult, - errors_warnings => lsp_lint(ErrorsWarnings, SyntaxTree, File) - }; - _ -> LintResult - end. +% combine_lint(LintResult, SyntaxTree, File) -> +% case LintResult of +% #{parse_result := ParseResult, errors_warnings := ErrorsWarnings} +% when ParseResult =:= true -> +% % combine only if previous parse is successfull +% #{ +% parse_result => ParseResult, +% errors_warnings => lsp_lint(ErrorsWarnings, SyntaxTree, File) +% }; +% _ -> LintResult +% end. -lsp_lint(PreviousLintResult, SyntaxTree, File) -> - RootWorkspace = gen_lsp_config_server:root(), - %%process remote call - fold_in_syntax_tree(fun - ({call, {_, _}, {remote, {_, _}, {atom, {Line, Column}, FnModule}, {atom, {_, _}, FnName}}, Args}, _CurrentFile, Acc) - -> - % Incr = 1 for last right parenthesis - Acc ++ check_if_remote_fun_exists(RootWorkspace, FnModule, FnName, length(Args), range_of(Line, Column, FnModule, FnName, Args, 1)); - ({'fun', {_, _}, {function, {atom, {Line, Column}, FnModule}, {atom, {_,_}, FnName}, {integer, {_, End}, FnArity}}}, _CurrentFile, Acc) - -> - Width = length(lsp_utils:to_string("~w",[FnArity])), - Acc ++ check_if_remote_fun_exists(RootWorkspace, FnModule, FnName, FnArity,{Line, Column, Line, End + Width}); +% lsp_lint(PreviousLintResult, SyntaxTree, File) -> +% RootWorkspace = gen_lsp_config_server:root(), +% %%process remote call +% fold_in_syntax_tree(fun +% ({call, {_, _}, {remote, {_, _}, {atom, {Line, Column}, FnModule}, {atom, {_, _}, FnName}}, Args}, _CurrentFile, Acc) +% -> +% % Incr = 1 for last right parenthesis +% Acc ++ check_if_remote_fun_exists(RootWorkspace, FnModule, FnName, length(Args), range_of(Line, Column, FnModule, FnName, Args, 1)); +% ({'fun', {_, _}, {function, {atom, {Line, Column}, FnModule}, {atom, {_,_}, FnName}, {integer, {_, End}, FnArity}}}, _CurrentFile, Acc) +% -> +% Width = length(lsp_utils:to_string("~w",[FnArity])), +% Acc ++ check_if_remote_fun_exists(RootWorkspace, FnModule, FnName, FnArity,{Line, Column, Line, End + Width}); - (_, _, Acc) -> Acc - end, - PreviousLintResult, File, SyntaxTree). +% (_, _, Acc) -> Acc +% end, +% PreviousLintResult, File, SyntaxTree). -range_of(Line, Column, MName, FName, Args, Incr) -> - {L,C, NewIncr} = if - length(Args) > 0 -> max_lc_root(lists:last(Args), {Line, Column, Incr}); - true -> - % +2 for parenthesis - {Line, Column, Incr + 2 + length(atom_to_list(MName)) +length(atom_to_list(FName))} - end, - {Line, Column, L, C+NewIncr}. +% range_of(Line, Column, MName, FName, Args, Incr) -> +% {L,C, NewIncr} = if +% length(Args) > 0 -> max_lc_root(lists:last(Args), {Line, Column, Incr}); +% true -> +% % +2 for parenthesis +% {Line, Column, Incr + 2 + length(atom_to_list(MName)) +length(atom_to_list(FName))} +% end, +% {Line, Column, L, C+NewIncr}. -max_lc_root({_,_,Atom}=Item, {Line, Column, Incr}) when is_atom(Atom) -> - max_lc(Item, {Line, Column, Incr + length(atom_to_list(Atom))}); -max_lc_root({_,_,Int}=Item, {Line, Column, Incr}) when is_number(Int) -> - ArgLength = length(lsp_utils:to_string("~w",[Int])), - max_lc(Item, {Line, Column, Incr + ArgLength}); -max_lc_root(Item, Acc) -> - max_lc(Item, Acc). +% max_lc_root({_,_,Atom}=Item, {Line, Column, Incr}) when is_atom(Atom) -> +% max_lc(Item, {Line, Column, Incr + length(atom_to_list(Atom))}); +% max_lc_root({_,_,Int}=Item, {Line, Column, Incr}) when is_number(Int) -> +% ArgLength = length(lsp_utils:to_string("~w",[Int])), +% max_lc(Item, {Line, Column, Incr + ArgLength}); +% max_lc_root(Item, Acc) -> +% max_lc(Item, Acc). --spec max_lc(Item:: term(), Acc :: term()) -> Acc1 :: term(). -max_lc({_, {L,C}, _}, {CL, CC, Incr}) when L > CL orelse (L =:= CL andalso C >= CC) -> - {L, C, Incr}; -max_lc({_, {_,_}, Item}, Acc) -> - max_lc(Item, Acc); -max_lc({call, {L,C}, Remote, Args}, {CL, CC, Incr}) when L > CL orelse (L =:= CL andalso C >= CC) -> - if - length(Args) > 0 -> max_lc_root(lists:last(Args), {L, C, Incr+1}); - true -> - case Remote of - {remote, _, {atom, _, _}, {atom,{RL, RC}, Atom}} -> {RL, RC, Incr + 1 + length(atom_to_list(Atom))}; - _ -> {L, C, Incr} - end - end; -max_lc(_, Acc) -> - Acc. +% -spec max_lc(Item:: term(), Acc :: term()) -> Acc1 :: term(). +% max_lc({_, {L,C}, _}, {CL, CC, Incr}) when L > CL orelse (L =:= CL andalso C >= CC) -> +% {L, C, Incr}; +% max_lc({_, {_,_}, Item}, Acc) -> +% max_lc(Item, Acc); +% max_lc({call, {L,C}, Remote, Args}, {CL, CC, Incr}) when L > CL orelse (L =:= CL andalso C >= CC) -> +% if +% length(Args) > 0 -> max_lc_root(lists:last(Args), {L, C, Incr+1}); +% true -> +% case Remote of +% {remote, _, {atom, _, _}, {atom,{RL, RC}, Atom}} -> {RL, RC, Incr + 1 + length(atom_to_list(Atom))}; +% _ -> {L, C, Incr} +% end +% end; +% max_lc(_, Acc) -> +% Acc. check_if_remote_fun_exists(RootWorkspace, FnModule, FnName, FnArity, {Line, Column, LE,LC}) -> % check if module is under workspace From b8dffc5af4629c9c7c30fcc0039e9f53eaef67ba Mon Sep 17 00:00:00 2001 From: Pierrick Gourlain Date: Sat, 22 Feb 2025 13:57:46 +0100 Subject: [PATCH 3/3] changelog --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 42a3105..7598987 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Change log +## Version 1.1.2 (February 22, 2025) + +* [320](https://github.com/pgourlain/vscode_erlang/issues/320) : Extension fails to start on vscode 1.96.4. +* [321](https://github.com/pgourlain/vscode_erlang/issues/321) : Remove warnings. + + ## Version 1.1.1 (December 8, 2024) * [319](https://github.com/pgourlain/vscode_erlang/issues/319) : Add a configuration setting to change the storage mode for large cache tables (mainly used for code navigation).