json2: replace encoder with new implementation (#25224)
Some checks failed
Graphics CI / gg-regressions (push) Waiting to run
vlib modules CI / build-module-docs (push) Waiting to run
native backend CI / native-backend-ubuntu (push) Waiting to run
native backend CI / native-backend-windows (push) Waiting to run
Sanitized CI / sanitize-undefined-clang (push) Waiting to run
Sanitized CI / sanitize-undefined-gcc (push) Waiting to run
Sanitized CI / tests-sanitize-address-clang (push) Waiting to run
Sanitized CI / sanitize-address-msvc (push) Waiting to run
Sanitized CI / sanitize-address-gcc (push) Waiting to run
Sanitized CI / sanitize-memory-clang (push) Waiting to run
sdl CI / v-compiles-sdl-examples (push) Waiting to run
Time CI / time-linux (push) Waiting to run
Time CI / time-macos (push) Waiting to run
Time CI / time-windows (push) Waiting to run
toml CI / toml-module-pass-external-test-suites (push) Waiting to run
Tools CI / tools-windows (gcc) (push) Waiting to run
Tools CI / tools-linux (clang) (push) Waiting to run
Tools CI / tools-linux (gcc) (push) Waiting to run
Tools CI / tools-linux (tcc) (push) Waiting to run
Tools CI / tools-macos (clang) (push) Waiting to run
Tools CI / tools-windows (msvc) (push) Waiting to run
Tools CI / tools-windows (tcc) (push) Waiting to run
Tools CI / tools-docker-ubuntu-musl (push) Waiting to run
vab CI / vab-compiles-v-examples (push) Waiting to run
vab CI / v-compiles-os-android (push) Waiting to run
wasm backend CI / wasm-backend (windows-2022) (push) Waiting to run
wasm backend CI / wasm-backend (ubuntu-22.04) (push) Waiting to run
json decoder benchmark CI / json-encode-benchmark (push) Has been cancelled
json encoder benchmark CI / json-encode-benchmark (push) Has been cancelled

This commit is contained in:
Larsimusrex 2025-09-09 17:50:22 +02:00 committed by GitHub
parent 69e80ba96d
commit bae7684276
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
20 changed files with 902 additions and 1102 deletions

View file

@ -64,12 +64,6 @@ const vls_src_folder = os.join_path(vls_folder, 'src')
const server_not_found_err = error_with_code('Language server is not installed nor found.',
101)
const json_enc = json2.Encoder{
newline: `\n`
newline_spaces_count: 2
escape_unicode: false
}
fn (upd VlsUpdater) check_or_create_vls_folder() ! {
if !os.exists(vls_folder) {
upd.log('Creating .vls folder...')
@ -106,22 +100,11 @@ fn (upd VlsUpdater) update_manifest(new_path string, from_source bool, timestamp
}
}
mut manifest_file := os.open_file(vls_manifest_path, 'w+')!
defer {
manifest_file.close()
}
manifest['server_path'] = json2.Any(new_path)
manifest['last_updated'] = json2.Any(timestamp.format_ss())
manifest['from_source'] = json2.Any(from_source)
mut buffer := []u8{}
json_enc.encode_value(manifest, mut buffer)!
manifest_file.write(buffer)!
unsafe { buffer.free() }
os.write_file(vls_manifest_path, json2.encode(manifest))!
}
fn (upd VlsUpdater) init_download_prebuilt() ! {