Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package ast-grep for openSUSE:Factory checked in at 2024-08-08 10:57:31 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ast-grep (Old) and /work/SRC/openSUSE:Factory/.ast-grep.new.7232 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "ast-grep" Thu Aug 8 10:57:31 2024 rev:35 rq:1192499 version:0.26.0+0 Changes: -------- --- /work/SRC/openSUSE:Factory/ast-grep/ast-grep.changes 2024-08-05 17:23:04.811562281 +0200 +++ /work/SRC/openSUSE:Factory/.ast-grep.new.7232/ast-grep.changes 2024-08-08 10:58:05.190850864 +0200 @@ -1,0 +2,20 @@ +Thu Aug 8 05:24:11 UTC 2024 - Michael Vetter <mvetter@suse.com> + +- Update to 0.26.0: + * feat: Additional impls for language types #1379 + * feat: append note to error message if available #1384 + * fix: LSP should skip files outside the workspace root #1382 + * fix(deps): update dependency @babel/core to v7.25.2 3b0be88 + * refactor: split two macros b760eb8 + * refactor: simplify visitor 5ae03ae + +------------------------------------------------------------------- +Wed Aug 7 05:33:51 UTC 2024 - Michael Vetter <mvetter@suse.com> + +- Update to 0.25.7: + * feat: add charCount to split lines #1381 + * chore(deps): update dependency @types/node to v20.14.14 bca7e7b + * fix(deps): update rust crate clap to v4.5.13 c143464 + * fix(deps): update rust crate toml_edit to v0.22.20 170da4c + +------------------------------------------------------------------- Old: ---- ast-grep-0.25.6+0.tar.zst New: ---- ast-grep-0.26.0+0.tar.zst ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ast-grep.spec ++++++ --- /var/tmp/diff_new_pack.ddnHWq/_old 2024-08-08 10:58:06.106888522 +0200 +++ /var/tmp/diff_new_pack.ddnHWq/_new 2024-08-08 10:58:06.106888522 +0200 @@ -17,7 +17,7 @@ Name: ast-grep -Version: 0.25.6+0 +Version: 0.26.0+0 Release: 0 Summary: A CLI tool for code structural search, lint and rewriting License: MIT ++++++ _service ++++++ --- /var/tmp/diff_new_pack.ddnHWq/_old 2024-08-08 10:58:06.138889838 +0200 +++ /var/tmp/diff_new_pack.ddnHWq/_new 2024-08-08 10:58:06.142890002 +0200 @@ -3,7 +3,7 @@ <param name="url">https://github.com/ast-grep/ast-grep.git</param> <param name="versionformat">@PARENT_TAG@+@TAG_OFFSET@</param> <param name="scm">git</param> - <param name="revision">0.25.6</param> + <param name="revision">0.26.0</param> <param name="match-tag">*</param> <param name="versionrewrite-pattern">v(\d+\.\d+\.\d+)</param> <param name="versionrewrite-replacement">\1</param> ++++++ ast-grep-0.25.6+0.tar.zst -> ast-grep-0.26.0+0.tar.zst ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ast-grep-0.25.6+0/CHANGELOG.md new/ast-grep-0.26.0+0/CHANGELOG.md --- old/ast-grep-0.25.6+0/CHANGELOG.md 2024-08-05 07:25:35.000000000 +0200 +++ new/ast-grep-0.26.0+0/CHANGELOG.md 2024-08-08 04:44:39.000000000 +0200 @@ -4,8 +4,28 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). +#### [0.26.0](https://github.com/ast-grep/ast-grep/compare/0.25.7...0.26.0) + +- feat: Additional impls for language types [`#1379`](https://github.com/ast-grep/ast-grep/pull/1379) +- feat: append note to error message if available [`#1384`](https://github.com/ast-grep/ast-grep/issues/1384) +- fix: LSP should skip files outside the workspace root [`#1382`](https://github.com/ast-grep/ast-grep/issues/1382) +- fix(deps): update dependency @babel/core to v7.25.2 [`3b0be88`](https://github.com/ast-grep/ast-grep/commit/3b0be882e0e280fcc7a5badd780e729c...) +- refactor: split two macros [`b760eb8`](https://github.com/ast-grep/ast-grep/commit/b760eb80e8439c50a9b66b3f38955746...) +- refactor: simplify visitor [`5ae03ae`](https://github.com/ast-grep/ast-grep/commit/5ae03ae015ef4a37ac8a023a58157ada...) + +#### [0.25.7](https://github.com/ast-grep/ast-grep/compare/0.25.6...0.25.7) + +> 5 August 2024 + +- feat: add charCount to split lines [`#1381`](https://github.com/ast-grep/ast-grep/issues/1381) +- chore(deps): update dependency @types/node to v20.14.14 [`bca7e7b`](https://github.com/ast-grep/ast-grep/commit/bca7e7be9a6580f44ab1979735c47f29...) +- fix(deps): update rust crate clap to v4.5.13 [`c143464`](https://github.com/ast-grep/ast-grep/commit/c1434644c010f1d69e8e6ae68c7549ad...) +- fix(deps): update rust crate toml_edit to v0.22.20 [`170da4c`](https://github.com/ast-grep/ast-grep/commit/170da4c5df25b5f0aef7e7d67a902cac...) + #### [0.25.6](https://github.com/ast-grep/ast-grep/compare/0.25.5...0.25.6) +> 4 August 2024 + - feat: add `--selector` in sg run [`#1378`](https://github.com/ast-grep/ast-grep/issues/1378) - fix: fix clippy new complaints [`a4cc793`](https://github.com/ast-grep/ast-grep/commit/a4cc793f5bf779947596fe7f441b71da...) - fix(deps): update dependency @swc/core to v1.7.5 [`d3ee100`](https://github.com/ast-grep/ast-grep/commit/d3ee100de1d16dfec1bf453a50447095...) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ast-grep-0.25.6+0/Cargo.lock new/ast-grep-0.26.0+0/Cargo.lock --- old/ast-grep-0.25.6+0/Cargo.lock 2024-08-05 07:25:35.000000000 +0200 +++ new/ast-grep-0.26.0+0/Cargo.lock 2024-08-08 04:44:39.000000000 +0200 @@ -113,7 +113,7 @@ [[package]] name = "ast-grep" -version = "0.25.6" +version = "0.26.0" dependencies = [ "ansi_term", "anyhow", @@ -144,7 +144,7 @@ [[package]] name = "ast-grep-config" -version = "0.25.6" +version = "0.26.0" dependencies = [ "anyhow", "ast-grep-core", @@ -160,7 +160,7 @@ [[package]] name = "ast-grep-core" -version = "0.25.6" +version = "0.26.0" dependencies = [ "bit-set", "regex", @@ -171,7 +171,7 @@ [[package]] name = "ast-grep-dynamic" -version = "0.25.6" +version = "0.26.0" dependencies = [ "ast-grep-core", "ignore", @@ -183,7 +183,7 @@ [[package]] name = "ast-grep-language" -version = "0.25.6" +version = "0.26.0" dependencies = [ "ast-grep-core", "ignore", @@ -215,7 +215,7 @@ [[package]] name = "ast-grep-lsp" -version = "0.25.6" +version = "0.26.0" dependencies = [ "ast-grep-config", "ast-grep-core", @@ -229,7 +229,7 @@ [[package]] name = "ast-grep-napi" -version = "0.25.6" +version = "0.26.0" dependencies = [ "ast-grep-config", "ast-grep-core", @@ -248,7 +248,7 @@ [[package]] name = "ast-grep-py" -version = "0.25.6" +version = "0.26.0" dependencies = [ "anyhow", "ast-grep-config", @@ -314,7 +314,7 @@ [[package]] name = "benches" -version = "0.25.6" +version = "0.26.0" dependencies = [ "ast-grep-config", "ast-grep-core", @@ -425,9 +425,9 @@ [[package]] name = "clap" -version = "4.5.11" +version = "4.5.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35723e6a11662c2afb578bcf0b88bf6ea8e21282a953428f240574fcc3a2b5b3" +checksum = "0fbb260a053428790f3de475e304ff84cdbc4face759ea7a3e64c1edd938a7fc" dependencies = [ "clap_builder", "clap_derive", @@ -435,9 +435,9 @@ [[package]] name = "clap_builder" -version = "4.5.11" +version = "4.5.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49eb96cbfa7cfa35017b7cd548c75b14c3118c98b423041d70562665e07fb0fa" +checksum = "64b17d7ea74e9f833c7dbf2cbe4fb12ff26783eda4782a8975b72f895c9b4d99" dependencies = [ "anstream", "anstyle", @@ -447,18 +447,18 @@ [[package]] name = "clap_complete" -version = "4.5.11" +version = "4.5.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6ae69fbb0833c6fcd5a8d4b8609f108c7ad95fc11e248d853ff2c42a90df26a" +checksum = "a8670053e87c316345e384ca1f3eba3006fc6355ed8b8a1140d104e109e3df34" dependencies = [ "clap", ] [[package]] name = "clap_derive" -version = "4.5.11" +version = "4.5.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d029b67f89d30bbb547c89fd5161293c0aec155fc691d7924b64550662db93e" +checksum = "501d359d5f3dcaf6ecdeee48833ae73ec6e42723a1e52419c79abf9507eec0a0" dependencies = [ "heck 0.5.0", "proc-macro2", @@ -968,7 +968,7 @@ checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4" dependencies = [ "cfg-if", - "windows-targets 0.52.5", + "windows-targets 0.48.5", ] [[package]] @@ -1535,9 +1535,9 @@ [[package]] name = "serde_json" -version = "1.0.121" +version = "1.0.122" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ab380d7d9f22ef3f21ad3e6c1ebe8e4fc7a2000ccba2e4d71fc96f15b2cb609" +checksum = "784b6203951c57ff748476b126ccb5e8e2959a5c19e5c617ab1956be3dbc68da" dependencies = [ "indexmap", "itoa", @@ -1646,12 +1646,13 @@ [[package]] name = "tempfile" -version = "3.10.1" +version = "3.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1" +checksum = "b8fcd239983515c23a32fb82099f97d0b11b8c72f654ed659363a95c3dad7a53" dependencies = [ "cfg-if", "fastrand", + "once_cell", "rustix", "windows-sys 0.52.0", ] @@ -1752,15 +1753,15 @@ [[package]] name = "toml_datetime" -version = "0.6.7" +version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8fb9f64314842840f1d940ac544da178732128f1c78c21772e876579e0da1db" +checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" [[package]] name = "toml_edit" -version = "0.22.17" +version = "0.22.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d9f8729f5aea9562aac1cc0441f5d6de3cff1ee0c5d67293eeca5eb36ee7c16" +checksum = "583c44c02ad26b0c3f3066fe629275e50627026c51ac2e595cca4c230ce1ce1d" dependencies = [ "indexmap", "toml_datetime", @@ -2023,9 +2024,9 @@ [[package]] name = "tree-sitter-kotlin" -version = "0.3.6" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c88dfbb22333118a5d5c5c10b19f93d115a6fa3c8a69dd0e6a260a64f9f5a79b" +checksum = "54ff60aeb036f5762515ceb31404512ea4f9599764bcd3857074bb82867bdd34" dependencies = [ "cc", "tree-sitter", @@ -2468,9 +2469,9 @@ [[package]] name = "winnow" -version = "0.6.8" +version = "0.6.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3c52e9c97a68071b23e836c9380edae937f17b9c4667bd021973efc689f618d" +checksum = "68a9bda4691f099d435ad181000724da8e5899daa10713c2d432552b9ccd3a6f" dependencies = [ "memchr", ] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ast-grep-0.25.6+0/Cargo.toml new/ast-grep-0.26.0+0/Cargo.toml --- old/ast-grep-0.25.6+0/Cargo.toml 2024-08-05 07:25:35.000000000 +0200 +++ new/ast-grep-0.26.0+0/Cargo.toml 2024-08-08 04:44:39.000000000 +0200 @@ -11,7 +11,7 @@ lto = true [workspace.package] -version = "0.25.6" +version = "0.26.0" authors = ["Herrington Darkholme <2883231+HerringtonDarkholme@users.noreply.github.com>"] edition = "2021" license = "MIT" @@ -22,11 +22,11 @@ readme = "README.md" [workspace.dependencies] -ast-grep-core = { path = "crates/core", version = "0.25.6" } -ast-grep-config = { path = "crates/config", version = "0.25.6" } -ast-grep-dynamic = { path = "crates/dynamic", version = "0.25.6" } -ast-grep-language = { path = "crates/language", version = "0.25.6" } -ast-grep-lsp = { path = "crates/lsp", version = "0.25.6" } +ast-grep-core = { path = "crates/core", version = "0.26.0" } +ast-grep-config = { path = "crates/config", version = "0.26.0" } +ast-grep-dynamic = { path = "crates/dynamic", version = "0.26.0" } +ast-grep-language = { path = "crates/language", version = "0.26.0" } +ast-grep-lsp = { path = "crates/lsp", version = "0.26.0" } bit-set = { version = "0.8.0" } ignore = { version = "0.4.22" } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ast-grep-0.25.6+0/benches/package.json new/ast-grep-0.26.0+0/benches/package.json --- old/ast-grep-0.25.6+0/benches/package.json 2024-08-05 07:25:35.000000000 +0200 +++ new/ast-grep-0.26.0+0/benches/package.json 2024-08-08 04:44:39.000000000 +0200 @@ -12,7 +12,7 @@ "license": "ISC", "dependencies": { "@ast-grep/napi": "link:../crates/napi", - "@babel/core": "7.24.9", + "@babel/core": "7.25.2", "@babel/plugin-syntax-typescript": "7.24.7", "@oxidation-compiler/napi": "0.2.0", "@swc/core": "1.7.5", @@ -23,7 +23,7 @@ }, "devDependencies": { "@types/babel__core": "7.20.5", - "@types/node": "20.14.13", + "@types/node": "20.14.14", "prettier": "3.3.3", "ts-node": "10.9.2" } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ast-grep-0.25.6+0/benches/pnpm-lock.yaml new/ast-grep-0.26.0+0/benches/pnpm-lock.yaml --- old/ast-grep-0.25.6+0/benches/pnpm-lock.yaml 2024-08-05 07:25:35.000000000 +0200 +++ new/ast-grep-0.26.0+0/benches/pnpm-lock.yaml 2024-08-08 04:44:39.000000000 +0200 @@ -9,11 +9,11 @@ specifier: link:../crates/napi version: link:../crates/napi '@babel/core': - specifier: 7.24.9 - version: 7.24.9 + specifier: 7.25.2 + version: 7.25.2 '@babel/plugin-syntax-typescript': specifier: 7.24.7 - version: 7.24.7(@babel/core@7.24.9) + version: 7.24.7(@babel/core@7.25.2) '@oxidation-compiler/napi': specifier: 0.2.0 version: 0.2.0 @@ -38,14 +38,14 @@ specifier: 7.20.5 version: 7.20.5 '@types/node': - specifier: 20.14.13 - version: 20.14.13 + specifier: 20.14.14 + version: 20.14.14 prettier: specifier: 3.3.3 version: 3.3.3 ts-node: specifier: 10.9.2 - version: 10.9.2(@swc/core@1.7.5)(@types/node@20.14.13)(typescript@5.5.4) + version: 10.9.2(@swc/core@1.7.5)(@types/node@20.14.14)(typescript@5.5.4) packages: @@ -94,25 +94,25 @@ picocolors: 1.0.1 dev: false - /@babel/compat-data@7.24.8: - resolution: {integrity: sha512-c4IM7OTg6k1Q+AJ153e2mc2QVTezTwnb4VzquwcyiEzGnW0Kedv4do/TrkU98qPeC5LNiMt/QXwIjzYXLBpyZg==} + /@babel/compat-data@7.25.2: + resolution: {integrity: sha512-bYcppcpKBvX4znYaPEeFau03bp89ShqNMLs+rmdptMw+heSZh9+z84d2YG+K7cYLbWwzdjtDoW/uqZmPjulClQ==} engines: {node: '>=6.9.0'} dev: false - /@babel/core@7.24.9: - resolution: {integrity: sha512-5e3FI4Q3M3Pbr21+5xJwCv6ZT6KmGkI0vw3Tozy5ODAQFTIWe37iT8Cr7Ice2Ntb+M3iSKCEWMB1MBgKrW3whg==} + /@babel/core@7.25.2: + resolution: {integrity: sha512-BBt3opiCOxUr9euZ5/ro/Xv8/V7yJ5bjYMqG/C1YAo8MIKAnumZalCN+msbci3Pigy4lIQfPUpfMM27HMGaYEA==} engines: {node: '>=6.9.0'} dependencies: '@ampproject/remapping': 2.2.1 '@babel/code-frame': 7.24.7 - '@babel/generator': 7.24.10 - '@babel/helper-compilation-targets': 7.24.8 - '@babel/helper-module-transforms': 7.24.9(@babel/core@7.24.9) - '@babel/helpers': 7.24.8 - '@babel/parser': 7.24.8 - '@babel/template': 7.24.7 - '@babel/traverse': 7.24.8 - '@babel/types': 7.24.9 + '@babel/generator': 7.25.0 + '@babel/helper-compilation-targets': 7.25.2 + '@babel/helper-module-transforms': 7.25.2(@babel/core@7.25.2) + '@babel/helpers': 7.25.0 + '@babel/parser': 7.25.3 + '@babel/template': 7.25.0 + '@babel/traverse': 7.25.3 + '@babel/types': 7.25.2 convert-source-map: 2.0.0 debug: 4.3.4 gensync: 1.0.0-beta.2 @@ -122,71 +122,48 @@ - supports-color dev: false - /@babel/generator@7.24.10: - resolution: {integrity: sha512-o9HBZL1G2129luEUlG1hB4N/nlYNWHnpwlND9eOMclRqqu1YDy2sSYVCFUZwl8I1Gxh+QSRrP2vD7EpUmFVXxg==} + /@babel/generator@7.25.0: + resolution: {integrity: sha512-3LEEcj3PVW8pW2R1SR1M89g/qrYk/m/mB/tLqn7dn4sbBUQyTqnlod+II2U4dqiGtUmkcnAmkMDralTFZttRiw==} engines: {node: '>=6.9.0'} dependencies: - '@babel/types': 7.24.9 + '@babel/types': 7.25.2 '@jridgewell/gen-mapping': 0.3.5 '@jridgewell/trace-mapping': 0.3.25 jsesc: 2.5.2 dev: false - /@babel/helper-compilation-targets@7.24.8: - resolution: {integrity: sha512-oU+UoqCHdp+nWVDkpldqIQL/i/bvAv53tRqLG/s+cOXxe66zOYLU7ar/Xs3LdmBihrUMEUhwu6dMZwbNOYDwvw==} + /@babel/helper-compilation-targets@7.25.2: + resolution: {integrity: sha512-U2U5LsSaZ7TAt3cfaymQ8WHh0pxvdHoEk6HVpaexxixjyEquMh0L0YNJNM6CTGKMXV1iksi0iZkGw4AcFkPaaw==} engines: {node: '>=6.9.0'} dependencies: - '@babel/compat-data': 7.24.8 + '@babel/compat-data': 7.25.2 '@babel/helper-validator-option': 7.24.8 browserslist: 4.23.2 lru-cache: 5.1.1 semver: 6.3.1 dev: false - /@babel/helper-environment-visitor@7.24.7: - resolution: {integrity: sha512-DoiN84+4Gnd0ncbBOM9AZENV4a5ZiL39HYMyZJGZ/AZEykHYdJw0wW3kdcsh9/Kn+BRXHLkkklZ51ecPKmI1CQ==} - engines: {node: '>=6.9.0'} - dependencies: - '@babel/types': 7.24.9 - dev: false - - /@babel/helper-function-name@7.24.7: - resolution: {integrity: sha512-FyoJTsj/PEUWu1/TYRiXTIHc8lbw+TDYkZuoE43opPS5TrI7MyONBE1oNvfguEXAD9yhQRrVBnXdXzSLQl9XnA==} - engines: {node: '>=6.9.0'} - dependencies: - '@babel/template': 7.24.7 - '@babel/types': 7.24.9 - dev: false - - /@babel/helper-hoist-variables@7.24.7: - resolution: {integrity: sha512-MJJwhkoGy5c4ehfoRyrJ/owKeMl19U54h27YYftT0o2teQ3FJ3nQUf/I3LlJsX4l3qlw7WRXUmiyajvHXoTubQ==} - engines: {node: '>=6.9.0'} - dependencies: - '@babel/types': 7.24.9 - dev: false - /@babel/helper-module-imports@7.24.7: resolution: {integrity: sha512-8AyH3C+74cgCVVXow/myrynrAGv+nTVg5vKu2nZph9x7RcRwzmh0VFallJuFTZ9mx6u4eSdXZfcOzSqTUm0HCA==} engines: {node: '>=6.9.0'} dependencies: - '@babel/traverse': 7.24.8 - '@babel/types': 7.24.9 + '@babel/traverse': 7.25.3 + '@babel/types': 7.25.2 transitivePeerDependencies: - supports-color dev: false - /@babel/helper-module-transforms@7.24.9(@babel/core@7.24.9): - resolution: {integrity: sha512-oYbh+rtFKj/HwBQkFlUzvcybzklmVdVV3UU+mN7n2t/q3yGHbuVdNxyFvSBO1tfvjyArpHNcWMAzsSPdyI46hw==} + /@babel/helper-module-transforms@7.25.2(@babel/core@7.25.2): + resolution: {integrity: sha512-BjyRAbix6j/wv83ftcVJmBt72QtHI56C7JXZoG2xATiLpmoC7dpd8WnkikExHDVPpi/3qCmO6WY1EaXOluiecQ==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0 dependencies: - '@babel/core': 7.24.9 - '@babel/helper-environment-visitor': 7.24.7 + '@babel/core': 7.25.2 '@babel/helper-module-imports': 7.24.7 '@babel/helper-simple-access': 7.24.7 - '@babel/helper-split-export-declaration': 7.24.7 '@babel/helper-validator-identifier': 7.24.7 + '@babel/traverse': 7.25.3 transitivePeerDependencies: - supports-color dev: false @@ -200,19 +177,12 @@ resolution: {integrity: sha512-zBAIvbCMh5Ts+b86r/CjU+4XGYIs+R1j951gxI3KmmxBMhCg4oQMsv6ZXQ64XOm/cvzfU1FmoCyt6+owc5QMYg==} engines: {node: '>=6.9.0'} dependencies: - '@babel/traverse': 7.24.8 - '@babel/types': 7.24.9 + '@babel/traverse': 7.25.3 + '@babel/types': 7.25.2 transitivePeerDependencies: - supports-color dev: false - /@babel/helper-split-export-declaration@7.24.7: - resolution: {integrity: sha512-oy5V7pD+UvfkEATUKvIjvIAH/xCzfsFVw7ygW2SI6NClZzquT+mwdTfgfdbUiceh6iQO0CHtCPsyze/MZ2YbAA==} - engines: {node: '>=6.9.0'} - dependencies: - '@babel/types': 7.24.9 - dev: false - /@babel/helper-string-parser@7.24.8: resolution: {integrity: sha512-pO9KhhRcuUyGnJWwyEgnRJTSIZHiT+vMD0kPeD+so0l7mxkMT19g3pjY9GTnHySck/hDzq+dtW/4VgnMkippsQ==} engines: {node: '>=6.9.0'} @@ -226,12 +196,12 @@ engines: {node: '>=6.9.0'} dev: false - /@babel/helpers@7.24.8: - resolution: {integrity: sha512-gV2265Nkcz7weJJfvDoAEVzC1e2OTDpkGbEsebse8koXUJUXPsCMi7sRo/+SPMuMZ9MtUPnGwITTnQnU5YjyaQ==} + /@babel/helpers@7.25.0: + resolution: {integrity: sha512-MjgLZ42aCm0oGjJj8CtSM3DB8NOOf8h2l7DCTePJs29u+v7yO/RBX9nShlKMgFnRks/Q4tBAe7Hxnov9VkGwLw==} engines: {node: '>=6.9.0'} dependencies: - '@babel/template': 7.24.7 - '@babel/types': 7.24.9 + '@babel/template': 7.25.0 + '@babel/types': 7.25.2 dev: false /@babel/highlight@7.24.7: @@ -249,7 +219,7 @@ engines: {node: '>=6.0.0'} hasBin: true dependencies: - '@babel/types': 7.24.8 + '@babel/types': 7.24.9 dev: true /@babel/parser@7.24.8: @@ -258,38 +228,44 @@ hasBin: true dependencies: '@babel/types': 7.24.9 + dev: true - /@babel/plugin-syntax-typescript@7.24.7(@babel/core@7.24.9): + /@babel/parser@7.25.3: + resolution: {integrity: sha512-iLTJKDbJ4hMvFPgQwwsVoxtHyWpKKPBrxkANrSYewDPaPpT5py5yeVkgPIJ7XYXhndxJpaA3PyALSXQ7u8e/Dw==} + engines: {node: '>=6.0.0'} + hasBin: true + dependencies: + '@babel/types': 7.25.2 + dev: false + + /@babel/plugin-syntax-typescript@7.24.7(@babel/core@7.25.2): resolution: {integrity: sha512-c/+fVeJBB0FeKsFvwytYiUD+LBvhHjGSI0g446PRGdSVGZLRNArBUno2PETbAly3tpiNAQR5XaZ+JslxkotsbA==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/core': 7.24.9 + '@babel/core': 7.25.2 '@babel/helper-plugin-utils': 7.24.7 dev: false - /@babel/template@7.24.7: - resolution: {integrity: sha512-jYqfPrU9JTF0PmPy1tLYHW4Mp4KlgxJD9l2nP9fD6yT/ICi554DmrWBAEYpIelzjHf1msDP3PxJIRt/nFNfBig==} + /@babel/template@7.25.0: + resolution: {integrity: sha512-aOOgh1/5XzKvg1jvVz7AVrx2piJ2XBi227DHmbY6y+bM9H2FlN+IfecYu4Xl0cNiiVejlsCri89LUsbj8vJD9Q==} engines: {node: '>=6.9.0'} dependencies: '@babel/code-frame': 7.24.7 - '@babel/parser': 7.24.8 - '@babel/types': 7.24.9 + '@babel/parser': 7.25.3 + '@babel/types': 7.25.2 dev: false - /@babel/traverse@7.24.8: - resolution: {integrity: sha512-t0P1xxAPzEDcEPmjprAQq19NWum4K0EQPjMwZQZbHt+GiZqvjCHjj755Weq1YRPVzBI+3zSfvScfpnuIecVFJQ==} + /@babel/traverse@7.25.3: + resolution: {integrity: sha512-HefgyP1x754oGCsKmV5reSmtV7IXj/kpaE1XYY+D9G5PvKKoFfSbiS4M77MdjuwlZKDIKFCffq9rPU+H/s3ZdQ==} engines: {node: '>=6.9.0'} dependencies: '@babel/code-frame': 7.24.7 - '@babel/generator': 7.24.10 - '@babel/helper-environment-visitor': 7.24.7 - '@babel/helper-function-name': 7.24.7 - '@babel/helper-hoist-variables': 7.24.7 - '@babel/helper-split-export-declaration': 7.24.7 - '@babel/parser': 7.24.8 - '@babel/types': 7.24.9 + '@babel/generator': 7.25.0 + '@babel/parser': 7.25.3 + '@babel/template': 7.25.0 + '@babel/types': 7.25.2 debug: 4.3.4 globals: 11.12.0 transitivePeerDependencies: @@ -305,8 +281,8 @@ to-fast-properties: 2.0.0 dev: true - /@babel/types@7.24.8: - resolution: {integrity: sha512-SkSBEHwwJRU52QEVZBmMBnE5Ux2/6WU1grdYyOhpbCNxbmJrDuDCphBzKZSO3taf0zztp+qkWlymE5tVL5l0TA==} + /@babel/types@7.24.9: + resolution: {integrity: sha512-xm8XrMKz0IlUdocVbYJe0Z9xEgidU7msskG8BbhnTPK/HZ2z/7FP7ykqPgrUH+C+r414mNfNWam1f2vqOjqjYQ==} engines: {node: '>=6.9.0'} dependencies: '@babel/helper-string-parser': 7.24.8 @@ -314,13 +290,14 @@ to-fast-properties: 2.0.0 dev: true - /@babel/types@7.24.9: - resolution: {integrity: sha512-xm8XrMKz0IlUdocVbYJe0Z9xEgidU7msskG8BbhnTPK/HZ2z/7FP7ykqPgrUH+C+r414mNfNWam1f2vqOjqjYQ==} + /@babel/types@7.25.2: + resolution: {integrity: sha512-YTnYtra7W9e6/oAZEHj0bJehPRUlLH9/fbpT5LfB0NhQXyALCRkRs3zH9v07IYhkgpqX6Z78FnuccZr/l4Fs4Q==} engines: {node: '>=6.9.0'} dependencies: '@babel/helper-string-parser': 7.24.8 '@babel/helper-validator-identifier': 7.24.7 to-fast-properties: 2.0.0 + dev: false /@cspotcode/source-map-support@0.8.1: resolution: {integrity: sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==} @@ -564,24 +541,24 @@ /@types/babel__generator@7.6.7: resolution: {integrity: sha512-6Sfsq+EaaLrw4RmdFWE9Onp63TOUue71AWb4Gpa6JxzgTYtimbM086WnYTy2U67AofR++QKCo08ZP6pwx8YFHQ==} dependencies: - '@babel/types': 7.24.8 + '@babel/types': 7.24.9 dev: true /@types/babel__template@7.4.4: resolution: {integrity: sha512-h/NUaSyG5EyxBIp8YRxo4RMe2/qQgvyowRwVMzhYhBCONbW8PUsg4lkFMrhgZhUe5z3L3MiLDuvyJ/CaPa2A8A==} dependencies: '@babel/parser': 7.24.8 - '@babel/types': 7.24.8 + '@babel/types': 7.24.9 dev: true /@types/babel__traverse@7.20.4: resolution: {integrity: sha512-mSM/iKUk5fDDrEV/e83qY+Cr3I1+Q3qqTuEn++HAWYjEa1+NxZr6CNrcJGf2ZTnq4HoFGC3zaTPZTobCzCFukA==} dependencies: - '@babel/types': 7.24.8 + '@babel/types': 7.24.9 dev: true - /@types/node@20.14.13: - resolution: {integrity: sha512-+bHoGiZb8UiQ0+WEtmph2IWQCjIqg8MDZMAV+ppRRhUZnquF5mQkP/9vpSwJClEiSM/C7fZZExPzfU0vJTyp8w==} + /@types/node@20.14.14: + resolution: {integrity: sha512-d64f00982fS9YoOgJkAMolK7MN8Iq3TDdVjchbYHdEmjth/DHowx82GnoA+tVUAN+7vxfYUgAzi+JXbKNd2SDQ==} dependencies: undici-types: 5.26.5 dev: true @@ -1201,7 +1178,7 @@ prebuild-install: 7.1.1 dev: false - /ts-node@10.9.2(@swc/core@1.7.5)(@types/node@20.14.13)(typescript@5.5.4): + /ts-node@10.9.2(@swc/core@1.7.5)(@types/node@20.14.14)(typescript@5.5.4): resolution: {integrity: sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==} hasBin: true peerDependencies: @@ -1221,7 +1198,7 @@ '@tsconfig/node12': 1.0.11 '@tsconfig/node14': 1.0.3 '@tsconfig/node16': 1.0.4 - '@types/node': 20.14.13 + '@types/node': 20.14.14 acorn: 8.10.0 acorn-walk: 8.2.0 arg: 4.1.3 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ast-grep-0.25.6+0/crates/cli/src/lang/lang_globs.rs new/ast-grep-0.26.0+0/crates/cli/src/lang/lang_globs.rs --- old/ast-grep-0.25.6+0/crates/cli/src/lang/lang_globs.rs 2024-08-05 07:25:35.000000000 +0200 +++ new/ast-grep-0.26.0+0/crates/cli/src/lang/lang_globs.rs 2024-08-08 04:44:39.000000000 +0200 @@ -15,6 +15,12 @@ pub unsafe fn register(regs: LanguageGlobs) -> Result<()> { debug_assert!(LANG_GLOBS.is_empty()); + let lang_globs = register_impl(regs)?; + _ = std::mem::replace(&mut *addr_of_mut!(LANG_GLOBS), lang_globs); + Ok(()) +} + +fn register_impl(regs: LanguageGlobs) -> Result<Vec<(SgLang, Types)>> { let mut lang_globs = vec![]; for (lang, globs) in regs { let lang = SgLang::from_str(&lang).with_context(|| EC::UnrecognizableLanguage(lang))?; @@ -24,8 +30,7 @@ let types = build_types(&lang_name, globs)?; lang_globs.push((lang, types)); } - _ = std::mem::replace(&mut *addr_of_mut!(LANG_GLOBS), lang_globs); - Ok(()) + Ok(lang_globs) } fn build_types(lang: &str, globs: Vec<String>) -> Result<Types> { @@ -115,24 +120,16 @@ #[test] fn test_register() -> Result<()> { let globs = get_globs(); - unsafe { - // cleanup - std::mem::take(&mut *addr_of_mut!(LANG_GLOBS)); - register(globs)?; - assert_eq!(LANG_GLOBS.len(), 2); - } + let lang_globs = register_impl(globs)?; + assert_eq!(lang_globs.len(), 2); Ok(()) } #[test] fn test_invalid_language() { let mut globs = get_globs(); - globs.insert("php".into(), vec!["bestlang".into()]); - let ret = unsafe { - // cleanup - std::mem::take(&mut *addr_of_mut!(LANG_GLOBS)); - register(globs) - }; + globs.insert("php-exp".into(), vec!["bestlang".into()]); + let ret = register_impl(globs); let err = ret.expect_err("should wrong"); assert!(matches!( err.downcast::<EC>(), diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ast-grep-0.25.6+0/crates/cli/src/print/json_print.rs new/ast-grep-0.26.0+0/crates/cli/src/print/json_print.rs --- old/ast-grep-0.25.6+0/crates/cli/src/print/json_print.rs 2024-08-05 07:25:35.000000000 +0200 +++ new/ast-grep-0.26.0+0/crates/cli/src/print/json_print.rs 2024-08-08 04:44:39.000000000 +0200 @@ -57,6 +57,16 @@ range: Range, } +/// a sub field of leading and trailing text count around match. +/// plugin authors can use it to split `lines` into leading, matching and trailing +/// See ast-grep/ast-grep#1381 +#[derive(Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +struct CharCount { + leading: usize, + trailing: usize, +} + #[derive(Serialize, Deserialize)] #[serde(rename_all = "camelCase")] struct MatchJSON<'a> { @@ -64,6 +74,7 @@ range: Range, file: Cow<'a, str>, lines: String, + char_count: CharCount, #[serde(skip_serializing_if = "Option::is_none")] replacement: Option<Cow<'a, str>>, #[serde(skip_serializing_if = "Option::is_none")] @@ -143,13 +154,17 @@ } impl<'a> MatchJSON<'a> { - fn new(nm: NodeMatch<'a, SgLang>, path: &'a str) -> Self { - let display = nm.display_context(0, 0); + fn new(nm: NodeMatch<'a, SgLang>, path: &'a str, context: (u16, u16)) -> Self { + let display = nm.display_context(context.0 as usize, context.1 as usize); let lines = format!("{}{}{}", display.leading, display.matched, display.trailing); MatchJSON { file: Cow::Borrowed(path), text: nm.text(), lines, + char_count: CharCount { + leading: display.leading.chars().count(), + trailing: display.trailing.chars().count(), + }, language: *nm.lang(), replacement: None, replacement_offsets: None, @@ -158,8 +173,8 @@ } } - fn diff(diff: Diff<'a>, path: &'a str) -> Self { - let mut ret = Self::new(diff.node_match, path); + fn diff(diff: Diff<'a>, path: &'a str, context: (u16, u16)) -> Self { + let mut ret = Self::new(diff.node_match, path, context); ret.replacement = Some(diff.replacement); ret.replacement_offsets = Some(diff.range); ret @@ -195,7 +210,7 @@ fn new(nm: NodeMatch<'a, SgLang>, path: &'a str, rule: &'a RuleConfig<SgLang>) -> Self { let message = rule.get_message(&nm); let labels = get_labels(&nm); - let matched = MatchJSON::new(nm, path); + let matched = MatchJSON::new(nm, path, (0, 0)); Self { matched, rule_id: &rule.id, @@ -209,7 +224,7 @@ let nm = &diff.node_match; let message = rule.get_message(nm); let labels = get_labels(nm); - let matched = MatchJSON::diff(diff, path); + let matched = MatchJSON::diff(diff, path, (0, 0)); Self { matched, rule_id: &rule.id, @@ -239,6 +254,7 @@ pub struct JSONPrinter<W: Write + Send + Sync> { output: Mutex<W>, style: JsonStyle, + context: (u16, u16), // indicate if any matches happened matched: AtomicBool, } @@ -254,10 +270,16 @@ Self { style, output: Mutex::new(output), + context: (0, 0), matched: AtomicBool::new(false), } } + pub fn context(mut self, context: (u16, u16)) -> Self { + self.context = context; + self + } + fn print_docs<S: Serialize>(&self, mut docs: impl Iterator<Item = S>) -> Result<()> { let Some(doc) = docs.next() else { return Ok(()); @@ -314,13 +336,13 @@ fn print_matches<'a>(&self, matches: Matches!('a), path: &Path) -> Result<()> { let path = path.to_string_lossy(); - let jsons = matches.map(|nm| MatchJSON::new(nm, &path)); + let jsons = matches.map(|nm| MatchJSON::new(nm, &path, self.context)); self.print_docs(jsons) } fn print_diffs<'a>(&self, diffs: Diffs!('a), path: &Path) -> Result<()> { let path = path.to_string_lossy(); - let jsons = diffs.map(|diff| MatchJSON::diff(diff, &path)); + let jsons = diffs.map(|diff| MatchJSON::diff(diff, &path, self.context)); self.print_docs(jsons) } fn print_rule_diffs( diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ast-grep-0.25.6+0/crates/cli/src/run.rs new/ast-grep-0.26.0+0/crates/cli/src/run.rs --- old/ast-grep-0.25.6+0/crates/cli/src/run.rs 2024-08-05 07:25:35.000000000 +0200 +++ new/ast-grep-0.26.0+0/crates/cli/src/run.rs 2024-08-08 04:44:39.000000000 +0200 @@ -170,15 +170,15 @@ // Every run will include Search or Replace // Search or Replace by arguments `pattern` and `rewrite` passed from CLI pub fn run_with_pattern(arg: RunArg) -> Result<()> { - if let Some(json) = arg.output.json { - let printer = JSONPrinter::stdout(json); - return run_pattern_with_printer(arg, printer); - } let context = if arg.context != 0 { (arg.context, arg.context) } else { (arg.before, arg.after) }; + if let Some(json) = arg.output.json { + let printer = JSONPrinter::stdout(json).context(context); + return run_pattern_with_printer(arg, printer); + } let printer = ColoredPrinter::stdout(arg.output.color) .heading(arg.heading) .context(context); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ast-grep-0.25.6+0/crates/language/src/html.rs new/ast-grep-0.26.0+0/crates/language/src/html.rs --- old/ast-grep-0.25.6+0/crates/language/src/html.rs 2024-08-05 07:25:35.000000000 +0200 +++ new/ast-grep-0.26.0+0/crates/language/src/html.rs 2024-08-08 04:44:39.000000000 +0200 @@ -6,7 +6,7 @@ // tree-sitter-html uses locale dependent iswalnum for tagName // https://github.com/tree-sitter/tree-sitter-html/blob/b5d9758e22b4d3d25704b72... -#[derive(Clone, Copy)] +#[derive(Clone, Copy, Debug)] pub struct Html; impl Language for Html { fn get_ts_language(&self) -> ast_grep_core::language::TSLanguage { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ast-grep-0.25.6+0/crates/language/src/lib.rs new/ast-grep-0.26.0+0/crates/language/src/lib.rs --- old/ast-grep-0.25.6+0/crates/language/src/lib.rs 2024-08-05 07:25:35.000000000 +0200 +++ new/ast-grep-0.26.0+0/crates/language/src/lib.rs 2024-08-08 04:44:39.000000000 +0200 @@ -32,6 +32,7 @@ use ast_grep_core::meta_var::MetaVariable; use ast_grep_core::{Doc, Node}; use ignore::types::{Types, TypesBuilder}; +use serde::de::Visitor; use serde::{de, Deserialize, Deserializer, Serialize}; use std::borrow::Cow; use std::collections::HashMap; @@ -46,7 +47,7 @@ /// this macro implements bare-bone methods for a language macro_rules! impl_lang { ($lang: ident, $func: ident) => { - #[derive(Clone, Copy)] + #[derive(Clone, Copy, Debug)] pub struct $lang; impl Language for $lang { fn get_ts_language(&self) -> TSLanguage { @@ -81,7 +82,7 @@ /// use this if your language does not accept $ as valid identifier char macro_rules! impl_lang_expando { ($lang: ident, $func: ident, $char: expr) => { - #[derive(Clone, Copy)] + #[derive(Clone, Copy, Debug)] pub struct $lang; impl ast_grep_core::language::Language for $lang { fn get_ts_language(&self) -> ast_grep_core::language::TSLanguage { @@ -97,6 +98,53 @@ }; } +/// Implements the `ALIAS` associated constant for the given lang, which is +/// then used to define the `alias` const fn and a `Deserialize` impl. +macro_rules! impl_alias { + ($lang:ident => $as:expr) => { + impl $lang { + pub const ALIAS: &'static [&'static str] = $as; + } + + impl fmt::Display for $lang { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + write!(f, "{:?}", self) + } + } + + impl<'de> Deserialize<'de> for $lang { + fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> + where + D: Deserializer<'de>, + { + let vis = AliasVisitor { + aliases: Self::ALIAS, + }; + deserializer.deserialize_str(vis)?; + Ok($lang) + } + } + + impl From<$lang> for SupportLang { + fn from(_: $lang) -> Self { + Self::$lang + } + } + }; +} +/// Generates as convenience conversions between the lang types +/// and `SupportedType`. +macro_rules! impl_aliases { + ($($lang:ident => $as:expr),* $(,)?) => { + $(impl_alias!($lang => $as);)* + const fn alias(lang: SupportLang) -> &'static [&'static str] { + match lang { + $(SupportLang::$lang => $lang::ALIAS),* + } + } + }; +} + /* Customized Language with expando_char / pre_process_pattern */ // https://en.cppreference.com/w/cpp/language/identifiers // Due to some issues in the tree-sitter parser, it is not possible to use @@ -187,12 +235,12 @@ } pub fn file_types(&self) -> Types { - file_types(self) + file_types(*self) } } impl fmt::Display for SupportLang { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "{:?}", self) } } @@ -218,49 +266,85 @@ where D: Deserializer<'de>, { - let s = String::deserialize(deserializer)?; - FromStr::from_str(&s).map_err(de::Error::custom) + deserializer.deserialize_str(SupportLangVisitor) } } -const fn alias(lang: &SupportLang) -> &[&str] { - use SupportLang::*; - match lang { - Bash => &["bash-exp"], - C => &["c"], - Cpp => &["cc", "c++", "cpp", "cxx"], - CSharp => &["cs", "csharp"], - Css => &["css"], - Dart => &["dart"], - Elixir => &["ex", "elixir"], - Go => &["go", "golang"], - Haskell => &["hs", "haskell"], - Html => &["html"], - Java => &["java"], - JavaScript => &["javascript", "js", "jsx"], - Json => &["json"], - Kotlin => &["kotlin", "kt"], - Lua => &["lua"], - Php => &["php-exp"], - Python => &["py", "python"], - Ruby => &["rb", "ruby"], - Rust => &["rs", "rust"], - Scala => &["scala"], - Sql => &["sql"], - Swift => &["swift"], - TypeScript => &["ts", "typescript"], - Tsx => &["tsx"], +struct SupportLangVisitor; + +impl<'de> Visitor<'de> for SupportLangVisitor { + type Value = SupportLang; + + fn expecting(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.write_str("SupportLang") + } + + fn visit_str<E>(self, v: &str) -> Result<Self::Value, E> + where + E: de::Error, + { + v.parse().map_err(de::Error::custom) } } +struct AliasVisitor { + aliases: &'static [&'static str], +} + +impl<'de> Visitor<'de> for AliasVisitor { + type Value = &'static str; + + fn expecting(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "one of {:?}", self.aliases) + } + + fn visit_str<E>(self, v: &str) -> Result<Self::Value, E> + where + E: de::Error, + { + self + .aliases + .iter() + .copied() + .find(|&a| v.eq_ignore_ascii_case(a)) + .ok_or_else(|| de::Error::invalid_value(de::Unexpected::Str(v), &self)) + } +} + +impl_aliases! { + Bash => &["bash"], + C => &["c"], + Cpp => &["cc", "c++", "cpp", "cxx"], + CSharp => &["cs", "csharp"], + Css => &["css"], + Dart => &["dart"], + Elixir => &["ex", "elixir"], + Go => &["go", "golang"], + Haskell => &["hs", "haskell"], + Html => &["html"], + Java => &["java"], + JavaScript => &["javascript", "js", "jsx"], + Json => &["json"], + Kotlin => &["kotlin", "kt"], + Lua => &["lua"], + Php => &["php"], + Python => &["py", "python"], + Ruby => &["rb", "ruby"], + Rust => &["rs", "rust"], + Scala => &["scala"], + Sql => &["sql"], + Swift => &["swift"], + TypeScript => &["ts", "typescript"], + Tsx => &["tsx"], +} /// Implements the language names and aliases. impl FromStr for SupportLang { type Err = SupportLangErr; fn from_str(s: &str) -> Result<Self, Self::Err> { - for lang in Self::all_langs() { + for &lang in Self::all_langs() { for moniker in alias(lang) { if s.eq_ignore_ascii_case(moniker) { - return Ok(*lang); + return Ok(lang); } } } @@ -332,7 +416,7 @@ } } -fn extensions(lang: &SupportLang) -> &[&str] { +fn extensions(lang: SupportLang) -> &'static [&'static str] { use SupportLang::*; match lang { Bash => &[ @@ -372,7 +456,7 @@ SupportLang::all_langs() .iter() .copied() - .find(|l| extensions(l).contains(&ext)) + .find(|&l| extensions(l).contains(&ext)) } fn add_custom_file_type<'b>( @@ -389,7 +473,7 @@ builder.select(file_type) } -fn file_types(lang: &SupportLang) -> Types { +fn file_types(lang: SupportLang) -> Types { let mut builder = TypesBuilder::new(); let exts = extensions(lang); let lang_name = lang.to_string(); @@ -427,6 +511,7 @@ cand.root().to_sexp(), ); } + pub fn test_replace_lang( src: &str, pattern: &str, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ast-grep-0.25.6+0/crates/lsp/src/lib.rs new/ast-grep-0.26.0+0/crates/lsp/src/lib.rs --- old/ast-grep-0.25.6+0/crates/lsp/src/lib.rs 2024-08-05 07:25:35.000000000 +0200 +++ new/ast-grep-0.26.0+0/crates/lsp/src/lib.rs 2024-08-08 04:44:39.000000000 +0200 @@ -226,6 +226,10 @@ async fn on_open(&self, params: DidOpenTextDocumentParams) -> Option<()> { let text_doc = params.text_document; + // skip files outside of workspace root #1382 + if !text_doc.uri.to_file_path().ok()?.starts_with(&self.base) { + return None; + } let uri = text_doc.uri.as_str().to_owned(); let text = text_doc.text; self diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ast-grep-0.25.6+0/crates/lsp/src/utils.rs new/ast-grep-0.26.0+0/crates/lsp/src/utils.rs --- old/ast-grep-0.25.6+0/crates/lsp/src/utils.rs 2024-08-05 07:25:35.000000000 +0200 +++ new/ast-grep-0.26.0+0/crates/lsp/src/utils.rs 2024-08-08 04:44:39.000000000 +0200 @@ -100,10 +100,16 @@ fn get_non_empty_message<L: Language>(rule: &RuleConfig<L>, nm: &NodeMatch<StrDoc<L>>) -> String { // Note: The LSP client in vscode won't show any diagnostics at all if it receives one with an empty message - if rule.message.is_empty() { + let msg = if rule.message.is_empty() { rule.id.to_string() } else { rule.get_message(nm) + }; + // append note to message ast-grep/ast-grep-vscode#352 + if let Some(note) = &rule.note { + format!("{msg}\n\n{note}") + } else { + msg } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ast-grep-0.25.6+0/crates/napi/npm/darwin-arm64/package.json new/ast-grep-0.26.0+0/crates/napi/npm/darwin-arm64/package.json --- old/ast-grep-0.25.6+0/crates/napi/npm/darwin-arm64/package.json 2024-08-05 07:25:35.000000000 +0200 +++ new/ast-grep-0.26.0+0/crates/napi/npm/darwin-arm64/package.json 2024-08-08 04:44:39.000000000 +0200 @@ -1,6 +1,6 @@ { "name": "@ast-grep/napi-darwin-arm64", - "version": "0.25.6", + "version": "0.26.0", "os": [ "darwin" ], diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ast-grep-0.25.6+0/crates/napi/npm/darwin-x64/package.json new/ast-grep-0.26.0+0/crates/napi/npm/darwin-x64/package.json --- old/ast-grep-0.25.6+0/crates/napi/npm/darwin-x64/package.json 2024-08-05 07:25:35.000000000 +0200 +++ new/ast-grep-0.26.0+0/crates/napi/npm/darwin-x64/package.json 2024-08-08 04:44:39.000000000 +0200 @@ -1,6 +1,6 @@ { "name": "@ast-grep/napi-darwin-x64", - "version": "0.25.6", + "version": "0.26.0", "os": [ "darwin" ], diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ast-grep-0.25.6+0/crates/napi/npm/linux-arm64-gnu/package.json new/ast-grep-0.26.0+0/crates/napi/npm/linux-arm64-gnu/package.json --- old/ast-grep-0.25.6+0/crates/napi/npm/linux-arm64-gnu/package.json 2024-08-05 07:25:35.000000000 +0200 +++ new/ast-grep-0.26.0+0/crates/napi/npm/linux-arm64-gnu/package.json 2024-08-08 04:44:39.000000000 +0200 @@ -1,6 +1,6 @@ { "name": "@ast-grep/napi-linux-arm64-gnu", - "version": "0.25.6", + "version": "0.26.0", "os": [ "linux" ], diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ast-grep-0.25.6+0/crates/napi/npm/linux-arm64-musl/package.json new/ast-grep-0.26.0+0/crates/napi/npm/linux-arm64-musl/package.json --- old/ast-grep-0.25.6+0/crates/napi/npm/linux-arm64-musl/package.json 2024-08-05 07:25:35.000000000 +0200 +++ new/ast-grep-0.26.0+0/crates/napi/npm/linux-arm64-musl/package.json 2024-08-08 04:44:39.000000000 +0200 @@ -1,6 +1,6 @@ { "name": "@ast-grep/napi-linux-arm64-musl", - "version": "0.25.6", + "version": "0.26.0", "os": [ "linux" ], diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ast-grep-0.25.6+0/crates/napi/npm/linux-x64-gnu/package.json new/ast-grep-0.26.0+0/crates/napi/npm/linux-x64-gnu/package.json --- old/ast-grep-0.25.6+0/crates/napi/npm/linux-x64-gnu/package.json 2024-08-05 07:25:35.000000000 +0200 +++ new/ast-grep-0.26.0+0/crates/napi/npm/linux-x64-gnu/package.json 2024-08-08 04:44:39.000000000 +0200 @@ -1,6 +1,6 @@ { "name": "@ast-grep/napi-linux-x64-gnu", - "version": "0.25.6", + "version": "0.26.0", "os": [ "linux" ], diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ast-grep-0.25.6+0/crates/napi/npm/linux-x64-musl/package.json new/ast-grep-0.26.0+0/crates/napi/npm/linux-x64-musl/package.json --- old/ast-grep-0.25.6+0/crates/napi/npm/linux-x64-musl/package.json 2024-08-05 07:25:35.000000000 +0200 +++ new/ast-grep-0.26.0+0/crates/napi/npm/linux-x64-musl/package.json 2024-08-08 04:44:39.000000000 +0200 @@ -1,6 +1,6 @@ { "name": "@ast-grep/napi-linux-x64-musl", - "version": "0.25.6", + "version": "0.26.0", "os": [ "linux" ], diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ast-grep-0.25.6+0/crates/napi/npm/win32-arm64-msvc/package.json new/ast-grep-0.26.0+0/crates/napi/npm/win32-arm64-msvc/package.json --- old/ast-grep-0.25.6+0/crates/napi/npm/win32-arm64-msvc/package.json 2024-08-05 07:25:35.000000000 +0200 +++ new/ast-grep-0.26.0+0/crates/napi/npm/win32-arm64-msvc/package.json 2024-08-08 04:44:39.000000000 +0200 @@ -1,6 +1,6 @@ { "name": "@ast-grep/napi-win32-arm64-msvc", - "version": "0.25.6", + "version": "0.26.0", "os": [ "win32" ], diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ast-grep-0.25.6+0/crates/napi/npm/win32-ia32-msvc/package.json new/ast-grep-0.26.0+0/crates/napi/npm/win32-ia32-msvc/package.json --- old/ast-grep-0.25.6+0/crates/napi/npm/win32-ia32-msvc/package.json 2024-08-05 07:25:35.000000000 +0200 +++ new/ast-grep-0.26.0+0/crates/napi/npm/win32-ia32-msvc/package.json 2024-08-08 04:44:39.000000000 +0200 @@ -1,6 +1,6 @@ { "name": "@ast-grep/napi-win32-ia32-msvc", - "version": "0.25.6", + "version": "0.26.0", "os": [ "win32" ], diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ast-grep-0.25.6+0/crates/napi/npm/win32-x64-msvc/package.json new/ast-grep-0.26.0+0/crates/napi/npm/win32-x64-msvc/package.json --- old/ast-grep-0.25.6+0/crates/napi/npm/win32-x64-msvc/package.json 2024-08-05 07:25:35.000000000 +0200 +++ new/ast-grep-0.26.0+0/crates/napi/npm/win32-x64-msvc/package.json 2024-08-08 04:44:39.000000000 +0200 @@ -1,6 +1,6 @@ { "name": "@ast-grep/napi-win32-x64-msvc", - "version": "0.25.6", + "version": "0.26.0", "os": [ "win32" ], diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ast-grep-0.25.6+0/crates/napi/package.json new/ast-grep-0.26.0+0/crates/napi/package.json --- old/ast-grep-0.25.6+0/crates/napi/package.json 2024-08-05 07:25:35.000000000 +0200 +++ new/ast-grep-0.26.0+0/crates/napi/package.json 2024-08-08 04:44:39.000000000 +0200 @@ -1,6 +1,6 @@ { "name": "@ast-grep/napi", - "version": "0.25.6", + "version": "0.26.0", "description": "Search and Rewrite code at large scale using precise AST pattern", "homepage": "https://ast-grep.github.io", "main": "index.js", diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ast-grep-0.25.6+0/crates/pyo3/pyproject.toml new/ast-grep-0.26.0+0/crates/pyo3/pyproject.toml --- old/ast-grep-0.25.6+0/crates/pyo3/pyproject.toml 2024-08-05 07:25:35.000000000 +0200 +++ new/ast-grep-0.26.0+0/crates/pyo3/pyproject.toml 2024-08-08 04:44:39.000000000 +0200 @@ -5,7 +5,7 @@ [project] name = "ast-grep-py" requires-python = ">=3.8" -version = "0.25.6" +version = "0.26.0" description = "Structural Search and Rewrite code at large scale using precise AST pattern." authors = [{ name = "Herrington Darkholme", email = "2883231+HerringtonDarkholme@users.noreply.github.com" }] maintainers = [{ name = "Herrington Darkholme", email = "2883231+HerringtonDarkholme@users.noreply.github.com" }] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ast-grep-0.25.6+0/npm/package.json new/ast-grep-0.26.0+0/npm/package.json --- old/ast-grep-0.25.6+0/npm/package.json 2024-08-05 07:25:35.000000000 +0200 +++ new/ast-grep-0.26.0+0/npm/package.json 2024-08-08 04:44:39.000000000 +0200 @@ -1,6 +1,6 @@ { "name": "@ast-grep/cli", - "version": "0.25.6", + "version": "0.26.0", "publishConfig": { "access": "public" }, @@ -29,13 +29,13 @@ "postinstall": "node postinstall.js" }, "optionalDependencies": { - "@ast-grep/cli-win32-arm64-msvc": "0.25.6", - "@ast-grep/cli-win32-ia32-msvc": "0.25.6", - "@ast-grep/cli-win32-x64-msvc": "0.25.6", - "@ast-grep/cli-darwin-arm64": "0.25.6", - "@ast-grep/cli-darwin-x64": "0.25.6", - "@ast-grep/cli-linux-arm64-gnu": "0.25.6", - "@ast-grep/cli-linux-x64-gnu": "0.25.6" + "@ast-grep/cli-win32-arm64-msvc": "0.26.0", + "@ast-grep/cli-win32-ia32-msvc": "0.26.0", + "@ast-grep/cli-win32-x64-msvc": "0.26.0", + "@ast-grep/cli-darwin-arm64": "0.26.0", + "@ast-grep/cli-darwin-x64": "0.26.0", + "@ast-grep/cli-linux-arm64-gnu": "0.26.0", + "@ast-grep/cli-linux-x64-gnu": "0.26.0" }, "bin": { "sg": "sg", diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ast-grep-0.25.6+0/npm/platforms/darwin-arm64/package.json new/ast-grep-0.26.0+0/npm/platforms/darwin-arm64/package.json --- old/ast-grep-0.25.6+0/npm/platforms/darwin-arm64/package.json 2024-08-05 07:25:35.000000000 +0200 +++ new/ast-grep-0.26.0+0/npm/platforms/darwin-arm64/package.json 2024-08-08 04:44:39.000000000 +0200 @@ -1,6 +1,6 @@ { "name": "@ast-grep/cli-darwin-arm64", - "version": "0.25.6", + "version": "0.26.0", "os": [ "darwin" ], diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ast-grep-0.25.6+0/npm/platforms/darwin-x64/package.json new/ast-grep-0.26.0+0/npm/platforms/darwin-x64/package.json --- old/ast-grep-0.25.6+0/npm/platforms/darwin-x64/package.json 2024-08-05 07:25:35.000000000 +0200 +++ new/ast-grep-0.26.0+0/npm/platforms/darwin-x64/package.json 2024-08-08 04:44:39.000000000 +0200 @@ -1,6 +1,6 @@ { "name": "@ast-grep/cli-darwin-x64", - "version": "0.25.6", + "version": "0.26.0", "os": [ "darwin" ], diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ast-grep-0.25.6+0/npm/platforms/linux-arm64-gnu/package.json new/ast-grep-0.26.0+0/npm/platforms/linux-arm64-gnu/package.json --- old/ast-grep-0.25.6+0/npm/platforms/linux-arm64-gnu/package.json 2024-08-05 07:25:35.000000000 +0200 +++ new/ast-grep-0.26.0+0/npm/platforms/linux-arm64-gnu/package.json 2024-08-08 04:44:39.000000000 +0200 @@ -1,6 +1,6 @@ { "name": "@ast-grep/cli-linux-arm64-gnu", - "version": "0.25.6", + "version": "0.26.0", "os": [ "linux" ], diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ast-grep-0.25.6+0/npm/platforms/linux-x64-gnu/package.json new/ast-grep-0.26.0+0/npm/platforms/linux-x64-gnu/package.json --- old/ast-grep-0.25.6+0/npm/platforms/linux-x64-gnu/package.json 2024-08-05 07:25:35.000000000 +0200 +++ new/ast-grep-0.26.0+0/npm/platforms/linux-x64-gnu/package.json 2024-08-08 04:44:39.000000000 +0200 @@ -1,6 +1,6 @@ { "name": "@ast-grep/cli-linux-x64-gnu", - "version": "0.25.6", + "version": "0.26.0", "os": [ "linux" ], diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ast-grep-0.25.6+0/npm/platforms/win32-arm64-msvc/package.json new/ast-grep-0.26.0+0/npm/platforms/win32-arm64-msvc/package.json --- old/ast-grep-0.25.6+0/npm/platforms/win32-arm64-msvc/package.json 2024-08-05 07:25:35.000000000 +0200 +++ new/ast-grep-0.26.0+0/npm/platforms/win32-arm64-msvc/package.json 2024-08-08 04:44:39.000000000 +0200 @@ -1,6 +1,6 @@ { "name": "@ast-grep/cli-win32-arm64-msvc", - "version": "0.25.6", + "version": "0.26.0", "os": [ "win32" ], diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ast-grep-0.25.6+0/npm/platforms/win32-ia32-msvc/package.json new/ast-grep-0.26.0+0/npm/platforms/win32-ia32-msvc/package.json --- old/ast-grep-0.25.6+0/npm/platforms/win32-ia32-msvc/package.json 2024-08-05 07:25:35.000000000 +0200 +++ new/ast-grep-0.26.0+0/npm/platforms/win32-ia32-msvc/package.json 2024-08-08 04:44:39.000000000 +0200 @@ -1,6 +1,6 @@ { "name": "@ast-grep/cli-win32-ia32-msvc", - "version": "0.25.6", + "version": "0.26.0", "os": [ "win32" ], diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ast-grep-0.25.6+0/npm/platforms/win32-x64-msvc/package.json new/ast-grep-0.26.0+0/npm/platforms/win32-x64-msvc/package.json --- old/ast-grep-0.25.6+0/npm/platforms/win32-x64-msvc/package.json 2024-08-05 07:25:35.000000000 +0200 +++ new/ast-grep-0.26.0+0/npm/platforms/win32-x64-msvc/package.json 2024-08-08 04:44:39.000000000 +0200 @@ -1,6 +1,6 @@ { "name": "@ast-grep/cli-win32-x64-msvc", - "version": "0.25.6", + "version": "0.26.0", "os": [ "win32" ], diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ast-grep-0.25.6+0/pyproject.toml new/ast-grep-0.26.0+0/pyproject.toml --- old/ast-grep-0.25.6+0/pyproject.toml 2024-08-05 07:25:35.000000000 +0200 +++ new/ast-grep-0.26.0+0/pyproject.toml 2024-08-08 04:44:39.000000000 +0200 @@ -4,7 +4,7 @@ [project] name = "ast-grep-cli" -version = "0.25.6" +version = "0.26.0" description = "Structural Search and Rewrite code at large scale using precise AST pattern." authors = [{ name = "Herrington Darkholme", email = "2883231+HerringtonDarkholme@users.noreply.github.com" }] maintainers = [{ name = "Herrington Darkholme", email = "2883231+HerringtonDarkholme@users.noreply.github.com" }] ++++++ vendor.tar.zst ++++++ /work/SRC/openSUSE:Factory/ast-grep/vendor.tar.zst /work/SRC/openSUSE:Factory/.ast-grep.new.7232/vendor.tar.zst differ: char 3649222, line 15039