diff --git a/kclvm/Cargo.lock b/kclvm/Cargo.lock index e49a11260..8b1d54a89 100644 --- a/kclvm/Cargo.lock +++ b/kclvm/Cargo.lock @@ -37,15 +37,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "always-assert" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4436e0292ab1bb631b42973c61205e704475fe8126af845c8d923c0996328127" -dependencies = [ - "log", -] - [[package]] name = "android-tzdata" version = "0.1.1" @@ -80,26 +71,12 @@ dependencies = [ "anstyle", "anstyle-parse", "anstyle-query", - "anstyle-wincon 1.0.1", + "anstyle-wincon", "colorchoice", "is-terminal", "utf8parse", ] -[[package]] -name = "anstream" -version = "0.6.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d96bd03f33fe50a863e394ee9718a706f988b9079b20c3784fb726e7678b62fb" -dependencies = [ - "anstyle", - "anstyle-parse", - "anstyle-query", - "anstyle-wincon 3.0.2", - "colorchoice", - "utf8parse", -] - [[package]] name = "anstyle" version = "1.0.6" @@ -121,7 +98,7 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b" dependencies = [ - "windows-sys 0.48.0", + "windows-sys", ] [[package]] @@ -131,17 +108,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "180abfa45703aebe0093f79badacc01b8fd4ea2e35118747e5811127f926e188" dependencies = [ "anstyle", - "windows-sys 0.48.0", -] - -[[package]] -name = "anstyle-wincon" -version = "3.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cd54b81ec8d6180e24654d0b371ad22fc3dd083b6ff8ba325b72e00c87660a7" -dependencies = [ - "anstyle", - "windows-sys 0.52.0", + "windows-sys", ] [[package]] @@ -159,28 +126,6 @@ version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" -[[package]] -name = "async-stream" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd56dd203fef61ac097dd65721a419ddccb106b2d2b70ba60a6b529f03961a51" -dependencies = [ - "async-stream-impl", - "futures-core", - "pin-project-lite", -] - -[[package]] -name = "async-stream-impl" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.52", -] - [[package]] name = "atty" version = "0.2.14" @@ -252,15 +197,6 @@ version = "2.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "630be753d4e58660abd17930c71b647fe46c27ea6b63cc59e1e3851406972e42" -[[package]] -name = "bitmaps" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "031043d04099746d8db04daf1fa424b2bc8bd69d92b25962dcde24da39ab64a2" -dependencies = [ - "typenum", -] - [[package]] name = "block-buffer" version = "0.7.3" @@ -372,16 +308,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "chumsky" -version = "0.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23170228b96236b5a7299057ac284a321457700bc8c41a4476052f0f4ba5349d" -dependencies = [ - "hashbrown 0.12.3", - "stacker", -] - [[package]] name = "clap" version = "4.3.19" @@ -397,7 +323,7 @@ version = "4.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "01c6a3f08f1fe5662a35cfe393aec09c4df95f60ee93b7556505260f75eee9e1" dependencies = [ - "anstream 0.3.2", + "anstream", "anstyle", "clap_lex", "strsim", @@ -554,19 +480,6 @@ dependencies = [ "typenum", ] -[[package]] -name = "dashmap" -version = "5.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6943ae99c34386c84a470c499d3414f66502a41340aa895406e0d2e4a207b91d" -dependencies = [ - "cfg-if 1.0.0", - "hashbrown 0.14.3", - "lock_api", - "once_cell", - "parking_lot_core 0.9.8", -] - [[package]] name = "diff" version = "0.1.13" @@ -619,7 +532,7 @@ dependencies = [ "libc", "option-ext", "redox_users", - "windows-sys 0.48.0", + "windows-sys", ] [[package]] @@ -663,29 +576,6 @@ dependencies = [ "thiserror", ] -[[package]] -name = "env_filter" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a009aa4810eb158359dda09d0c87378e4bbb89b5a801f016885a4707ba24f7ea" -dependencies = [ - "log", - "regex", -] - -[[package]] -name = "env_logger" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c012a26a7f605efc424dd53697843a72be7dc86ad2d01f7814337794a12231d" -dependencies = [ - "anstream 0.6.13", - "anstyle", - "env_filter", - "humantime", - "log", -] - [[package]] name = "equivalent" version = "1.0.1" @@ -709,7 +599,7 @@ checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a" dependencies = [ "errno-dragonfly", "libc", - "windows-sys 0.48.0", + "windows-sys", ] [[package]] @@ -738,18 +628,6 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6999dc1837253364c2ebb0704ba97994bd874e8f195d665c50b7548f6ea92764" -[[package]] -name = "filetime" -version = "0.2.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4029edd3e734da6fe05b6cd7bd2960760a616bd2ddd0d59a0124746d6272af0" -dependencies = [ - "cfg-if 1.0.0", - "libc", - "redox_syscall 0.3.5", - "windows-sys 0.48.0", -] - [[package]] name = "fixedbitset" version = "0.4.2" @@ -800,24 +678,6 @@ dependencies = [ "thiserror", ] -[[package]] -name = "form_urlencoded" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" -dependencies = [ - "percent-encoding", -] - -[[package]] -name = "fsevent-sys" -version = "4.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76ee7a02da4d231650c7cea31349b889be2f45ddb3ef3032d2ec8185f6313fd2" -dependencies = [ - "libc", -] - [[package]] name = "fslock" version = "0.2.1" @@ -828,12 +688,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "fst" -version = "0.4.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ab85b9b05e3978cc9a9cf8fea7f01b494e1a09ed3037e16ba39edc7a29eb61a" - [[package]] name = "futures" version = "0.3.28" @@ -979,9 +833,6 @@ name = "hashbrown" version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" -dependencies = [ - "ahash", -] [[package]] name = "hashbrown" @@ -989,15 +840,6 @@ version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" -[[package]] -name = "heck" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c" -dependencies = [ - "unicode-segmentation", -] - [[package]] name = "heck" version = "0.4.1" @@ -1019,12 +861,6 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b" -[[package]] -name = "humantime" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" - [[package]] name = "iana-time-zone" version = "0.1.57" @@ -1048,30 +884,6 @@ dependencies = [ "cc", ] -[[package]] -name = "idna" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" -dependencies = [ - "unicode-bidi", - "unicode-normalization", -] - -[[package]] -name = "im-rc" -version = "15.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af1955a75fa080c677d3972822ec4bad316169ab1cfc6c257a942c2265dbe5fe" -dependencies = [ - "bitmaps", - "rand_core", - "rand_xoshiro", - "sized-chunks", - "typenum", - "version_check", -] - [[package]] name = "indexmap" version = "1.9.3" @@ -1116,26 +928,6 @@ dependencies = [ "syn 2.0.52", ] -[[package]] -name = "inotify" -version = "0.9.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8069d3ec154eb856955c1c0fbffefbf5f3c40a104ec912d4797314c1801abff" -dependencies = [ - "bitflags 1.3.2", - "inotify-sys", - "libc", -] - -[[package]] -name = "inotify-sys" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e05c02b5e89bff3b946cedeca278abc628fe811e604f027c45a8aa3cf793d0eb" -dependencies = [ - "libc", -] - [[package]] name = "instant" version = "0.1.12" @@ -1178,7 +970,7 @@ checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" dependencies = [ "hermit-abi 0.3.2", "rustix", - "windows-sys 0.48.0", + "windows-sys", ] [[package]] @@ -1205,12 +997,6 @@ dependencies = [ "libc", ] -[[package]] -name = "jod-thread" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b23360e99b8717f20aaa4598f5a6541efbe30630039fbc7706cf954a87947ae" - [[package]] name = "js-sys" version = "0.3.64" @@ -1258,50 +1044,6 @@ dependencies = [ "tokio-util", ] -[[package]] -name = "kcl-language-server" -version = "0.8.1" -dependencies = [ - "anyhow", - "chrono", - "chumsky", - "clap", - "compiler_base_session", - "crossbeam-channel", - "dashmap", - "env_logger", - "im-rc", - "indexmap 1.9.3", - "kclvm-ast", - "kclvm-config", - "kclvm-driver", - "kclvm-error", - "kclvm-parser", - "kclvm-query", - "kclvm-sema", - "kclvm-span", - "kclvm-tools", - "kclvm-utils", - "kclvm-version", - "log", - "lsp-server", - "lsp-types", - "maplit", - "parking_lot 0.12.1", - "proc_macro_crate", - "ra_ap_vfs", - "ra_ap_vfs-notify", - "ropey", - "rustc-hash", - "rustc_lexer", - "salsa", - "serde", - "serde_json", - "threadpool", - "tokio", - "tokio-test", -] - [[package]] name = "kclvm" version = "0.8.1" @@ -1344,7 +1086,6 @@ dependencies = [ "futures", "indexmap 1.9.3", "jsonrpc-stdio-server", - "kcl-language-server", "kclvm-ast", "kclvm-ast-pretty", "kclvm-config", @@ -1353,10 +1094,8 @@ dependencies = [ "kclvm-loader", "kclvm-parser", "kclvm-query", - "kclvm-runner", "kclvm-runtime", "kclvm-sema", - "kclvm-tools", "maplit", "once_cell", "prost", @@ -1733,26 +1472,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "kqueue" -version = "1.0.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7447f1ca1b7b563588a205fe93dea8df60fd981423a768bc1c0ded35ed147d0c" -dependencies = [ - "kqueue-sys", - "libc", -] - -[[package]] -name = "kqueue-sys" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed9625ffda8729b85e45cf04090035ac368927b8cebc34898e7c120f52e4838b" -dependencies = [ - "bitflags 1.3.2", - "libc", -] - [[package]] name = "lazy_static" version = "1.4.0" @@ -1831,31 +1550,6 @@ version = "0.4.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b06a4cde4c0f271a446782e3eff8de789548ce57dbc8eca9292c27f4a42004b4" -[[package]] -name = "lsp-server" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f70570c1c29cf6654029b8fe201a5507c153f0d85be6f234d471d756bc36775a" -dependencies = [ - "crossbeam-channel", - "log", - "serde", - "serde_json", -] - -[[package]] -name = "lsp-types" -version = "0.93.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9be6e9c7e2d18f651974370d7aff703f9513e0df6e464fd795660edc77e6ca51" -dependencies = [ - "bitflags 1.3.2", - "serde", - "serde_json", - "serde_repr", - "url", -] - [[package]] name = "maplit" version = "1.0.2" @@ -1934,18 +1628,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c" dependencies = [ "libc", - "log", "wasi 0.11.0+wasi-snapshot-preview1", - "windows-sys 0.48.0", -] - -[[package]] -name = "miow" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52ffbca2f655e33c08be35d87278e5b18b89550a37dbd598c20db92f6a471123" -dependencies = [ - "windows-sys 0.42.0", + "windows-sys", ] [[package]] @@ -1954,24 +1638,6 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e5ce46fe64a9d73be07dcbe690a38ce1b293be448fd8ce1e6c1b8062c9f72c6a" -[[package]] -name = "notify" -version = "5.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "729f63e1ca555a43fe3efa4f3efdf4801c479da85b432242a7b726f353c88486" -dependencies = [ - "bitflags 1.3.2", - "crossbeam-channel", - "filetime", - "fsevent-sys", - "inotify", - "kqueue", - "libc", - "mio", - "walkdir", - "windows-sys 0.45.0", -] - [[package]] name = "num-bigint" version = "0.4.3" @@ -2036,12 +1702,6 @@ version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" -[[package]] -name = "oorandom" -version = "11.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ab1bc2a289d34bd04a330323ac98a1b4bc82c9d9fcb1e66b63caa84da26b575" - [[package]] name = "opaque-debug" version = "0.2.3" @@ -2105,7 +1765,7 @@ dependencies = [ "libc", "redox_syscall 0.3.5", "smallvec", - "windows-targets 0.48.1", + "windows-targets", ] [[package]] @@ -2137,12 +1797,6 @@ dependencies = [ "pkg-config", ] -[[package]] -name = "percent-encoding" -version = "2.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" - [[package]] name = "pest" version = "2.7.1" @@ -2266,15 +1920,6 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "proc_macro_crate" -version = "0.1.0" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.52", -] - [[package]] name = "prost" version = "0.11.9" @@ -2292,7 +1937,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "119533552c9a7ffacc21e099c24a0ac8bb19c2a2a3f363de84cd9b844feab270" dependencies = [ "bytes", - "heck 0.4.1", + "heck", "itertools", "lazy_static", "log", @@ -2346,7 +1991,7 @@ dependencies = [ name = "prost-wkt-build" version = "0.4.1" dependencies = [ - "heck 0.4.1", + "heck", "prost", "prost-build", "prost-types", @@ -2438,52 +2083,6 @@ dependencies = [ "proc-macro2", ] -[[package]] -name = "ra_ap_paths" -version = "0.0.149" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d780b450680460bd7ea3e2483dcf15a3ac0ce0ec028696caa342c577d65e5506" - -[[package]] -name = "ra_ap_stdx" -version = "0.0.149" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d776542bf771f4fdf40c21ced864bf213924d8a60d580c970715818471ebd74c" -dependencies = [ - "always-assert", - "libc", - "miow", - "winapi", -] - -[[package]] -name = "ra_ap_vfs" -version = "0.0.149" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8cd60adecd0947e1dd41a3077713381aa0cdcba6dc8777300d7d5b83b9fbe84" -dependencies = [ - "fst", - "indexmap 1.9.3", - "ra_ap_paths", - "ra_ap_stdx", - "rustc-hash", -] - -[[package]] -name = "ra_ap_vfs-notify" -version = "0.0.149" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a680f2dbd796844ebeaa2a4d01ae209f412ddc2981f6512ab8bc9b471156e6cd" -dependencies = [ - "crossbeam-channel", - "jod-thread", - "notify", - "ra_ap_paths", - "ra_ap_vfs", - "tracing", - "walkdir", -] - [[package]] name = "rand" version = "0.8.5" @@ -2514,15 +2113,6 @@ dependencies = [ "getrandom", ] -[[package]] -name = "rand_xoshiro" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f97cdb2a36ed4183de61b2f824cc45c9f1037f28afe0a322e9fff4c108b5aaa" -dependencies = [ - "rand_core", -] - [[package]] name = "redox_syscall" version = "0.2.16" @@ -2598,16 +2188,6 @@ dependencies = [ "serde", ] -[[package]] -name = "ropey" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53ce7a2c43a32e50d666e33c5a80251b31147bb4b49024bcab11fb6f20c671ed" -dependencies = [ - "smallvec", - "str_indices", -] - [[package]] name = "rustc-demangle" version = "0.1.23" @@ -2753,7 +2333,7 @@ dependencies = [ "errno", "libc", "linux-raw-sys", - "windows-sys 0.48.0", + "windows-sys", ] [[package]] @@ -2768,35 +2348,6 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" -[[package]] -name = "salsa" -version = "0.16.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b84d9f96071f3f3be0dc818eae3327625d8ebc95b58da37d6850724f31d3403" -dependencies = [ - "crossbeam-utils", - "indexmap 1.9.3", - "lock_api", - "log", - "oorandom", - "parking_lot 0.11.2", - "rustc-hash", - "salsa-macros", - "smallvec", -] - -[[package]] -name = "salsa-macros" -version = "0.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd3904a4ba0a9d0211816177fd34b04c7095443f8cdacd11175064fe541c8fe2" -dependencies = [ - "heck 0.3.3", - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "same-file" version = "1.0.6" @@ -2903,17 +2454,6 @@ dependencies = [ "serde", ] -[[package]] -name = "serde_repr" -version = "0.1.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e168eaaf71e8f9bd6037feb05190485708e019f4fd87d161b3c0a0d37daf85e5" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.52", -] - [[package]] name = "serde_test" version = "1.0.176" @@ -3001,16 +2541,6 @@ version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7bd3e3206899af3f8b12af284fafc038cc1dc2b41d1b89dd17297221c5d225de" -[[package]] -name = "sized-chunks" -version = "0.6.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16d69225bde7a69b235da73377861095455d298f2b970996eec25ddbb42b3d1e" -dependencies = [ - "bitmaps", - "typenum", -] - [[package]] name = "slab" version = "0.4.8" @@ -3113,12 +2643,6 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "213701ba3370744dcd1a12960caa4843b3d68b4d1c0a5d575e0d65b2ee9d16c0" -[[package]] -name = "str_indices" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f026164926842ec52deb1938fae44f83dfdb82d0a5b0270c5bd5935ab74d6dd" - [[package]] name = "strsim" version = "0.10.0" @@ -3178,7 +2702,7 @@ dependencies = [ "fastrand", "redox_syscall 0.3.5", "rustix", - "windows-sys 0.48.0", + "windows-sys", ] [[package]] @@ -3326,21 +2850,6 @@ dependencies = [ "displaydoc", ] -[[package]] -name = "tinyvec" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" -dependencies = [ - "tinyvec_macros", -] - -[[package]] -name = "tinyvec_macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" - [[package]] name = "tokio" version = "1.29.1" @@ -3358,7 +2867,7 @@ dependencies = [ "signal-hook-registry", "socket2", "tokio-macros", - "windows-sys 0.48.0", + "windows-sys", ] [[package]] @@ -3372,30 +2881,6 @@ dependencies = [ "syn 2.0.52", ] -[[package]] -name = "tokio-stream" -version = "0.1.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "397c988d37662c7dda6d2208364a706264bf3d6138b11d436cbac0ad38832842" -dependencies = [ - "futures-core", - "pin-project-lite", - "tokio", -] - -[[package]] -name = "tokio-test" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53474327ae5e166530d17f2d956afcb4f8a004de581b3cae10f12006bc8163e3" -dependencies = [ - "async-stream", - "bytes", - "futures-core", - "tokio", - "tokio-stream", -] - [[package]] name = "tokio-util" version = "0.6.10" @@ -3602,12 +3087,6 @@ dependencies = [ "unic-common", ] -[[package]] -name = "unicode-bidi" -version = "0.3.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" - [[package]] name = "unicode-casing" version = "0.1.0" @@ -3620,21 +3099,6 @@ version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" -[[package]] -name = "unicode-normalization" -version = "0.1.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" -dependencies = [ - "tinyvec", -] - -[[package]] -name = "unicode-segmentation" -version = "1.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36" - [[package]] name = "unicode-width" version = "0.1.10" @@ -3659,18 +3123,6 @@ version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ab4c90930b95a82d00dc9e9ac071b4991924390d46cbd0dfe566148667605e4b" -[[package]] -name = "url" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" -dependencies = [ - "form_urlencoded", - "idna", - "percent-encoding", - "serde", -] - [[package]] name = "utf8parse" version = "0.2.1" @@ -3829,31 +3281,7 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" dependencies = [ - "windows-targets 0.48.1", -] - -[[package]] -name = "windows-sys" -version = "0.42.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" -dependencies = [ - "windows_aarch64_gnullvm 0.42.2", - "windows_aarch64_msvc 0.42.2", - "windows_i686_gnu 0.42.2", - "windows_i686_msvc 0.42.2", - "windows_x86_64_gnu 0.42.2", - "windows_x86_64_gnullvm 0.42.2", - "windows_x86_64_msvc 0.42.2", -] - -[[package]] -name = "windows-sys" -version = "0.45.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" -dependencies = [ - "windows-targets 0.42.2", + "windows-targets", ] [[package]] @@ -3862,31 +3290,7 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" dependencies = [ - "windows-targets 0.48.1", -] - -[[package]] -name = "windows-sys" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" -dependencies = [ - "windows-targets 0.52.4", -] - -[[package]] -name = "windows-targets" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" -dependencies = [ - "windows_aarch64_gnullvm 0.42.2", - "windows_aarch64_msvc 0.42.2", - "windows_i686_gnu 0.42.2", - "windows_i686_msvc 0.42.2", - "windows_x86_64_gnu 0.42.2", - "windows_x86_64_gnullvm 0.42.2", - "windows_x86_64_msvc 0.42.2", + "windows-targets", ] [[package]] @@ -3895,156 +3299,57 @@ version = "0.48.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "05d4b17490f70499f20b9e791dcf6a299785ce8af4d709018206dc5b4953e95f" dependencies = [ - "windows_aarch64_gnullvm 0.48.0", - "windows_aarch64_msvc 0.48.0", - "windows_i686_gnu 0.48.0", - "windows_i686_msvc 0.48.0", - "windows_x86_64_gnu 0.48.0", - "windows_x86_64_gnullvm 0.48.0", - "windows_x86_64_msvc 0.48.0", -] - -[[package]] -name = "windows-targets" -version = "0.52.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dd37b7e5ab9018759f893a1952c9420d060016fc19a472b4bb20d1bdd694d1b" -dependencies = [ - "windows_aarch64_gnullvm 0.52.4", - "windows_aarch64_msvc 0.52.4", - "windows_i686_gnu 0.52.4", - "windows_i686_msvc 0.52.4", - "windows_x86_64_gnu 0.52.4", - "windows_x86_64_gnullvm 0.52.4", - "windows_x86_64_msvc 0.52.4", + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", ] -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" - [[package]] name = "windows_aarch64_gnullvm" version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.52.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bcf46cf4c365c6f2d1cc93ce535f2c8b244591df96ceee75d8e83deb70a9cac9" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" - [[package]] name = "windows_aarch64_msvc" version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" -[[package]] -name = "windows_aarch64_msvc" -version = "0.52.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da9f259dd3bcf6990b55bffd094c4f7235817ba4ceebde8e6d11cd0c5633b675" - -[[package]] -name = "windows_i686_gnu" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" - [[package]] name = "windows_i686_gnu" version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" -[[package]] -name = "windows_i686_gnu" -version = "0.52.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b474d8268f99e0995f25b9f095bc7434632601028cf86590aea5c8a5cb7801d3" - -[[package]] -name = "windows_i686_msvc" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" - [[package]] name = "windows_i686_msvc" version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" -[[package]] -name = "windows_i686_msvc" -version = "0.52.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1515e9a29e5bed743cb4415a9ecf5dfca648ce85ee42e15873c3cd8610ff8e02" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" - [[package]] name = "windows_x86_64_gnu" version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" -[[package]] -name = "windows_x86_64_gnu" -version = "0.52.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5eee091590e89cc02ad514ffe3ead9eb6b660aedca2183455434b93546371a03" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" - [[package]] name = "windows_x86_64_gnullvm" version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.52.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77ca79f2451b49fa9e2af39f0747fe999fcda4f5e241b2898624dca97a1f2177" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" - [[package]] name = "windows_x86_64_msvc" version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" -[[package]] -name = "windows_x86_64_msvc" -version = "0.52.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32b752e52a2da0ddfbdbcc6fceadfeede4c939ed16d13e648833a61dfb611ed8" - [[package]] name = "yaml-rust" version = "0.4.5" diff --git a/kclvm/api/Cargo.toml b/kclvm/api/Cargo.toml index 3285dc255..559ca5307 100644 --- a/kclvm/api/Cargo.toml +++ b/kclvm/api/Cargo.toml @@ -21,7 +21,6 @@ once_cell = "1.5.2" prost-wkt = {path = "../third-party/prost-wkt", version = "0.4.1"} prost-wkt-types = {path = "../third-party/prost-wkt/wkt-types", version = "0.4.1"} -kclvm-runner = {path = "../runner"} kclvm-config = {path = "../config"} kclvm-driver = {path = "../driver"} kclvm-error = {path = "../error"} @@ -31,9 +30,7 @@ kclvm-sema = {path = "../sema"} kclvm-ast = {path = "../ast"} kclvm-ast-pretty = {path = "../ast_pretty"} kclvm-runtime = {path = "../runtime"} -kclvm-tools = {path = "../tools" } kclvm-query = {path = "../query"} -kcl-language-server = {path = "../tools/src/LSP"} [dev-dependencies] criterion = "0.4.0" diff --git a/kclvm/api/src/service/into.rs b/kclvm/api/src/service/into.rs index 721243ff4..2a36a2cb1 100644 --- a/kclvm/api/src/service/into.rs +++ b/kclvm/api/src/service/into.rs @@ -8,28 +8,28 @@ use kclvm_error::Diagnostic; use kclvm_loader::{ScopeInfo, SymbolInfo}; use kclvm_sema::core::{scope::ScopeRef, symbol::SymbolRef}; -pub(crate) trait IntoLoadSettingsFiles { +pub trait IntoLoadSettingsFiles { /// Convert self into the LoadSettingsFiles structure. fn into_load_settings_files(self, files: &[String]) -> LoadSettingsFilesResult; } -pub(crate) trait IntoError { +pub trait IntoError { fn into_error(self) -> Error; } -pub(crate) trait IntoSymbolIndex { +pub trait IntoSymbolIndex { fn into_symbol_index(self) -> SymbolIndex; } -pub(crate) trait IntoSymbol { +pub trait IntoSymbol { fn into_symbol(self) -> Symbol; } -pub(crate) trait IntoScope { +pub trait IntoScope { fn into_scope(self) -> Scope; } -pub(crate) trait IntoScopeIndex { +pub trait IntoScopeIndex { fn into_scope_index(self) -> ScopeIndex; } diff --git a/kclvm/api/src/service/mod.rs b/kclvm/api/src/service/mod.rs index a62290789..04377a738 100644 --- a/kclvm/api/src/service/mod.rs +++ b/kclvm/api/src/service/mod.rs @@ -1,8 +1,8 @@ pub mod capi; -pub(crate) mod into; +pub mod into; pub mod jsonrpc; pub mod service_impl; -pub(crate) mod ty; +pub mod ty; pub(crate) mod util; pub use service_impl::KclvmServiceImpl; diff --git a/kclvm/api/src/service/service_impl.rs b/kclvm/api/src/service/service_impl.rs index 484c5c299..820c371b3 100644 --- a/kclvm/api/src/service/service_impl.rs +++ b/kclvm/api/src/service/service_impl.rs @@ -6,9 +6,9 @@ use std::string::String; use crate::gpyrpc::*; use anyhow::anyhow; -use kcl_language_server::rename; use kclvm_config::settings::build_settings_pathbuf; use kclvm_driver::canonicalize_input_files; +use kclvm_loader::load_packages_with_cache; use kclvm_loader::{load_packages, LoadPackageOptions}; use kclvm_parser::load_program; use kclvm_parser::parse_file; @@ -20,20 +20,14 @@ use kclvm_query::override_file; use kclvm_query::query::get_full_schema_type; use kclvm_query::query::CompilationOptions; use kclvm_query::GetSchemaOption; -use kclvm_runner::{build_program, exec_artifact, exec_program}; +use kclvm_sema::core::global_state::GlobalState; +use kclvm_sema::resolver::scope::KCLScopeCache; use kclvm_sema::resolver::Options; -use kclvm_tools::format::{format, format_source, FormatOptions}; -use kclvm_tools::lint::lint_files; -use kclvm_tools::testing; -use kclvm_tools::testing::TestRun; -use kclvm_tools::vet::validator::validate; -use kclvm_tools::vet::validator::LoaderKind; -use kclvm_tools::vet::validator::ValidateOption; use tempfile::NamedTempFile; use super::into::*; use super::ty::kcl_schema_ty_to_pb_ty; -use super::util::{transform_exec_para, transform_str_para}; +use super::util::transform_str_para; /// Specific implementation of calling service #[derive(Debug, Clone, Default)] @@ -253,6 +247,92 @@ impl KclvmServiceImpl { }) } + pub fn load_package_with_cache( + &self, + args: &LoadPackageArgs, + module_cache: KCLModuleCache, + scope_cache: KCLScopeCache, + ) -> anyhow::Result { + let mut package_maps = HashMap::new(); + let parse_args = args.parse_args.clone().unwrap_or_default(); + for p in &parse_args.external_pkgs { + package_maps.insert(p.pkg_name.to_string(), p.pkg_path.to_string()); + } + let packages = load_packages_with_cache( + &LoadPackageOptions { + paths: parse_args.paths, + load_opts: Some(LoadProgramOptions { + k_code_list: parse_args.sources.clone(), + package_maps, + load_plugins: true, + ..Default::default() + }), + resolve_ast: args.resolve_ast, + load_builtin: args.load_builtin, + }, + module_cache, + scope_cache, + GlobalState::default(), + )?; + if args.with_ast_index { + // Thread local options + kclvm_ast::ast::set_should_serialize_id(true); + } + let program_json = serde_json::to_string(&packages.program)?; + let mut node_symbol_map = HashMap::new(); + let mut symbol_node_map = HashMap::new(); + let mut fully_qualified_name_map = HashMap::new(); + let mut pkg_scope_map = HashMap::new(); + let mut symbols = HashMap::new(); + let mut scopes = HashMap::new(); + // Build sematic mappings + for (k, s) in packages.node_symbol_map { + node_symbol_map.insert(k.id.to_string(), s.into_symbol_index()); + } + for (s, k) in packages.symbol_node_map { + let symbol_index_string = serde_json::to_string(&s)?; + symbol_node_map.insert(symbol_index_string, k.id.to_string()); + } + for (s, k) in packages.fully_qualified_name_map { + fully_qualified_name_map.insert(s, k.into_symbol_index()); + } + for (k, s) in packages.pkg_scope_map { + pkg_scope_map.insert(k, s.into_scope_index()); + } + for (k, s) in packages.symbols { + let symbol_index_string = serde_json::to_string(&k)?; + symbols.insert(symbol_index_string, s.into_symbol()); + } + for (k, s) in packages.scopes { + let scope_index_string = serde_json::to_string(&k)?; + scopes.insert(scope_index_string, s.into_scope()); + } + Ok(LoadPackageResult { + program: program_json, + paths: packages + .paths + .iter() + .map(|p| p.to_str().unwrap().to_string()) + .collect(), + node_symbol_map, + symbol_node_map, + fully_qualified_name_map, + pkg_scope_map, + symbols, + scopes, + parse_errors: packages + .parse_errors + .into_iter() + .map(|e| e.into_error()) + .collect(), + type_errors: packages + .type_errors + .into_iter() + .map(|e| e.into_error()) + .collect(), + }) + } + /// Execute KCL file with args. **Note that it is not thread safe.** /// /// # Examples @@ -296,17 +376,7 @@ impl KclvmServiceImpl { /// assert!(error.to_string().contains("No input KCL files or paths"), "{error}"); /// ``` pub fn exec_program(&self, args: &ExecProgramArgs) -> anyhow::Result { - // transform args to json - let exec_args = transform_exec_para(&Some(args.clone()), self.plugin_agent)?; - let sess = ParseSessionRef::default(); - let result = exec_program(sess, &exec_args)?; - - Ok(ExecProgramResult { - json_result: result.json_result, - yaml_result: result.yaml_result, - log_message: result.log_message, - err_message: result.err_message, - }) + todo!() } /// Build the KCL program to an artifact. @@ -331,15 +401,7 @@ impl KclvmServiceImpl { /// assert!(!artifact.path.is_empty()); /// ``` pub fn build_program(&self, args: &BuildProgramArgs) -> anyhow::Result { - let exec_args = transform_exec_para(&args.exec_args, self.plugin_agent)?; - let artifact = build_program( - ParseSessionRef::default(), - &exec_args, - transform_str_para(&args.output), - )?; - Ok(BuildProgramResult { - path: artifact.get_path().to_string(), - }) + todo!() } /// Execute the KCL artifact with args. **Note that it is not thread safe.** @@ -370,14 +432,7 @@ impl KclvmServiceImpl { /// assert_eq!(exec_result.yaml_result, "alice:\n age: 18"); /// ``` pub fn exec_artifact(&self, args: &ExecArtifactArgs) -> anyhow::Result { - let exec_args = transform_exec_para(&args.exec_args, self.plugin_agent)?; - let result = exec_artifact(&args.path, &exec_args)?; - Ok(ExecProgramResult { - json_result: result.json_result, - yaml_result: result.yaml_result, - log_message: result.log_message, - err_message: result.err_message, - }) + todo!() } /// Override KCL file with args @@ -501,26 +556,7 @@ impl KclvmServiceImpl { &self, args: &GetFullSchemaTypeArgs, ) -> anyhow::Result { - let mut type_list = Vec::new(); - let exec_args = transform_exec_para(&args.exec_args, self.plugin_agent)?; - for (_k, schema_ty) in get_full_schema_type( - Some(&args.schema_name), - CompilationOptions { - k_files: exec_args.clone().k_filename_list, - loader_opts: Some(exec_args.get_load_program_options()), - resolve_opts: Options { - resolve_val: true, - ..Default::default() - }, - get_schema_opts: GetSchemaOption::default(), - }, - )? { - type_list.push(kcl_schema_ty_to_pb_ty(&schema_ty)); - } - - Ok(GetSchemaTypeResult { - schema_type_list: type_list, - }) + todo!() } /// Service for getting the schema mapping. @@ -604,18 +640,7 @@ impl KclvmServiceImpl { /// assert_eq!(result.formatted, source.as_bytes().to_vec()); /// ``` pub fn format_code(&self, args: &FormatCodeArgs) -> anyhow::Result { - let (formatted, _) = format_source( - "", - &args.source, - &FormatOptions { - is_stdout: false, - recursively: false, - omit_errors: true, - }, - )?; - Ok(FormatCodeResult { - formatted: formatted.as_bytes().to_vec(), - }) + todo!() } /// Service for formatting kcl file or directory path contains kcl files and @@ -635,22 +660,7 @@ impl KclvmServiceImpl { /// assert!(result.changed_paths.is_empty()); /// ``` pub fn format_path(&self, args: &FormatPathArgs) -> anyhow::Result { - let path = &args.path; - let (path, recursively) = if path.ends_with("...") { - let path = &path[0..path.len() - 3]; - (if path.is_empty() { "." } else { path }, true) - } else { - (args.path.as_str(), false) - }; - let changed_paths = format( - path, - &FormatOptions { - recursively, - is_stdout: false, - omit_errors: true, - }, - )?; - Ok(FormatPathResult { changed_paths }) + todo!() } /// Service for KCL Lint API, check a set of files, skips execute, @@ -670,24 +680,7 @@ impl KclvmServiceImpl { /// assert_eq!(result.results, vec!["Module 'math' imported but unused".to_string()]); /// ``` pub fn lint_path(&self, args: &LintPathArgs) -> anyhow::Result { - let (errs, warnings) = lint_files( - &args.paths.iter().map(|p| p.as_str()).collect::>(), - None, - ); - let mut results = vec![]; - // Append errors. - for err in errs { - for msg in err.messages { - results.push(msg.message) - } - } - // Append warnings. - for warning in warnings { - for msg in warning.messages { - results.push(msg.message) - } - } - Ok(LintPathResult { results }) + todo!() } /// Service for validating the data string using the schema code string, when the parameter @@ -724,34 +717,7 @@ impl KclvmServiceImpl { /// assert_eq!(result.success, true); /// ``` pub fn validate_code(&self, args: &ValidateCodeArgs) -> anyhow::Result { - let mut file = NamedTempFile::new()?; - let file_path = if args.datafile.is_empty() { - // Write some test data to the first handle. - file.write_all(args.data.as_bytes())?; - file.path().to_string_lossy().to_string() - } else { - args.datafile.clone() - }; - - let (success, err_message) = match validate(ValidateOption::new( - transform_str_para(&args.schema), - args.attribute_name.clone(), - file_path, - match args.format.to_lowercase().as_str() { - "yaml" | "yml" => LoaderKind::YAML, - "json" => LoaderKind::JSON, - _ => LoaderKind::JSON, - }, - transform_str_para(&args.file), - transform_str_para(&args.code), - )) { - Ok(success) => (success, "".to_string()), - Err(err) => (false, err.to_string()), - }; - Ok(ValidateCodeResult { - success, - err_message, - }) + todo!() } /// Service for building setting file config from args. @@ -822,24 +788,7 @@ impl KclvmServiceImpl { /// # fs::remove_file(path.clone()).unwrap(); /// ``` pub fn rename(&self, args: &RenameArgs) -> anyhow::Result { - let pkg_root = PathBuf::from(args.package_root.clone()) - .canonicalize()? - .display() - .to_string(); - let symbol_path = args.symbol_path.clone(); - let mut file_paths = vec![]; - for path in args.file_paths.iter() { - file_paths.push(PathBuf::from(path).canonicalize()?.display().to_string()); - } - let new_name = args.new_name.clone(); - Ok(RenameResult { - changed_files: rename::rename_symbol_on_file( - &pkg_root, - &symbol_path, - &file_paths, - new_name, - )?, - }) + todo!() } /// Service for renaming all the occurrences of the target symbol and rename them. This API won't rewrite files but return the modified code if any code has been changed. @@ -862,14 +811,7 @@ impl KclvmServiceImpl { /// assert_eq!(result.changed_codes.get("/mock/path/main.k").unwrap(), "a2 = 1\nb = a2"); /// ``` pub fn rename_code(&self, args: &RenameCodeArgs) -> anyhow::Result { - Ok(RenameCodeResult { - changed_codes: rename::rename_symbol_on_code( - &args.package_root, - &args.symbol_path, - args.source_codes.clone(), - args.new_name.clone(), - )?, - }) + todo!() } /// Service for the testing tool. @@ -892,31 +834,6 @@ impl KclvmServiceImpl { /// assert!(result.info[1].error.is_empty()); /// ``` pub fn test(&self, args: &TestArgs) -> anyhow::Result { - let mut result = TestResult::default(); - let exec_args = transform_exec_para(&args.exec_args, self.plugin_agent)?; - let opts = testing::TestOptions { - exec_args, - run_regexp: args.run_regexp.clone(), - fail_fast: args.fail_fast, - }; - for pkg in &args.pkg_list { - let suites = testing::load_test_suites(pkg, &opts)?; - for suite in &suites { - let suite_result = suite.run(&opts)?; - for (name, info) in &suite_result.info { - result.info.push(TestCaseInfo { - name: name.clone(), - error: info - .error - .as_ref() - .map(|e| e.to_string()) - .unwrap_or_default(), - duration: info.duration.as_micros() as u64, - log_message: info.log_message.clone(), - }) - } - } - } - Ok(result) + todo!() } } diff --git a/kclvm/api/src/service/ty.rs b/kclvm/api/src/service/ty.rs index 51a8a7b29..fb6f63635 100644 --- a/kclvm/api/src/service/ty.rs +++ b/kclvm/api/src/service/ty.rs @@ -4,7 +4,7 @@ use kclvm_sema::ty::{DictType, SchemaType, Type}; use std::collections::HashMap; /// Convert the kcl sematic type to the kcl protobuf type. -pub(crate) fn kcl_ty_to_pb_ty(ty: &Type) -> KclType { +pub fn kcl_ty_to_pb_ty(ty: &Type) -> KclType { match &ty.kind { kclvm_sema::ty::TypeKind::List(item_ty) => KclType { r#type: "list".to_string(), @@ -31,7 +31,7 @@ pub(crate) fn kcl_ty_to_pb_ty(ty: &Type) -> KclType { } /// Convert the kcl sematic type to the kcl protobuf type. -pub(crate) fn kcl_schema_ty_to_pb_ty(schema_ty: &SchemaType) -> KclType { +pub fn kcl_schema_ty_to_pb_ty(schema_ty: &SchemaType) -> KclType { KclType { r#type: "schema".to_string(), schema_name: schema_ty.name.clone(), diff --git a/kclvm/api/src/service/util.rs b/kclvm/api/src/service/util.rs index f74b5fa1f..a5545456b 100644 --- a/kclvm/api/src/service/util.rs +++ b/kclvm/api/src/service/util.rs @@ -9,19 +9,3 @@ pub(crate) fn transform_str_para(para: &str) -> Option { Some(para.to_string()) } } - -#[inline] -pub(crate) fn transform_exec_para( - exec_args: &Option, - plugin_agent: u64, -) -> anyhow::Result { - let mut args = match exec_args { - Some(exec_args) => { - let args_json = serde_json::to_string(exec_args)?; - kclvm_runner::ExecProgramArgs::from_str(args_json.as_str()) - } - None => kclvm_runner::ExecProgramArgs::default(), - }; - args.plugin_agent = plugin_agent; - Ok(args) -} diff --git a/kclvm/tools/src/LSP/src/find_refs.rs b/kclvm/tools/src/LSP/src/find_refs.rs index 6c23b7ff9..42ad9e794 100644 --- a/kclvm/tools/src/LSP/src/find_refs.rs +++ b/kclvm/tools/src/LSP/src/find_refs.rs @@ -70,14 +70,6 @@ pub(crate) fn find_refs_from_def Result<(), anyhow::Error>>( let mut ref_locations = vec![]; for (_, word_index) in &mut *word_index_map.write() { if let Some(mut locs) = word_index.get(name.as_str()).cloned() { - if locs.len() >= 20 { - let _ = logger( - "Found more than 20 matched symbols, only the first 20 will be processed" - .to_string(), - ); - locs = locs[0..20].to_vec(); - } - let matched_locs: Vec = locs .into_iter() .filter(|ref_loc| {