Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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).
Expand Down
5 changes: 2 additions & 3 deletions apps/erlangbridge/src/gen_lsp_doc_server.erl
Original file line number Diff line number Diff line change
Expand Up @@ -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) ->
Expand Down
114 changes: 57 additions & 57 deletions apps/erlangbridge/src/lsp_syntax.erl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/RebarRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/lsp/lspclientextension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion lib/vscodeAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down