mirror of
https://github.com/Strum355/mcshader-lsp.git
synced 2025-08-04 00:49:17 +00:00
Command provider, base test setup and languageserver-types -> lsp-types
This commit is contained in:
parent
8e866be999
commit
6bb7b832e1
5 changed files with 253 additions and 145 deletions
151
server/Cargo.lock
generated
151
server/Cargo.lock
generated
|
@ -13,6 +13,11 @@ name = "autocfg"
|
|||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "base64"
|
||||
version = "0.12.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
version = "1.2.1"
|
||||
|
@ -48,7 +53,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
|
||||
[[package]]
|
||||
name = "idna"
|
||||
version = "0.1.5"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -69,21 +74,6 @@ name = "itoa"
|
|||
version = "0.4.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "languageserver-types"
|
||||
version = "0.54.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"num-derive 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"num-traits 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.107 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_derive 1.0.107 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_json 1.0.52 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url_serde 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lazy_static"
|
||||
version = "1.4.0"
|
||||
|
@ -110,6 +100,19 @@ dependencies = [
|
|||
"cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lsp-types"
|
||||
version = "0.74.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"base64 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.108 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_json 1.0.52 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_repr 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "matches"
|
||||
version = "0.1.8"
|
||||
|
@ -120,27 +123,9 @@ name = "memchr"
|
|||
version = "2.3.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "num-derive"
|
||||
version = "0.2.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-traits"
|
||||
version = "0.2.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "percent-encoding"
|
||||
version = "1.0.1"
|
||||
version = "2.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
|
@ -152,14 +137,6 @@ dependencies = [
|
|||
"indexmap 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "0.4.30"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.12"
|
||||
|
@ -168,14 +145,6 @@ dependencies = [
|
|||
"unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "0.6.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.4"
|
||||
|
@ -245,13 +214,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
[[package]]
|
||||
name = "rust_lsp"
|
||||
version = "0.6.0"
|
||||
source = "git+https://github.com/Strum355/RustLSP#dc9d814471bd1747591178e3b71a33a88dd5c841"
|
||||
source = "git+https://github.com/Strum355/RustLSP#ba20ea85593f28399a20503a4e52785b88ac311f"
|
||||
dependencies = [
|
||||
"languageserver-types 0.54.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lsp-types 0.74.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rustdt-json_rpc 0.3.0 (git+https://github.com/strager/rustdt-json_rpc?branch=serde-1.0)",
|
||||
"rustdt_util 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.107 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.108 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_json 1.0.52 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
|
@ -263,7 +232,7 @@ dependencies = [
|
|||
"futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rustdt_util 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.107 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.108 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_json 1.0.52 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
|
@ -287,15 +256,15 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.107"
|
||||
version = "1.0.108"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"serde_derive 1.0.107 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_derive 1.0.108 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.107"
|
||||
version = "1.0.108"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -310,7 +279,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
dependencies = [
|
||||
"itoa 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ryu 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.107 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.108 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_repr"
|
||||
version = "0.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"quote 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syn 1.0.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -318,16 +297,6 @@ name = "smallvec"
|
|||
version = "1.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "0.15.44"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "1.0.19"
|
||||
|
@ -362,11 +331,6 @@ dependencies = [
|
|||
"smallvec 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unicode-xid"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-xid"
|
||||
version = "0.2.0"
|
||||
|
@ -374,21 +338,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
|
||||
[[package]]
|
||||
name = "url"
|
||||
version = "1.7.2"
|
||||
version = "2.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"idna 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"idna 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "url_serde"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"serde 1.0.107 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"percent-encoding 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.108 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -400,7 +356,7 @@ dependencies = [
|
|||
"petgraph 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"regex 1.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rust_lsp 0.6.0 (git+https://github.com/Strum355/RustLSP)",
|
||||
"serde 1.0.107 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.108 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_json 1.0.52 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
@ -445,29 +401,26 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
[metadata]
|
||||
"checksum aho-corasick 0.7.10 (registry+https://github.com/rust-lang/crates.io-index)" = "8716408b8bc624ed7f65d223ddb9ac2d044c0547b6fa4b0d554f3a9540496ada"
|
||||
"checksum autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d"
|
||||
"checksum base64 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)" = "53d1ccbaf7d9ec9537465a97bf19edc1a4e158ecb49fc16178202238c569cc42"
|
||||
"checksum bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
|
||||
"checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
|
||||
"checksum chan 0.1.23 (registry+https://github.com/rust-lang/crates.io-index)" = "d14956a3dae065ffaa0d92ece848ab4ced88d32361e7fdfbfd653a5c454a1ed8"
|
||||
"checksum fixedbitset 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "37ab347416e802de484e4d03c7316c48f1ecb56574dfd4a46a80f173ce1de04d"
|
||||
"checksum fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba"
|
||||
"checksum futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)" = "1b980f2816d6ee8673b6517b52cb0e808a180efc92e5c19d02cdda79066703ef"
|
||||
"checksum idna 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "38f09e0f0b1fb55fdee1f17470ad800da77af5186a1a76c026b679358b7e844e"
|
||||
"checksum idna 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "02e2673c30ee86b5b96a9cb52ad15718aa1f966f5ab9ad54a8b95d5ca33120a9"
|
||||
"checksum indexmap 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "076f042c5b7b98f31d205f1249267e12a6518c1481e9dae9764af19b707d2292"
|
||||
"checksum itoa 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "b8b7a7c0c47db5545ed3fef7468ee7bb5b74691498139e4b3f6a20685dc6dd8e"
|
||||
"checksum languageserver-types 0.54.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c511f9ff7488a97fe86ca0f3a020e2515ea0e684fc0048ce9821a9e2f851071a"
|
||||
"checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
||||
"checksum libc 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)" = "99e85c08494b21a9054e7fe1374a732aeadaff3980b6990b94bfd3a70f690005"
|
||||
"checksum log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "e19e8d5c34a3e0e2223db8e060f9e8264aeeb5c5fc64a4ee9965c062211c024b"
|
||||
"checksum log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7"
|
||||
"checksum lsp-types 0.74.1 (registry+https://github.com/rust-lang/crates.io-index)" = "57c0e6a2b8837d27b29deb3f3e6dc1c6d2f57947677f9be1024e482ec5b59525"
|
||||
"checksum matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08"
|
||||
"checksum memchr 2.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3728d817d99e5ac407411fa471ff9800a778d88a24685968b36824eaf4bee400"
|
||||
"checksum num-derive 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "eafd0b45c5537c3ba526f79d3e75120036502bebacbb3f3220914067ce39dbf2"
|
||||
"checksum num-traits 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "c62be47e61d1842b9170f0fdeec8eba98e60e90e5446449a0545e5152acd7096"
|
||||
"checksum percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831"
|
||||
"checksum percent-encoding 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e"
|
||||
"checksum petgraph 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "29c127eea4a29ec6c85d153c59dc1213f33ec74cead30fe4730aecc88cc1fd92"
|
||||
"checksum proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)" = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759"
|
||||
"checksum proc-macro2 1.0.12 (registry+https://github.com/rust-lang/crates.io-index)" = "8872cf6f48eee44265156c111456a700ab3483686b3f96df4cf5481c89157319"
|
||||
"checksum quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)" = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1"
|
||||
"checksum quote 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "4c1f4b0efa5fc5e8ceb705136bfee52cfdb6a4e3509f770b478cd6ed434232a7"
|
||||
"checksum rand 0.3.23 (registry+https://github.com/rust-lang/crates.io-index)" = "64ac302d8f83c0c1974bf758f6b041c6c8ada916fbb44a609158ca8b064cc76c"
|
||||
"checksum rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "552840b97013b1a26992c11eac34bdd778e464601a4c2054b5f0bff7c6761293"
|
||||
|
@ -481,19 +434,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
"checksum rustdt_util 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7cfffa8a89d8758be2dd5605c5fc62bce055af2491ebf3ce953d4d31512c59fd"
|
||||
"checksum ryu 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "ed3d612bc64430efeb3f7ee6ef26d590dce0c43249217bddc62112540c7941e1"
|
||||
"checksum same-file 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502"
|
||||
"checksum serde 1.0.107 (registry+https://github.com/rust-lang/crates.io-index)" = "eba7550f2cdf88ffc23ab0f1607133486c390a8c0f89b57e589b9654ee15e04d"
|
||||
"checksum serde_derive 1.0.107 (registry+https://github.com/rust-lang/crates.io-index)" = "10be45e22e5597d4b88afcc71f9d7bfadcd604bf0c78a3ab4582b8d2b37f39f3"
|
||||
"checksum serde 1.0.108 (registry+https://github.com/rust-lang/crates.io-index)" = "98b4e9fadb50ff90c1e758e42f13a8e2ab84e1927abb0aa5b95e5ecdb49ea741"
|
||||
"checksum serde_derive 1.0.108 (registry+https://github.com/rust-lang/crates.io-index)" = "6a316eba8a61ba986e87e7e04a74f9feda86298fb454b76232ead4e425976090"
|
||||
"checksum serde_json 1.0.52 (registry+https://github.com/rust-lang/crates.io-index)" = "a7894c8ed05b7a3a279aeb79025fdec1d3158080b75b98a08faf2806bb799edd"
|
||||
"checksum serde_repr 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "cd02c7587ec314570041b2754829f84d873ced14a96d1fd1823531e11db40573"
|
||||
"checksum smallvec 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c7cb5678e1615754284ec264d9bb5b4c27d2018577fd90ac0ceb578591ed5ee4"
|
||||
"checksum syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)" = "9ca4b3b69a77cbe1ffc9e198781b7acb0c7365a883670e8f1c1bc66fba79a5c5"
|
||||
"checksum syn 1.0.19 (registry+https://github.com/rust-lang/crates.io-index)" = "e8e5aa70697bb26ee62214ae3288465ecec0000f05182f039b477001f08f5ae7"
|
||||
"checksum thread_local 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d40c6d1b69745a6ec6fb1ca717914848da4b44ae29d9b3080cbee91d72a69b14"
|
||||
"checksum unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5"
|
||||
"checksum unicode-normalization 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "5479532badd04e128284890390c1e876ef7a993d0570b3597ae43dfa1d59afa4"
|
||||
"checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc"
|
||||
"checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c"
|
||||
"checksum url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dd4e7c0d531266369519a4aa4f399d748bd37043b00bde1e4ff1f60a120b355a"
|
||||
"checksum url_serde 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "74e7d099f1ee52f823d4bdd60c93c3602043c728f5db3b97bdb548467f7bddea"
|
||||
"checksum url 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "829d4a8476c35c9bf0bbce5a3b23f4106f79728039b726d292bb93bc106787cb"
|
||||
"checksum walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "777182bc735b6424e1a57516d35ed72cb8019d85c8c9bf536dccb3445c1a2f7d"
|
||||
"checksum winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "8093091eeb260906a183e6ae1abdba2ef5ef2257a21801128899c3fc699229c6"
|
||||
"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
|
||||
|
|
2
server/Makefile
Normal file
2
server/Makefile
Normal file
|
@ -0,0 +1,2 @@
|
|||
watchtest:
|
||||
RUST_BACKTRACE=0 cargo watch -x test -i Makefile
|
|
@ -1,30 +1,31 @@
|
|||
use rust_lsp::lsp::*;
|
||||
use rust_lsp::ls_types::*;
|
||||
use rust_lsp::lsp_types::*;
|
||||
use rust_lsp::jsonrpc::*;
|
||||
use rust_lsp::jsonrpc::method_types::*;
|
||||
|
||||
use walkdir;
|
||||
|
||||
use std::rc::Rc;
|
||||
use std::cell::RefCell;
|
||||
use std::ops::Add;
|
||||
use std::fs::OpenOptions;
|
||||
use std::io::prelude::*;
|
||||
use std::io;
|
||||
use std::io::{BufReader, BufRead};
|
||||
use std::process;
|
||||
/* use std::path::Path; */
|
||||
use std::collections::HashMap;
|
||||
use std::io;
|
||||
|
||||
//use petgraph::visit::Dfs;
|
||||
use petgraph::dot;
|
||||
use petgraph::graph::Graph;
|
||||
|
||||
|
||||
use chan::WaitGroup;
|
||||
|
||||
use regex::Regex;
|
||||
|
||||
use lazy_static::lazy_static;
|
||||
|
||||
mod provider;
|
||||
|
||||
#[cfg(test)]
|
||||
mod test;
|
||||
|
||||
lazy_static! {
|
||||
static ref RE_DIAGNOSTIC: Regex = Regex::new(r#"^(ERROR|WARNING): ([^?<>*|"]+?):(\d+): (?:'.*?' : )?(.+)\r?"#).unwrap();
|
||||
static ref RE_VERSION: Regex = Regex::new(r#"#version [\d]{3}"#).unwrap();
|
||||
|
@ -32,6 +33,7 @@ lazy_static! {
|
|||
static ref RE_INCLUDE_EXTENSION: Regex = Regex::new(r#"#extension GL_GOOGLE_include_directive ?: ?require"#).unwrap();
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
static INCLUDE_STR: &'static str = "#extension GL_GOOGLE_include_directive : require";
|
||||
|
||||
fn main() {
|
||||
|
@ -39,23 +41,31 @@ fn main() {
|
|||
|
||||
let endpoint_output = LSPEndpoint::create_lsp_output_with_output_stream(|| io::stdout());
|
||||
|
||||
let langserver = MinecraftShaderLanguageServer{
|
||||
let mut langserver = MinecraftShaderLanguageServer{
|
||||
endpoint: endpoint_output.clone(),
|
||||
graph: Graph::default(),
|
||||
graph: Rc::new(RefCell::new(Graph::default())),
|
||||
config: Configuration::default(),
|
||||
wait: WaitGroup::new(),
|
||||
root: None,
|
||||
command_provider: None,
|
||||
};
|
||||
|
||||
langserver.command_provider = Some(provider::CustomCommandProvider::new(vec![
|
||||
("graphDot", Box::new(provider::GraphDotCommand{
|
||||
graph: langserver.graph.clone(),
|
||||
}))
|
||||
]));
|
||||
|
||||
LSPEndpoint::run_server_from_input(&mut stdin.lock(), endpoint_output, langserver);
|
||||
}
|
||||
|
||||
struct MinecraftShaderLanguageServer {
|
||||
endpoint: Endpoint,
|
||||
graph: Graph<String, String>,
|
||||
graph: Rc<RefCell<Graph<String, String>>>,
|
||||
config: Configuration,
|
||||
wait: WaitGroup,
|
||||
root: Option<String>
|
||||
root: Option<String>,
|
||||
command_provider: Option<provider::CustomCommandProvider>
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
|
@ -116,7 +126,7 @@ impl MinecraftShaderLanguageServer {
|
|||
let includes = self.find_includes(root.as_str(), entry_res.as_str());
|
||||
|
||||
let stripped_path = String::from(String::from(entry_res));
|
||||
let idx = self.graph.add_node(stripped_path.clone());
|
||||
let idx = self.graph.borrow_mut().add_node(stripped_path.clone());
|
||||
|
||||
//eprintln!("adding {} with\n{:?}", stripped_path.clone(), includes);
|
||||
|
||||
|
@ -126,15 +136,15 @@ impl MinecraftShaderLanguageServer {
|
|||
// Add edges between nodes, finding target nodes on weight (value)
|
||||
for (_, v) in files.into_iter() {
|
||||
for file in v.includes {
|
||||
let mut iter = self.graph.node_indices();
|
||||
let mut iter = self.graph.borrow().node_indices();
|
||||
//eprintln!("searching for {}", file);
|
||||
let idx = iter.find(|i| self.graph[*i] == file);
|
||||
let idx = iter.find(|i| self.graph.borrow_mut()[*i] == file);
|
||||
if idx.is_none() {
|
||||
eprintln!("couldn't find {} in graph", file);
|
||||
continue;
|
||||
}
|
||||
//eprintln!("added edge between\n\t{}\n\t{}", k, file);
|
||||
self.graph.add_edge(v.idx, idx.unwrap(), String::from("includes"));
|
||||
self.graph.borrow_mut().add_edge(v.idx, idx.unwrap(), String::from("includes"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -180,6 +190,9 @@ impl LanguageServerHandling for MinecraftShaderLanguageServer {
|
|||
capabilities.hover_provider = Some(true);
|
||||
capabilities.execute_command_provider = Some(ExecuteCommandOptions{
|
||||
commands: vec![String::from("graphDot")],
|
||||
work_done_progress_options: WorkDoneProgressOptions{
|
||||
work_done_progress: None,
|
||||
},
|
||||
});
|
||||
capabilities.text_document_sync = Some(TextDocumentSyncCapability::Options(TextDocumentSyncOptions{
|
||||
open_close: Some(true),
|
||||
|
@ -193,7 +206,7 @@ impl LanguageServerHandling for MinecraftShaderLanguageServer {
|
|||
|
||||
self.root = Some(params.root_path.unwrap());
|
||||
|
||||
completable.complete(Ok(InitializeResult{capabilities}));
|
||||
completable.complete(Ok(InitializeResult{capabilities, server_info: None}));
|
||||
|
||||
self.gen_initial_graph(self.root.clone().unwrap());
|
||||
self.lint();
|
||||
|
@ -226,6 +239,8 @@ impl LanguageServerHandling for MinecraftShaderLanguageServer {
|
|||
|
||||
fn did_change_text_document(&mut self, params: DidChangeTextDocumentParams) {
|
||||
self.wait.wait();
|
||||
|
||||
#[allow(unused_variables)]
|
||||
let text_change = params.content_changes.get(0).unwrap();
|
||||
//eprintln!("changed {} changes: {}", text_change., params.text_document.uri);
|
||||
}
|
||||
|
@ -242,6 +257,7 @@ impl LanguageServerHandling for MinecraftShaderLanguageServer {
|
|||
fn completion(&mut self, _: TextDocumentPositionParams, completable: LSCompletable<CompletionList>) {
|
||||
completable.complete(Err(Self::error_not_available(())));
|
||||
}
|
||||
|
||||
fn resolve_completion_item(&mut self, _: CompletionItem, completable: LSCompletable<CompletionItem>) {
|
||||
completable.complete(Err(Self::error_not_available(())));
|
||||
}
|
||||
|
@ -257,79 +273,73 @@ impl LanguageServerHandling for MinecraftShaderLanguageServer {
|
|||
}));
|
||||
}
|
||||
|
||||
fn execute_command(&mut self, params: ExecuteCommandParams, completable: LSCompletable<WorkspaceEdit>) {
|
||||
if params.command == "graphDot" {
|
||||
let mut file = OpenOptions::new()
|
||||
.write(true)
|
||||
.create(true)
|
||||
.open(self.root.clone().unwrap() + "/graph.dot")
|
||||
.unwrap();
|
||||
|
||||
let mut write_data_closure = || -> Result<(), std::io::Error> {
|
||||
file.seek(std::io::SeekFrom::Start(0))?;
|
||||
file.write_all(dot::Dot::new(&self.graph).to_string().as_bytes())?;
|
||||
file.flush()?;
|
||||
file.seek(std::io::SeekFrom::Start(0))?;
|
||||
Ok(())
|
||||
};
|
||||
|
||||
match write_data_closure() {
|
||||
Err(err) => {
|
||||
completable.complete(Err(MethodError::new(32420, format!("Error generating graphviz data: {}", err), ())));
|
||||
return;
|
||||
},
|
||||
_ => {}
|
||||
}
|
||||
fn execute_command(&mut self, mut params: ExecuteCommandParams, completable: LSCompletable<WorkspaceEdit>) {
|
||||
params.arguments.push(serde_json::Value::String(self.root.clone().unwrap()));
|
||||
match self.command_provider.as_ref().unwrap().execute(params.command, params.arguments) {
|
||||
Ok(_) => completable.complete(Ok(WorkspaceEdit{
|
||||
changes: None,
|
||||
document_changes: None,
|
||||
})),
|
||||
Err(err) => completable.complete(Err(MethodError::new(32420, err, ())))
|
||||
}
|
||||
|
||||
completable.complete(Ok(WorkspaceEdit{
|
||||
changes: None,
|
||||
document_changes: None,
|
||||
}));
|
||||
}
|
||||
|
||||
fn signature_help(&mut self, _: TextDocumentPositionParams, completable: LSCompletable<SignatureHelp>) {
|
||||
completable.complete(Err(Self::error_not_available(())));
|
||||
}
|
||||
|
||||
fn goto_definition(&mut self, _: TextDocumentPositionParams, completable: LSCompletable<Vec<Location>>) {
|
||||
completable.complete(Err(Self::error_not_available(())));
|
||||
}
|
||||
|
||||
fn references(&mut self, _: ReferenceParams, completable: LSCompletable<Vec<Location>>) {
|
||||
completable.complete(Err(Self::error_not_available(())));
|
||||
}
|
||||
|
||||
fn document_highlight(&mut self, _: TextDocumentPositionParams, completable: LSCompletable<Vec<DocumentHighlight>>) {
|
||||
completable.complete(Err(Self::error_not_available(())));
|
||||
}
|
||||
|
||||
fn document_symbols(&mut self, _: DocumentSymbolParams, completable: LSCompletable<Vec<SymbolInformation>>) {
|
||||
completable.complete(Err(Self::error_not_available(())));
|
||||
}
|
||||
|
||||
fn workspace_symbols(&mut self, _: WorkspaceSymbolParams, completable: LSCompletable<Vec<SymbolInformation>>) {
|
||||
completable.complete(Err(Self::error_not_available(())));
|
||||
}
|
||||
|
||||
fn code_action(&mut self, _: CodeActionParams, completable: LSCompletable<Vec<Command>>) {
|
||||
completable.complete(Err(Self::error_not_available(())));
|
||||
}
|
||||
|
||||
fn code_lens(&mut self, _: CodeLensParams, completable: LSCompletable<Vec<CodeLens>>) {
|
||||
completable.complete(Err(Self::error_not_available(())));
|
||||
}
|
||||
|
||||
fn code_lens_resolve(&mut self, _: CodeLens, completable: LSCompletable<CodeLens>) {
|
||||
completable.complete(Err(Self::error_not_available(())));
|
||||
}
|
||||
|
||||
fn document_link(&mut self, _params: DocumentLinkParams, completable: LSCompletable<Vec<DocumentLink>>) {
|
||||
completable.complete(Err(Self::error_not_available(())));
|
||||
}
|
||||
|
||||
fn document_link_resolve(&mut self, _params: DocumentLink, completable: LSCompletable<DocumentLink>) {
|
||||
completable.complete(Err(Self::error_not_available(())));
|
||||
}
|
||||
|
||||
fn formatting(&mut self, _: DocumentFormattingParams, completable: LSCompletable<Vec<TextEdit>>) {
|
||||
completable.complete(Err(Self::error_not_available(())));
|
||||
}
|
||||
|
||||
fn range_formatting(&mut self, _: DocumentRangeFormattingParams, completable: LSCompletable<Vec<TextEdit>>) {
|
||||
completable.complete(Err(Self::error_not_available(())));
|
||||
}
|
||||
|
||||
fn on_type_formatting(&mut self, _: DocumentOnTypeFormattingParams, completable: LSCompletable<Vec<TextEdit>>) {
|
||||
completable.complete(Err(Self::error_not_available(())));
|
||||
}
|
||||
|
||||
fn rename(&mut self, _: RenameParams, completable: LSCompletable<WorkspaceEdit>) {
|
||||
completable.complete(Err(Self::error_not_available(())));
|
||||
}
|
||||
|
|
65
server/src/provider.rs
Normal file
65
server/src/provider.rs
Normal file
|
@ -0,0 +1,65 @@
|
|||
use std::collections::HashMap;
|
||||
use std::rc::Rc;
|
||||
use std::cell::RefCell;
|
||||
use std::fs::OpenOptions;
|
||||
use std::io::prelude::*;
|
||||
|
||||
use serde_json::Value;
|
||||
|
||||
use petgraph::dot;
|
||||
use petgraph::graph::Graph;
|
||||
|
||||
pub struct CustomCommandProvider {
|
||||
commands: HashMap<String, Box<dyn Invokeable>>
|
||||
}
|
||||
|
||||
impl CustomCommandProvider {
|
||||
pub fn new(commands: Vec<(&str, Box<dyn Invokeable>)>) -> CustomCommandProvider {
|
||||
CustomCommandProvider{
|
||||
commands: commands.into_iter().map(|tup| {
|
||||
(String::from(tup.0), tup.1)
|
||||
}).collect(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn execute(&self, command: String, args: Vec<Value>) -> Result<(), String> {
|
||||
if self.commands.contains_key(&command) {
|
||||
return self.commands.get(&command).unwrap().run_command(args);
|
||||
}
|
||||
Err(String::from("command doesn't exist"))
|
||||
}
|
||||
}
|
||||
|
||||
pub trait Invokeable {
|
||||
fn run_command(&self, arguments: Vec<Value>) -> Result<(), String>;
|
||||
}
|
||||
|
||||
pub struct GraphDotCommand {
|
||||
pub graph: Rc<RefCell<Graph<String, String>>>
|
||||
}
|
||||
|
||||
impl<'a> Invokeable for GraphDotCommand {
|
||||
fn run_command(&self, params: Vec<Value>) -> Result<(), String> {
|
||||
let rootpath = params.get(0).unwrap().to_string();
|
||||
let filepath = rootpath + "/graph.dot";
|
||||
let mut file = OpenOptions::new()
|
||||
.write(true)
|
||||
.create(true)
|
||||
.open(filepath)
|
||||
.unwrap();
|
||||
|
||||
let mut write_data_closure = || -> Result<(), std::io::Error> {
|
||||
let graph = self.graph.as_ref();
|
||||
file.seek(std::io::SeekFrom::Start(0))?;
|
||||
file.write_all(dot::Dot::new(&(*(graph.borrow()))).to_string().as_bytes())?;
|
||||
file.flush()?;
|
||||
file.seek(std::io::SeekFrom::Start(0))?;
|
||||
Ok(())
|
||||
};
|
||||
|
||||
match write_data_closure() {
|
||||
Err(err) => Err(format!("Error generating graphviz data: {}", err)),
|
||||
_ => Ok(())
|
||||
}
|
||||
}
|
||||
}
|
80
server/src/test.rs
Normal file
80
server/src/test.rs
Normal file
|
@ -0,0 +1,80 @@
|
|||
use super::*;
|
||||
use std::io;
|
||||
use std::io::Result;
|
||||
|
||||
use jsonrpc_common::*;
|
||||
use jsonrpc_response::*;
|
||||
use jsonrpc_response::*;
|
||||
|
||||
use serde_json::json;
|
||||
|
||||
struct StdoutNewline {
|
||||
s: io::Stdout
|
||||
}
|
||||
|
||||
impl io::Write for StdoutNewline {
|
||||
fn write(&mut self, buf: &[u8]) -> Result<usize> {
|
||||
let res = self.s.write(buf);
|
||||
if buf[buf.len()-1] == "}".as_bytes()[0] {
|
||||
#[allow(unused_variables)]
|
||||
let res = self.s.write("\n\n".as_bytes());
|
||||
|
||||
}
|
||||
res
|
||||
}
|
||||
|
||||
fn flush(&mut self) -> Result<()> {
|
||||
self.s.flush()
|
||||
}
|
||||
}
|
||||
|
||||
fn new_temp_server() -> MinecraftShaderLanguageServer {
|
||||
let endpoint = LSPEndpoint::create_lsp_output_with_output_stream(|| StdoutNewline{s: io::stdout()});
|
||||
|
||||
MinecraftShaderLanguageServer{
|
||||
endpoint,
|
||||
graph: Rc::new(RefCell::new(Graph::default())),
|
||||
config: Configuration::default(),
|
||||
wait: WaitGroup::new(),
|
||||
root: None,
|
||||
command_provider: None,
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_initialize() {
|
||||
let mut server = new_temp_server();
|
||||
|
||||
let initialize_params = InitializeParams{
|
||||
process_id: None,
|
||||
root_path: Some(String::from("/tmp/vscodemcshader")),
|
||||
root_uri: None,
|
||||
client_info: None,
|
||||
initialization_options: None,
|
||||
capabilities: ClientCapabilities{workspace: None, text_document: None, experimental: None, window: None},
|
||||
trace: None,
|
||||
workspace_folders: None,
|
||||
};
|
||||
|
||||
let on_response = |resp: Option<Response>| {
|
||||
assert!(resp.is_some());
|
||||
let respu = resp.unwrap();
|
||||
match respu.result_or_error {
|
||||
ResponseResult::Result(_) => {},
|
||||
ResponseResult::Error(e) => { panic!(format!("expected ResponseResult::Result(..), got {:?}", e)) }
|
||||
}
|
||||
};
|
||||
|
||||
let completable = MethodCompletable::new(ResponseCompletable::new(Some(Id::Number(1)), Box::new(on_response)));
|
||||
server.initialize(initialize_params, completable);
|
||||
|
||||
assert_eq!(server.root, Some(String::from("/tmp/vscodemcshader")));
|
||||
|
||||
assert_eq!(server.graph.borrow().edge_count(), 0);
|
||||
assert_eq!(server.graph.borrow().node_count(), 0);
|
||||
|
||||
assert_eq!(format!("{:?}", server.wait), "WaitGroup { count: 1 }");
|
||||
|
||||
server.endpoint.request_shutdown();
|
||||
//std::thread::sleep(std::time::Duration::from_secs(1));
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue