(code question) question about rust-analyzer file loads #22109
Replies: 2 comments 1 reply
-
|
I suggest you start with this doc. From a bird's eye, to make r-a load your files you will need to add them to the watch list (search for Incidentally: adapting rustc and r-a to accept your custom syntax is one thing, updating your fork continuously to get the latest and greatest changes is a whole different matter and much harder. If all you want is to add some simple syntax, then the best idea is to just give up. This is not worth it (or suggest a RFC, but it probably won't be accepted. The second best idea is instead to write a preprocessor for your language that translates it to Rust. |
Beta Was this translation helpful? Give feedback.
-
|
ah i forgot i have this open figured out what was an issue, it is rustc being invoked on path by rust analyzer, so i have to compile rustc from source anyway |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
problem: rust have no support for alternative boolean tokens
solution: make preprocessor to rust code that do support
problem: how to compile project written in .ve.rs (not valid rust, to be preprocessed)?
solution: script that temporally replace all .ve.rs in src to .rs
solution 2: make rustc recognize this tokens (possible, but require compiling rustc)
problem: how to make it work with lsp?
solution: hijack lsp communication and preprocess on-fly
solution 2: make rust analyzer recognize this tokens (idk how, where i should look)
new problem: lsp run load from raw file and see .ve.rs code -> gen errors :ferrisSob:
solution: maintain fake fs and replace uri for every possible communication (will work but take a long time to setup everything)
solution 2: compile rust analyzer from source and replace buffer with preprocessed text (main question here)
where all file loads in rust lsp?
i not know rust, neither how compilers and lsp work (not good enough)
only thing i found by searching std::fs::read is vfs-notify
following code mostly ai gen
edit: i dont understand



sanity checking like everything i possibly can
*but there only 3 ways to get into set_file_content - two lsp notifications, that (tested on rust text change event) is valid rust code, and one, *only initialization filesystem load at startup
+ two cargo load that prob load cargo itself prob no need to look at
where it can be?
waiting 40+ min for test log code in set_file_contents function itself to compiles....
there nothing, it is always preprocessed code inside lsp, yet still parse original code
Beta Was this translation helpful? Give feedback.
All reactions