v -watch: support for VWATCH_IGNORE_EXTENSIONS

pull/9892/head^2
Delyan Angelov 2021-04-28 09:22:25 +03:00
parent c44ec9cd97
commit e4a2d1b239
No known key found for this signature in database
GPG Key ID: 66886C0F12D595ED
1 changed files with 5 additions and 0 deletions

View File

@ -77,6 +77,7 @@ mut:
scan_cycles int // how many times the worker has scanned for source file changes
clear_terminal bool // whether to clear the terminal before each re-run
add_files []string // path to additional files that have to be watched for changes
ignore_exts []string // extensions of files that will be ignored, even if they change (useful for sqlite.db files for example)
}
[if debug_vwatch]
@ -120,6 +121,9 @@ fn (mut context Context) get_stats_for_affected_vfiles() []VFileStat {
if pf_ext in ['', '.bak', '.exe', '.dll', '.so', '.def'] {
continue
}
if pf_ext in context.ignore_exts {
continue
}
if pf.starts_with('.#') {
continue
}
@ -258,6 +262,7 @@ fn main() {
context.is_worker = os.args.contains('-vwatchworker')
context.clear_terminal = os.getenv('VWATCH_CLEAR_TERMINAL') != ''
context.add_files = os.getenv('VWATCH_ADD_FILES').split(',')
context.ignore_exts = os.getenv('VWATCH_IGNORE_EXTENSIONS').split(',')
context.opts = os.args[1..].filter(it != '-vwatchworker')
context.elog('>>> context.pid: $context.pid')
context.elog('>>> context.vexe: $context.vexe')