mirror of https://github.com/lapce/lapce.git
plugin to use wasmer
This commit is contained in:
parent
a61d3b2966
commit
50e25101cc
|
@ -194,7 +194,7 @@ dependencies = [
|
|||
"cfg-if 1.0.0",
|
||||
"libc",
|
||||
"miniz_oxide",
|
||||
"object",
|
||||
"object 0.26.2",
|
||||
"rustc-demangle",
|
||||
]
|
||||
|
||||
|
@ -312,6 +312,27 @@ version = "0.3.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7"
|
||||
|
||||
[[package]]
|
||||
name = "bytecheck"
|
||||
version = "0.6.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "314889ea31cda264cb7c3d6e6e5c9415a987ecb0e72c17c00d36fbb881d34abe"
|
||||
dependencies = [
|
||||
"bytecheck_derive",
|
||||
"ptr_meta",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bytecheck_derive"
|
||||
version = "0.6.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4a2b3b92c135dae665a6f760205b89187638e83bed17ef3e44e83c712cf30600"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.29",
|
||||
"quote 1.0.9",
|
||||
"syn 1.0.75",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bytecount"
|
||||
version = "0.5.1"
|
||||
|
@ -509,7 +530,7 @@ dependencies = [
|
|||
"clicolors-control",
|
||||
"lazy_static 1.4.0",
|
||||
"libc",
|
||||
"parking_lot 0.6.4",
|
||||
"parking_lot 0.11.2",
|
||||
"regex",
|
||||
"termios",
|
||||
"unicode-width",
|
||||
|
@ -655,6 +676,66 @@ dependencies = [
|
|||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cranelift-bforest"
|
||||
version = "0.76.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7e6bea67967505247f54fa2c85cf4f6e0e31c4e5692c9b70e4ae58e339067333"
|
||||
dependencies = [
|
||||
"cranelift-entity",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cranelift-codegen"
|
||||
version = "0.76.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "48194035d2752bdd5bdae429e3ab88676e95f52a2b1355a5d4e809f9e39b1d74"
|
||||
dependencies = [
|
||||
"cranelift-bforest",
|
||||
"cranelift-codegen-meta",
|
||||
"cranelift-codegen-shared",
|
||||
"cranelift-entity",
|
||||
"gimli",
|
||||
"log",
|
||||
"regalloc",
|
||||
"smallvec 1.6.1",
|
||||
"target-lexicon",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cranelift-codegen-meta"
|
||||
version = "0.76.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "976efb22fcab4f2cd6bd4e9913764616a54d895c1a23530128d04e03633c555f"
|
||||
dependencies = [
|
||||
"cranelift-codegen-shared",
|
||||
"cranelift-entity",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cranelift-codegen-shared"
|
||||
version = "0.76.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9dabb5fe66e04d4652e434195b45ae65b5c8172d520247b8f66d8df42b2b45dc"
|
||||
|
||||
[[package]]
|
||||
name = "cranelift-entity"
|
||||
version = "0.76.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3329733e4d4b8e91c809efcaa4faee80bf66f20164e3dd16d707346bd3494799"
|
||||
|
||||
[[package]]
|
||||
name = "cranelift-frontend"
|
||||
version = "0.76.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "279afcc0d3e651b773f94837c3d581177b348c8d69e928104b2e9fccb226f921"
|
||||
dependencies = [
|
||||
"cranelift-codegen",
|
||||
"log",
|
||||
"smallvec 1.6.1",
|
||||
"target-lexicon",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crc32fast"
|
||||
version = "1.2.1"
|
||||
|
@ -900,8 +981,18 @@ version = "0.10.2"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0d706e75d87e35569db781a9b5e2416cff1236a47ed380831f959382ccd5f858"
|
||||
dependencies = [
|
||||
"darling_core",
|
||||
"darling_macro",
|
||||
"darling_core 0.10.2",
|
||||
"darling_macro 0.10.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "darling"
|
||||
version = "0.13.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d0d720b8683f8dd83c65155f0530560cba68cd2bf395f6513a483caee57ff7f4"
|
||||
dependencies = [
|
||||
"darling_core 0.13.1",
|
||||
"darling_macro 0.13.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -918,13 +1009,38 @@ dependencies = [
|
|||
"syn 1.0.75",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "darling_core"
|
||||
version = "0.13.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7a340f241d2ceed1deb47ae36c4144b2707ec7dd0b649f894cb39bb595986324"
|
||||
dependencies = [
|
||||
"fnv",
|
||||
"ident_case",
|
||||
"proc-macro2 1.0.29",
|
||||
"quote 1.0.9",
|
||||
"strsim 0.10.0",
|
||||
"syn 1.0.75",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "darling_macro"
|
||||
version = "0.10.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d9b5a2f4ac4969822c62224815d069952656cadc7084fdca9751e6d959189b72"
|
||||
dependencies = [
|
||||
"darling_core",
|
||||
"darling_core 0.10.2",
|
||||
"quote 1.0.9",
|
||||
"syn 1.0.75",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "darling_macro"
|
||||
version = "0.13.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "72c41b3b7352feb3211a0d743dc5700a4e3b60f51bd2b368892d1e0f9a95f44b"
|
||||
dependencies = [
|
||||
"darling_core 0.13.1",
|
||||
"quote 1.0.9",
|
||||
"syn 1.0.75",
|
||||
]
|
||||
|
@ -1133,6 +1249,27 @@ version = "1.6.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457"
|
||||
|
||||
[[package]]
|
||||
name = "enumset"
|
||||
version = "1.0.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6216d2c19a6fb5f29d1ada1dc7bc4367a8cbf0fa4af5cf12e07b5bbdde6b5b2c"
|
||||
dependencies = [
|
||||
"enumset_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "enumset_derive"
|
||||
version = "0.5.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6451128aa6655d880755345d085494cf7561a6bee7c8dc821e5d77e6d267ecd4"
|
||||
dependencies = [
|
||||
"darling 0.13.1",
|
||||
"proc-macro2 1.0.29",
|
||||
"quote 1.0.9",
|
||||
"syn 1.0.75",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "euclid"
|
||||
version = "0.22.6"
|
||||
|
@ -1158,6 +1295,12 @@ version = "0.1.2"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed"
|
||||
|
||||
[[package]]
|
||||
name = "fallible-iterator"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7"
|
||||
|
||||
[[package]]
|
||||
name = "filetime"
|
||||
version = "0.2.15"
|
||||
|
@ -1514,6 +1657,15 @@ dependencies = [
|
|||
"ndarray",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "generational-arena"
|
||||
version = "0.2.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8e1d3b771574f62d0548cee0ad9057857e9fc25d7a3335f140c84f6acd0bf601"
|
||||
dependencies = [
|
||||
"cfg-if 0.1.10",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "generic-array"
|
||||
version = "0.12.4"
|
||||
|
@ -1549,6 +1701,11 @@ name = "gimli"
|
|||
version = "0.25.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f0a01e0497841a3b2db4f8afa483cce65f7e96a3498bd6c541734792aeac8fe7"
|
||||
dependencies = [
|
||||
"fallible-iterator",
|
||||
"indexmap",
|
||||
"stable_deref_trait",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "git2"
|
||||
|
@ -1766,6 +1923,7 @@ checksum = "bc633605454125dec4b66843673f01c7df2b89479b32e0ed634e43a91cff62a5"
|
|||
dependencies = [
|
||||
"autocfg 1.0.1",
|
||||
"hashbrown 0.11.2",
|
||||
"serde 1.0.130",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2040,6 +2198,8 @@ dependencies = [
|
|||
"serde 1.0.130",
|
||||
"serde_json",
|
||||
"toml",
|
||||
"wasmer",
|
||||
"wasmer-wasi",
|
||||
"xi-core-lib",
|
||||
"xi-rope 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"xi-rpc",
|
||||
|
@ -2080,6 +2240,12 @@ version = "1.3.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
|
||||
|
||||
[[package]]
|
||||
name = "leb128"
|
||||
version = "0.2.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67"
|
||||
|
||||
[[package]]
|
||||
name = "lexical-core"
|
||||
version = "0.7.6"
|
||||
|
@ -2215,6 +2381,27 @@ dependencies = [
|
|||
"cfg-if 1.0.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "loupe"
|
||||
version = "0.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9b6a72dfa44fe15b5e76b94307eeb2ff995a8c5b283b55008940c02e0c5b634d"
|
||||
dependencies = [
|
||||
"indexmap",
|
||||
"loupe-derive",
|
||||
"rustversion",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "loupe-derive"
|
||||
version = "0.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c0fbfc88337168279f2e9ae06e157cfed4efd3316e14dc96ed074d4f2e6c5952"
|
||||
dependencies = [
|
||||
"quote 1.0.9",
|
||||
"syn 1.0.75",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lsp-types"
|
||||
version = "0.89.2"
|
||||
|
@ -2280,6 +2467,15 @@ dependencies = [
|
|||
"sid",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "mach"
|
||||
version = "0.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b823e83b2affd8f40a9ee8c29dbc56404c1e34cd2710921f2801e2cf29527afa"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "malloc_buf"
|
||||
version = "0.0.6"
|
||||
|
@ -2334,6 +2530,15 @@ dependencies = [
|
|||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "memmap2"
|
||||
version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4647a11b578fead29cdbb34d4adef8dd3dc35b876c9c6d5240d83f205abfe96e"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "memoffset"
|
||||
version = "0.2.1"
|
||||
|
@ -2478,6 +2683,12 @@ dependencies = [
|
|||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "more-asserts"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7843ec2de400bcbc6a6328c958dc38e5359da6e93e72e37bc5246bf1ae776389"
|
||||
|
||||
[[package]]
|
||||
name = "naga"
|
||||
version = "0.7.1"
|
||||
|
@ -2541,7 +2752,7 @@ version = "0.2.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "05d1c6307dc424d0f65b9b06e94f88248e6305726b14729fd67a5e47b2dc481d"
|
||||
dependencies = [
|
||||
"darling",
|
||||
"darling 0.10.2",
|
||||
"proc-macro-crate 0.1.5",
|
||||
"proc-macro2 1.0.29",
|
||||
"quote 1.0.9",
|
||||
|
@ -2695,6 +2906,16 @@ dependencies = [
|
|||
"autocfg 1.0.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num_cpus"
|
||||
version = "1.13.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "19e64526ebdee182341572e50e9ad03965aa510cd94427a4549448f285e957a1"
|
||||
dependencies = [
|
||||
"hermit-abi",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num_enum"
|
||||
version = "0.5.4"
|
||||
|
@ -2765,6 +2986,17 @@ dependencies = [
|
|||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "object"
|
||||
version = "0.27.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "67ac1d3f9a1d3616fd9a60c8d74296f22406a238b6a72f5cc1e6f314df4ffbf9"
|
||||
dependencies = [
|
||||
"crc32fast",
|
||||
"indexmap",
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "once_cell"
|
||||
version = "1.8.0"
|
||||
|
@ -3034,6 +3266,12 @@ dependencies = [
|
|||
"xml-rs",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ppv-lite86"
|
||||
version = "0.2.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ed0cfbc8191465bed66e1718596ee0b0b35d5ee1f41c5df2189d0fe8bde535ba"
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro-crate"
|
||||
version = "0.1.5"
|
||||
|
@ -3113,6 +3351,26 @@ version = "1.0.3"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "87dfd5592a8eed7e74f56ad7b125f8234763b805c30f0c7c95c486920026a6ec"
|
||||
|
||||
[[package]]
|
||||
name = "ptr_meta"
|
||||
version = "0.1.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0738ccf7ea06b608c10564b31debd4f5bc5e197fc8bfe088f68ae5ce81e7a4f1"
|
||||
dependencies = [
|
||||
"ptr_meta_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ptr_meta_derive"
|
||||
version = "0.1.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "16b845dbfca988fa33db069c0e230574d15a3088f147a87b64c7589eb662c9ac"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.29",
|
||||
"quote 1.0.9",
|
||||
"syn 1.0.75",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quick-error"
|
||||
version = "1.2.3"
|
||||
|
@ -3158,9 +3416,9 @@ checksum = "6d71dacdc3c88c1fde3885a3be3fbab9f35724e6ce99467f7d9c5026132184ca"
|
|||
dependencies = [
|
||||
"autocfg 0.1.7",
|
||||
"libc",
|
||||
"rand_chacha",
|
||||
"rand_chacha 0.1.1",
|
||||
"rand_core 0.4.2",
|
||||
"rand_hc",
|
||||
"rand_hc 0.1.0",
|
||||
"rand_isaac",
|
||||
"rand_jitter",
|
||||
"rand_os",
|
||||
|
@ -3169,6 +3427,18 @@ dependencies = [
|
|||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand"
|
||||
version = "0.8.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2e7573632e6454cf6b99d7aac4ccca54be06da05aca2ef7423d22d27d4d4bcd8"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"rand_chacha 0.3.1",
|
||||
"rand_core 0.6.3",
|
||||
"rand_hc 0.3.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_chacha"
|
||||
version = "0.1.1"
|
||||
|
@ -3179,6 +3449,16 @@ dependencies = [
|
|||
"rand_core 0.3.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_chacha"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
|
||||
dependencies = [
|
||||
"ppv-lite86",
|
||||
"rand_core 0.6.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_core"
|
||||
version = "0.3.1"
|
||||
|
@ -3200,6 +3480,15 @@ version = "0.5.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19"
|
||||
|
||||
[[package]]
|
||||
name = "rand_core"
|
||||
version = "0.6.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7"
|
||||
dependencies = [
|
||||
"getrandom",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_hc"
|
||||
version = "0.1.0"
|
||||
|
@ -3209,6 +3498,15 @@ dependencies = [
|
|||
"rand_core 0.3.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_hc"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d51e9f596de227fda2ea6c84607f5558e196eeaf43c986b724ba4fb8fdf497e7"
|
||||
dependencies = [
|
||||
"rand_core 0.6.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_isaac"
|
||||
version = "0.1.1"
|
||||
|
@ -3292,6 +3590,31 @@ version = "0.1.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ebac11a9d2e11f2af219b8b8d833b76b1ea0e054aa0e8d8e9e4cbde353bdf019"
|
||||
|
||||
[[package]]
|
||||
name = "rayon"
|
||||
version = "1.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c06aca804d41dbc8ba42dfd964f0d01334eceb64314b9ecf7c5fad5188a06d90"
|
||||
dependencies = [
|
||||
"autocfg 1.0.1",
|
||||
"crossbeam-deque 0.8.1",
|
||||
"either",
|
||||
"rayon-core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rayon-core"
|
||||
version = "1.9.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d78120e2c850279833f1dd3582f730c4ab53ed95aeaaaa862a2a5c71b1656d8e"
|
||||
dependencies = [
|
||||
"crossbeam-channel 0.5.1",
|
||||
"crossbeam-deque 0.8.1",
|
||||
"crossbeam-utils 0.8.5",
|
||||
"lazy_static 1.4.0",
|
||||
"num_cpus",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rctree"
|
||||
version = "0.3.3"
|
||||
|
@ -3326,6 +3649,17 @@ dependencies = [
|
|||
"redox_syscall",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regalloc"
|
||||
version = "0.0.31"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "571f7f397d61c4755285cd37853fe8e03271c243424a907415909379659381c5"
|
||||
dependencies = [
|
||||
"log",
|
||||
"rustc-hash",
|
||||
"smallvec 1.6.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex"
|
||||
version = "1.5.4"
|
||||
|
@ -3352,12 +3686,67 @@ version = "0.6.25"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b"
|
||||
|
||||
[[package]]
|
||||
name = "region"
|
||||
version = "3.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "76e189c2369884dce920945e2ddf79b3dff49e071a167dd1817fa9c4c00d512e"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"libc",
|
||||
"mach",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "remove_dir_all"
|
||||
version = "0.5.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7"
|
||||
dependencies = [
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rend"
|
||||
version = "0.3.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "79af64b4b6362ffba04eef3a4e10829718a4896dac19daa741851c86781edf95"
|
||||
dependencies = [
|
||||
"bytecheck",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "renderdoc-sys"
|
||||
version = "0.7.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f1382d1f0a252c4bf97dc20d979a2fdd05b024acd7c2ed0f7595d7817666a157"
|
||||
|
||||
[[package]]
|
||||
name = "rkyv"
|
||||
version = "0.7.28"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "631f7d2a2854abb66724f492ce5256e79685a673dc210ac022194cedd5c914d3"
|
||||
dependencies = [
|
||||
"bytecheck",
|
||||
"hashbrown 0.11.2",
|
||||
"ptr_meta",
|
||||
"rend",
|
||||
"rkyv_derive",
|
||||
"seahash",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rkyv_derive"
|
||||
version = "0.7.28"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c067e650861a749720952aed722fb344449bc95de33e6456d426f5c7d44f71c0"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.29",
|
||||
"quote 1.0.9",
|
||||
"syn 1.0.75",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "roxmltree"
|
||||
version = "0.14.1"
|
||||
|
@ -3413,6 +3802,12 @@ dependencies = [
|
|||
"owned_ttf_parser",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustversion"
|
||||
version = "1.0.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f2cc38e8fa666e2de3c4aba7edeb5ffc5246c1c2ed0e3d17e560aeeba736b23f"
|
||||
|
||||
[[package]]
|
||||
name = "rustybuzz"
|
||||
version = "0.3.0"
|
||||
|
@ -3468,6 +3863,12 @@ version = "1.1.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
|
||||
|
||||
[[package]]
|
||||
name = "seahash"
|
||||
version = "4.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b"
|
||||
|
||||
[[package]]
|
||||
name = "semver"
|
||||
version = "0.9.0"
|
||||
|
@ -3528,6 +3929,15 @@ dependencies = [
|
|||
"serde 0.8.23",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_bytes"
|
||||
version = "0.11.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "16ae07dd2f88a366f15bd0632ba725227018c69a1c8550a927324f8eb8368bb9"
|
||||
dependencies = [
|
||||
"serde 1.0.130",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.130"
|
||||
|
@ -3878,6 +4288,12 @@ version = "0.9.3"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6446ced80d6c486436db5c078dde11a9f73d42b57fb273121e160b84f63d894c"
|
||||
|
||||
[[package]]
|
||||
name = "strsim"
|
||||
version = "0.10.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
|
||||
|
||||
[[package]]
|
||||
name = "strum"
|
||||
version = "0.19.5"
|
||||
|
@ -3946,6 +4362,26 @@ dependencies = [
|
|||
"walkdir",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "target-lexicon"
|
||||
version = "0.12.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d9bffcddbc2458fa3e6058414599e3c838a022abae82e5c67b4f7f80298d5bff"
|
||||
|
||||
[[package]]
|
||||
name = "tempfile"
|
||||
version = "3.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dac1c663cfc93810f88aed9b8941d48cabf856a1b111c29a40439018d870eb22"
|
||||
dependencies = [
|
||||
"cfg-if 1.0.0",
|
||||
"libc",
|
||||
"rand 0.8.4",
|
||||
"redox_syscall",
|
||||
"remove_dir_all",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "termcolor"
|
||||
version = "1.1.2"
|
||||
|
@ -4109,6 +4545,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "09adeb8c97449311ccd28a427f96fb563e7fd31aabf994189879d9da2394b89d"
|
||||
dependencies = [
|
||||
"cfg-if 1.0.0",
|
||||
"log",
|
||||
"pin-project-lite",
|
||||
"tracing-attributes",
|
||||
"tracing-core",
|
||||
|
@ -4561,6 +4998,260 @@ version = "0.2.76"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "acdb075a845574a1fa5f09fd77e43f7747599301ea3417a9fbffdeedfc1f4a29"
|
||||
|
||||
[[package]]
|
||||
name = "wasmer"
|
||||
version = "2.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "23f0188c23fc1b7de9bd7f8b834d0b1cd5edbe66e287452e8ce36d24418114f7"
|
||||
dependencies = [
|
||||
"cfg-if 1.0.0",
|
||||
"indexmap",
|
||||
"js-sys",
|
||||
"loupe",
|
||||
"more-asserts",
|
||||
"target-lexicon",
|
||||
"thiserror",
|
||||
"wasm-bindgen",
|
||||
"wasmer-compiler",
|
||||
"wasmer-compiler-cranelift",
|
||||
"wasmer-derive",
|
||||
"wasmer-engine",
|
||||
"wasmer-engine-dylib",
|
||||
"wasmer-engine-universal",
|
||||
"wasmer-types",
|
||||
"wasmer-vm",
|
||||
"wat",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasmer-compiler"
|
||||
version = "2.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "88c51cc589772c5f90bd329244c2416976d6cb2ee00d59429aaa8f421d9fe447"
|
||||
dependencies = [
|
||||
"enumset",
|
||||
"loupe",
|
||||
"rkyv",
|
||||
"serde 1.0.130",
|
||||
"serde_bytes",
|
||||
"smallvec 1.6.1",
|
||||
"target-lexicon",
|
||||
"thiserror",
|
||||
"wasmer-types",
|
||||
"wasmer-vm",
|
||||
"wasmparser",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasmer-compiler-cranelift"
|
||||
version = "2.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "09691e3e323b4e1128d2127f60f9cd988b66ce49afc8184b071c2b5ab16793f2"
|
||||
dependencies = [
|
||||
"cranelift-codegen",
|
||||
"cranelift-entity",
|
||||
"cranelift-frontend",
|
||||
"gimli",
|
||||
"loupe",
|
||||
"more-asserts",
|
||||
"rayon",
|
||||
"smallvec 1.6.1",
|
||||
"target-lexicon",
|
||||
"tracing",
|
||||
"wasmer-compiler",
|
||||
"wasmer-types",
|
||||
"wasmer-vm",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasmer-derive"
|
||||
version = "2.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "93f5cb7b09640e09f1215da95d6fb7477d2db572f064b803ff705f39ff079cc5"
|
||||
dependencies = [
|
||||
"proc-macro-error",
|
||||
"proc-macro2 1.0.29",
|
||||
"quote 1.0.9",
|
||||
"syn 1.0.75",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasmer-engine"
|
||||
version = "2.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ab20311c354fe2c12bc766417e0a1a45f399c1cd8ff262127d1dc86d0588971a"
|
||||
dependencies = [
|
||||
"backtrace",
|
||||
"enumset",
|
||||
"lazy_static 1.4.0",
|
||||
"loupe",
|
||||
"memmap2 0.5.0",
|
||||
"more-asserts",
|
||||
"rustc-demangle",
|
||||
"serde 1.0.130",
|
||||
"serde_bytes",
|
||||
"target-lexicon",
|
||||
"thiserror",
|
||||
"wasmer-compiler",
|
||||
"wasmer-types",
|
||||
"wasmer-vm",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasmer-engine-dylib"
|
||||
version = "2.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8dd5b7a74731e1dcccaf10a8ff5f72216c82f12972ce17cc81c6caa1afff75ea"
|
||||
dependencies = [
|
||||
"cfg-if 1.0.0",
|
||||
"enumset",
|
||||
"leb128",
|
||||
"libloading 0.7.0",
|
||||
"loupe",
|
||||
"rkyv",
|
||||
"serde 1.0.130",
|
||||
"tempfile",
|
||||
"tracing",
|
||||
"wasmer-compiler",
|
||||
"wasmer-engine",
|
||||
"wasmer-object",
|
||||
"wasmer-types",
|
||||
"wasmer-vm",
|
||||
"which",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasmer-engine-universal"
|
||||
version = "2.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dfeae8d5b825ad7abcf9a34e66eb11e1507b21020efe7bbf9897e3dd8d7869e2"
|
||||
dependencies = [
|
||||
"cfg-if 1.0.0",
|
||||
"enumset",
|
||||
"leb128",
|
||||
"loupe",
|
||||
"region",
|
||||
"rkyv",
|
||||
"wasmer-compiler",
|
||||
"wasmer-engine",
|
||||
"wasmer-types",
|
||||
"wasmer-vm",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasmer-object"
|
||||
version = "2.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c3d4714e4f3bdc3b2157c24284417d19cd99de036da31d00ec5664712dcb72f7"
|
||||
dependencies = [
|
||||
"object 0.27.1",
|
||||
"thiserror",
|
||||
"wasmer-compiler",
|
||||
"wasmer-types",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasmer-types"
|
||||
version = "2.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "434e1c0177da0a74ecca90b2aa7d5e86198260f07e8ba83be89feb5f0a4aeead"
|
||||
dependencies = [
|
||||
"indexmap",
|
||||
"loupe",
|
||||
"rkyv",
|
||||
"serde 1.0.130",
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasmer-vfs"
|
||||
version = "2.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8a3a58a3700781aa4f5344915ea082086e75ba7ebe294f60ae499614db92dd00"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"thiserror",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasmer-vm"
|
||||
version = "2.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cc8f964ebba70d9f81340228b98a164782591f00239fc7f01e1b67afcf0e0156"
|
||||
dependencies = [
|
||||
"backtrace",
|
||||
"cc",
|
||||
"cfg-if 1.0.0",
|
||||
"indexmap",
|
||||
"libc",
|
||||
"loupe",
|
||||
"memoffset 0.6.4",
|
||||
"more-asserts",
|
||||
"region",
|
||||
"rkyv",
|
||||
"serde 1.0.130",
|
||||
"thiserror",
|
||||
"wasmer-types",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasmer-wasi"
|
||||
version = "2.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0c2b1d981ad312dac6e74a41a35b9bca41a6d1157c3e6a575fb1041e4b516610"
|
||||
dependencies = [
|
||||
"cfg-if 1.0.0",
|
||||
"generational-arena",
|
||||
"getrandom",
|
||||
"libc",
|
||||
"thiserror",
|
||||
"tracing",
|
||||
"wasm-bindgen",
|
||||
"wasmer",
|
||||
"wasmer-vfs",
|
||||
"wasmer-wasi-types",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasmer-wasi-types"
|
||||
version = "2.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7731240c0ae536623414beb73091dddf68d1a080f49086fc31ec916536b1af98"
|
||||
dependencies = [
|
||||
"byteorder",
|
||||
"time 0.2.27",
|
||||
"wasmer-types",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasmparser"
|
||||
version = "0.78.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "52144d4c78e5cf8b055ceab8e5fa22814ce4315d6002ad32cfd914f37c12fd65"
|
||||
|
||||
[[package]]
|
||||
name = "wast"
|
||||
version = "38.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ae0d7b256bef26c898fa7344a2d627e8499f5a749432ce0a05eae1a64ff0c271"
|
||||
dependencies = [
|
||||
"leb128",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wat"
|
||||
version = "1.0.40"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "adcfaeb27e2578d2c6271a45609f4a055e6d7ba3a12eff35b1fd5ba147bdf046"
|
||||
dependencies = [
|
||||
"wast",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wayland-client"
|
||||
version = "0.28.6"
|
||||
|
@ -4734,6 +5425,17 @@ dependencies = [
|
|||
"bitflags",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "which"
|
||||
version = "4.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ea187a8ef279bc014ec368c27a920da2024d2a711109bfbe3440585d5cf27ad9"
|
||||
dependencies = [
|
||||
"either",
|
||||
"lazy_static 1.4.0",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winapi"
|
||||
version = "0.2.8"
|
||||
|
|
|
@ -5,6 +5,8 @@ authors = ["Dongdong Zhou <dzhou121@gmail.com>"]
|
|||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
wasmer = "2.1.1"
|
||||
wasmer-wasi = "2.1.1"
|
||||
directories = "4.0.1"
|
||||
locale_config = "0.3.0"
|
||||
base64 = "0.13.0"
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
use anyhow::Result;
|
||||
use anyhow::{anyhow, Result};
|
||||
use home::home_dir;
|
||||
use serde::de::DeserializeOwned;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_json::json;
|
||||
use serde_json::Value;
|
||||
|
@ -14,6 +15,13 @@
|
|||
use std::sync::Arc;
|
||||
use std::thread;
|
||||
use toml;
|
||||
use wasmer::ChainableNamedResolver;
|
||||
use wasmer::ImportObject;
|
||||
use wasmer::Store;
|
||||
use wasmer::WasmerEnv;
|
||||
use wasmer_wasi::Pipe;
|
||||
use wasmer_wasi::WasiEnv;
|
||||
use wasmer_wasi::WasiState;
|
||||
use xi_rpc::Handler;
|
||||
use xi_rpc::RpcLoop;
|
||||
use xi_rpc::RpcPeer;
|
||||
|
@ -47,6 +55,17 @@ pub struct PluginDescription {
|
|||
configuration: Option<Value>,
|
||||
}
|
||||
|
||||
#[derive(WasmerEnv, Clone)]
|
||||
pub(crate) struct PluginEnv {
|
||||
wasi_env: WasiEnv,
|
||||
dispatcher: Dispatcher,
|
||||
}
|
||||
|
||||
pub(crate) struct PluginNew {
|
||||
instance: wasmer::Instance,
|
||||
env: PluginEnv,
|
||||
}
|
||||
|
||||
pub struct Plugin {
|
||||
id: PluginId,
|
||||
dispatcher: Dispatcher,
|
||||
|
@ -59,6 +78,8 @@ pub struct Plugin {
|
|||
pub struct PluginCatalog {
|
||||
id_counter: Counter,
|
||||
items: HashMap<PluginName, PluginDescription>,
|
||||
plugins: HashMap<PluginId, PluginNew>,
|
||||
store: wasmer::Store,
|
||||
}
|
||||
|
||||
impl PluginCatalog {
|
||||
|
@ -66,12 +87,15 @@ pub fn new() -> PluginCatalog {
|
|||
PluginCatalog {
|
||||
id_counter: Counter::default(),
|
||||
items: HashMap::new(),
|
||||
plugins: HashMap::new(),
|
||||
store: wasmer::Store::default(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn reload(&mut self) {
|
||||
eprintln!("plugin reload from paths");
|
||||
self.items.clear();
|
||||
self.plugins.clear();
|
||||
self.load();
|
||||
}
|
||||
|
||||
|
@ -89,66 +113,117 @@ pub fn load(&mut self) {
|
|||
|
||||
pub fn start_all(&mut self, dispatcher: Dispatcher) {
|
||||
for (_, manifest) in self.items.clone().iter() {
|
||||
start_plugin_process(
|
||||
self.next_plugin_id(),
|
||||
dispatcher.clone(),
|
||||
manifest.clone(),
|
||||
);
|
||||
if let Ok(plugin) =
|
||||
self.start_plugin(dispatcher.clone(), manifest.clone())
|
||||
{
|
||||
let id = self.next_plugin_id();
|
||||
self.plugins.insert(id, plugin);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn start_plugin(
|
||||
&mut self,
|
||||
dispatcher: Dispatcher,
|
||||
plugin_desc: PluginDescription,
|
||||
) -> Result<PluginNew> {
|
||||
let module = wasmer::Module::from_file(&self.store, plugin_desc.exec_path)?;
|
||||
|
||||
let output = Pipe::new();
|
||||
let input = Pipe::new();
|
||||
let mut wasi_env = WasiState::new("Lapce")
|
||||
.stdin(Box::new(input))
|
||||
.stdout(Box::new(output))
|
||||
.finalize()?;
|
||||
let wasi = wasi_env.import_object(&module)?;
|
||||
|
||||
let plugin_env = PluginEnv {
|
||||
wasi_env,
|
||||
dispatcher,
|
||||
};
|
||||
let lapce = lapce_exports(&self.store, &plugin_env);
|
||||
let instance = wasmer::Instance::new(&module, &lapce.chain_back(wasi))?;
|
||||
|
||||
let initialize = instance.exports.get_function("initialize")?;
|
||||
wasi_write_object(
|
||||
&plugin_env.wasi_env,
|
||||
&plugin_desc.configuration.unwrap_or(serde_json::json!({})),
|
||||
);
|
||||
initialize.call(&[])?;
|
||||
|
||||
Ok(PluginNew {
|
||||
instance,
|
||||
env: plugin_env,
|
||||
})
|
||||
}
|
||||
|
||||
pub fn next_plugin_id(&mut self) -> PluginId {
|
||||
PluginId(self.id_counter.next())
|
||||
}
|
||||
}
|
||||
|
||||
fn start_plugin_process(
|
||||
id: PluginId,
|
||||
dispatcher: Dispatcher,
|
||||
plugin_desc: PluginDescription,
|
||||
) {
|
||||
thread::spawn(move || {
|
||||
let parts: Vec<&str> = plugin_desc
|
||||
.exec_path
|
||||
.to_str()
|
||||
.unwrap()
|
||||
.split(" ")
|
||||
.into_iter()
|
||||
.collect();
|
||||
let mut child = Command::new(parts[0]);
|
||||
for part in &parts[1..] {
|
||||
child.arg(part);
|
||||
pub(crate) fn lapce_exports(store: &Store, plugin_env: &PluginEnv) -> ImportObject {
|
||||
macro_rules! lapce_export {
|
||||
($($host_function:ident),+ $(,)?) => {
|
||||
wasmer::imports! {
|
||||
"lapce" => {
|
||||
$(stringify!($host_function) =>
|
||||
wasmer::Function::new_native_with_env(store, plugin_env.clone(), $host_function),)+
|
||||
}
|
||||
child.current_dir(plugin_desc.dir.as_ref().unwrap());
|
||||
let child = child.stdin(Stdio::piped()).stdout(Stdio::piped()).spawn();
|
||||
if child.is_err() {
|
||||
eprintln!("can't start proxy {:?}", child);
|
||||
return;
|
||||
}
|
||||
let mut child = child.unwrap();
|
||||
let child_stdin = child.stdin.take().unwrap();
|
||||
let child_stdout = child.stdout.take().unwrap();
|
||||
let mut looper = RpcLoop::new(child_stdin);
|
||||
let peer: RpcPeer = Box::new(looper.get_raw_peer());
|
||||
let name = plugin_desc.name.clone();
|
||||
let plugin = Plugin {
|
||||
id,
|
||||
dispatcher: dispatcher.clone(),
|
||||
configuration: plugin_desc.configuration.clone(),
|
||||
peer,
|
||||
process: child,
|
||||
name,
|
||||
};
|
||||
eprintln!("plugin main loop starting {:?}", &plugin_desc.exec_path);
|
||||
plugin.initialize();
|
||||
let mut handler = PluginHandler { dispatcher };
|
||||
if let Err(e) =
|
||||
looper.mainloop(|| BufReader::new(child_stdout), &mut handler)
|
||||
{
|
||||
eprintln!("plugin main loop failed {} {:?}", e, &plugin_desc.dir);
|
||||
}
|
||||
eprintln!("plugin main loop exit {:?}", plugin_desc.dir);
|
||||
});
|
||||
}
|
||||
|
||||
lapce_export! {
|
||||
host_handle_notification,
|
||||
}
|
||||
}
|
||||
|
||||
fn host_handle_notification(plugin_env: &PluginEnv) {
|
||||
let notification: Result<PluginNotification> =
|
||||
wasi_read_object(&plugin_env.wasi_env);
|
||||
if let Ok(notification) = notification {
|
||||
match notification {
|
||||
PluginNotification::StartLspServer {
|
||||
exec_path,
|
||||
language_id,
|
||||
options,
|
||||
} => {
|
||||
plugin_env.dispatcher.lsp.lock().start_server(
|
||||
&exec_path,
|
||||
&language_id,
|
||||
options.clone(),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn wasi_read_string(wasi_env: &WasiEnv) -> Result<String> {
|
||||
let mut state = wasi_env.state();
|
||||
let wasi_file = state
|
||||
.fs
|
||||
.stdout_mut()?
|
||||
.as_mut()
|
||||
.ok_or(anyhow!("can't get stdout"))?;
|
||||
let mut buf = String::new();
|
||||
wasi_file.read_to_string(&mut buf)?;
|
||||
Ok(buf)
|
||||
}
|
||||
|
||||
pub fn wasi_read_object<T: DeserializeOwned>(wasi_env: &WasiEnv) -> Result<T> {
|
||||
let json = wasi_read_string(wasi_env)?;
|
||||
Ok(serde_json::from_str(&json)?)
|
||||
}
|
||||
|
||||
pub fn wasi_write_string(wasi_env: &WasiEnv, buf: &str) {
|
||||
let mut state = wasi_env.state();
|
||||
let wasi_file = state.fs.stdin_mut().unwrap().as_mut().unwrap();
|
||||
writeln!(wasi_file, "{}\r", buf).unwrap();
|
||||
}
|
||||
|
||||
pub fn wasi_write_object(wasi_env: &WasiEnv, object: &(impl Serialize + ?Sized)) {
|
||||
wasi_write_string(wasi_env, &serde_json::to_string(&object).unwrap());
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
|
|
Loading…
Reference in New Issue