Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>vsqueryNew to Visual Studio Code? Get it now.
vsquery

vsquery

moreward

|
7 installs
| (1) | Free
Execute JS code in the extension host
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

vsquery

This is an extremely barebones VScode extension with a single purpose: To execute JS expressions in the extension host.

It's a simple, but a pretty powerful tool!

You can use it as a simple calculator (10 + Math.sin(Math.PI * 1.7)), or a complicated query to do things like "count all the lines in all open documents" (vscode.window.visibleTextEditors.reduce((totalLines, editor) => totalLines + editor.document.lineCount, 0))

This was inspired this post: https://ja3k.com/blog/vimllm. I just wanted to show that you don't actually need nvim for that. You can pretty much do anything you can in vscode.

There are no default shortcuts set, just execute the command "vsquery: Execute". You can set a shortcut to this command if you'd like.

Note: the query above was generated by my other vscode extension LMAOpilot with the help of an LLM using the prompt: "write a single expression js snippet that would run in vscode extension host. it should count the lines in all the documents in the open editors"

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft