LSP, and/or Embedded language with Request Forwarding, but applied to (Rust) import aliases #2946
Unanswered
peter-lyons-kehl
asked this question in
Extension Development QnA
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Suggestions/examples/tips, please, on how to create a VS Code extension, for an embedded language (simple Rust macros) whose regions are delimited by patterns that may depend on aliases. Goal:
for "parameters" in a (simple, most likely regex-friendly) input grammar to custom macros in Rust. Preferring to forward the auto-complete/inlay hints for those "parameter" values and types to VS Code (if possible), which would forward them to
rust-analyzerLSP.Briefly considered:
CompletionItem, embedded language with Request Forwarding, and/or a custom LSP forwarding to another:https://github.com/microsoft/vscode-extension-samples/tree/main/lsp-user-input-sample - How to actually use/trigger the UI? I hope I won't need this low level.
rust-analyzerLSP on my own (I hope not to).I'm completely new to VS Code extensions and/or LSP development. Anything else to consider (or to ignore), please?
Perceived initial problem/milestone: If I follow the above
lsp-embedded-request-forwardingsample, or whatever you suggest, can I NOT just scan for fixed substrings/regexes to find my embedded regions (invocations of my macros)? The "problem" with Rust: The consumer code can access my crate's macro (prudent::unsafe_fn!(...);) under various names/paths (by import aliasing and/or qualified paths). LikeSo, can I somehow tell VS Code to invoke/apply my extension to regions based on another LSP? Or, if I do have to query the other LSP myself (in order to determine whether the region is "embedded"), is there a way to do this so that I don't query the other LSP everytime the text cursor is moved?
Slint (https://github.com/slint-ui/slint/tree/master/tools/lsp and https://github.com/slint-ui/slint/tree/master/editors/vscode) does have a VS Code extension with LSP can do that: it works even if
slintcrate is aliased/re-exported. But, from a brief look/grep search, I couldn't figure how it does that, and it has much more other functionality which I don't need. I can disect it, but it will take so long.prudent, the Rust crate with macros involved, is a work in progress, and open to change to accommodate whatever is needed for such a VS Code extension/LSP to work.(It's not enough to "just use"
rust-analyzer, as per rust-lang/rust-analyzer#11323.)If making it VS Code-only would be much less work than a general LSP, then VS Code-only is fine.
Thank you in advance.
Beta Was this translation helpful? Give feedback.
All reactions