mirror of
https://github.com/vlang/v.git
synced 2025-09-13 22:42:26 +03:00
tools: cleanup vwatch.v
This commit is contained in:
parent
bad436c9f1
commit
b46c58a3a5
1 changed files with 5 additions and 5 deletions
|
@ -15,6 +15,8 @@ const scan_period_ms = 1000 / scan_frequency_hz
|
||||||
|
|
||||||
const max_scan_cycles = scan_timeout_s * scan_frequency_hz
|
const max_scan_cycles = scan_timeout_s * scan_frequency_hz
|
||||||
|
|
||||||
|
const default_vweb_suffixes = '*.v,*.html,*.css,*.js,*.md'
|
||||||
|
|
||||||
fn get_scan_timeout_seconds() int {
|
fn get_scan_timeout_seconds() int {
|
||||||
env_vw_timeout := os.getenv('VWATCH_TIMEOUT').int()
|
env_vw_timeout := os.getenv('VWATCH_TIMEOUT').int()
|
||||||
if env_vw_timeout == 0 {
|
if env_vw_timeout == 0 {
|
||||||
|
@ -165,17 +167,17 @@ fn (mut context Context) get_stats_for_affected_vfiles() []VFileStat {
|
||||||
|
|
||||||
if is_vweb_found {
|
if is_vweb_found {
|
||||||
if !os.args.any(it.starts_with('--only-watch')) {
|
if !os.args.any(it.starts_with('--only-watch')) {
|
||||||
|
context.only_watch = default_vweb_suffixes.split_any(',')
|
||||||
// vweb is often used with SQLite .db or .sqlite3 files right next to the executable/source,
|
// vweb is often used with SQLite .db or .sqlite3 files right next to the executable/source,
|
||||||
// that are updated by the vweb app, causing a restart of the app, which in turn causes the
|
// that are updated by the vweb app, causing a restart of the app, which in turn causes the
|
||||||
// browser to reload the current page, that probably triggered the update in the first place.
|
// browser to reload the current page, that probably triggered the update in the first place.
|
||||||
// Note that the problem is not specific to SQLite, any database that stores its files in the
|
// Note that the problem is not specific to SQLite, any database that stores its files in the
|
||||||
// current (project) folder, will also cause this.
|
// current (project) folder, will also cause this.
|
||||||
println('`v watch` detected that you are compiling a vweb project.')
|
println('`v watch` detected that you are compiling a vweb project.')
|
||||||
println(' Because of that, the `--only-watch=*.v,*.html,*.css,*.js` flag was also implied.')
|
println(' Because of that, the `--only-watch=${default_vweb_suffixes}` flag was also implied.')
|
||||||
println(' In result, `v watch` will ignore changes to other files.')
|
println(' In result, `v watch` will ignore changes to other files.')
|
||||||
println(' Add your own --only-watch filter, if you wish to override that choice.')
|
println(' Add your own --only-watch filter, if you wish to override that choice.')
|
||||||
println('')
|
println('')
|
||||||
context.only_watch = '*.v,*.html,*.css,*.js'.split_any(',')
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
context.affected_paths = apaths.keys()
|
context.affected_paths = apaths.keys()
|
||||||
|
@ -361,9 +363,7 @@ fn (mut context Context) compilation_runner_loop() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const ccontext = Context{
|
const ccontext = Context{}
|
||||||
child_process: 0
|
|
||||||
}
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
mut context := unsafe { &Context(voidptr(&ccontext)) }
|
mut context := unsafe { &Context(voidptr(&ccontext)) }
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue