forked from erlang-ls/erlang_ls
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix regression: completion for incomplete export enrty
The unexpected atom (an incomplete function name) in the export attribute caused the below crash in the parser. This way the completion provider failed to determine that the location is in an export context, and used function snippet with arguments instead of '/arity'. For example when hitting enter on a completion erlang_ls used to insert `foo(Arg)` instead of `foo/1`. ``` 1> els_parser:parse("-export([foo])."). 2021-06-06T16:40:30.522244+02:00 warning: Please report error parsing form error:{try_clause,foo}:[{els_parser,'-skip_function_entries/1-fun-0-',1,[{file,"/Users/ext.pgomori/git/erlang_ls/apps/els_lsp/src/els_parser.erl"},{line,839}]},{lists,'-filter/2-lc$^0/1-0-',2,[{file,"lists.erl"},{line,1286}]},{els_parser,attribute_subtrees,2,[{file,"/Users/ext.pgomori/git/erlang_ls/apps/els_lsp/src/els_parser.erl"},{line,792}]},{els_parser,fold,3,[{file,"/Users/ext.pgomori/git/erlang_ls/apps/els_lsp/src/els_parser.erl"},{line,687}]},{els_parser,'-parse_forms/1-lc$^0/1-0-',1,[{file,"/Users/ext.pgomori/git/erlang_ls/apps/els_lsp/src/els_parser.erl"},{line,59}]},{els_parser,parse,1,[{file,"/Users/ext.pgomori/git/erlang_ls/apps/els_lsp/src/els_parser.erl"},{line,30}]},{erl_eval,do_apply,6,[{file,"erl_eval.erl"},{line,684}]},{shell,exprs,7,[{file,"shell.erl"},{line,686}]}], {attribute,#{end_location => {1,16},location => {1,1}},{atom,#{end_location => {1,8},location => {1,2},text => "export"},export},[{list,#{end_location => {1,14},location => {1,9}},[{atom,#{end_location => {1,13},location => {1,10},text => "foo"},foo}]}]} ```
- Loading branch information
1 parent
ed67dd0
commit c897127
Showing
4 changed files
with
74 additions
and
10 deletions.
There are no files selected for viewing
11 changes: 11 additions & 0 deletions
11
apps/els_lsp/priv/code_navigation/src/completion_incomplete.erl
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
-module(completion_incomplete). | ||
|
||
-export([ function_exported/0 | ||
, function_ | ||
]). | ||
|
||
function_exported() -> | ||
ok. | ||
|
||
function_unexported() -> | ||
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
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