Skip to content

Instantly share code, notes, and snippets.

@Silverbullet069
Last active January 30, 2024 16:53
Show Gist options
  • Save Silverbullet069/08b994462f7481a78c74c12b587ea792 to your computer and use it in GitHub Desktop.
Save Silverbullet069/08b994462f7481a78c74c12b587ea792 to your computer and use it in GitHub Desktop.
[BP - VSCode Extension] an episode in my BP - Best Practices series #best-practice
  • Ext activation events are command-based, in the past you must specify "activationEvents": ["onCommand:helloword.helloWorld"] in package.json, but now that options is built-in.
  • Use "activationEvents": ["onStartupFinished"], which fires right after VSCode has started.
  • The more specific Act Events, the better. Less ext to start at once makes VSC faster.
  • Some items are Disposables, if you think about it they do get disappeared right instance or after an amount of time.
  • LSP decouples dev tooling (servers) and text editors (clients) over a tech-neutral base layer. Don't have to write glue code when targeting editor that supports LSP. Server can be written in any languages.
  • LSP runs over RPC, using JSON-RPCv2 protocol. 1 client and 1 server exchange msg (req, res, notification).
  • Req = func calls with a given set of arguments, require res.
  • Res = return value / error
  • Notification ~ Req, do not require res, completely async
  • Despite using term client-server, the protocol is bi-dir. The transmission can be WebSockets, raw TCP connections, UNIX domain sockets, easiest to implement, and also in practice, is stdin / stdout.
  • LSP defines a set of standard reqs and notis for servers to expose features to clients.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment