-
Notifications
You must be signed in to change notification settings - Fork 136
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Skip indexing of generated files (#1255)
* Add ability to skip generated files (by tag in their header) * Allow generated files to be indexed on-demand * Better indexing report on completion
- Loading branch information
1 parent
ad06727
commit 9eed7d4
Showing
6 changed files
with
206 additions
and
26 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
-module(els_config_indexing). | ||
|
||
-include("els_core.hrl"). | ||
|
||
-export([ default_config/0 ]). | ||
|
||
%% Getters | ||
-export([ get_skip_generated_files/0 | ||
, get_generated_files_tag/0 | ||
]). | ||
|
||
-type config() :: #{ string() => string() }. | ||
|
||
-spec default_config() -> config(). | ||
default_config() -> | ||
#{ "skip_generated_files" => default_skip_generated_files() | ||
, "generated_files_tag" => default_generated_files_tag() | ||
}. | ||
|
||
-spec get_skip_generated_files() -> boolean(). | ||
get_skip_generated_files() -> | ||
Value = maps:get("skip_generated_files", | ||
els_config:get(indexing), | ||
default_skip_generated_files()), | ||
normalize_boolean(Value). | ||
|
||
-spec get_generated_files_tag() -> string(). | ||
get_generated_files_tag() -> | ||
maps:get("generated_files_tag", | ||
els_config:get(indexing), | ||
default_generated_files_tag()). | ||
|
||
-spec default_skip_generated_files() -> string(). | ||
default_skip_generated_files() -> | ||
"false". | ||
|
||
-spec default_generated_files_tag() -> string(). | ||
default_generated_files_tag() -> | ||
"@generated". | ||
|
||
-spec normalize_boolean(boolean() | string()) -> boolean(). | ||
normalize_boolean("true") -> true; | ||
normalize_boolean("false") -> false; | ||
normalize_boolean(Bool) when is_boolean(Bool) -> Bool. |
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
7 changes: 7 additions & 0 deletions
7
apps/els_lsp/test/els_indexer_SUITE_data/generated_file_by_custom_tag.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,7 @@ | ||
%% This file is @customgeneratedtag | ||
-module(generated_file_by_custom_tag). | ||
|
||
-export([main/0]). | ||
|
||
main() -> | ||
ok. |
7 changes: 7 additions & 0 deletions
7
apps/els_lsp/test/els_indexer_SUITE_data/generated_file_by_tag.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,7 @@ | ||
%% This file is @generated | ||
-module(generated_file_by_tag). | ||
|
||
-export([main/0]). | ||
|
||
main() -> | ||
ok. |