Skip to content

Instantly share code, notes, and snippets.

@savetheclocktower
Last active December 25, 2023 21:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save savetheclocktower/5575eb0c6b05832990d3eef9daafc928 to your computer and use it in GitHub Desktop.
Save savetheclocktower/5575eb0c6b05832990d3eef9daafc928 to your computer and use it in GitHub Desktop.
IDE packages for pulsar

Pulsar IDE

Pulsar doesn’t have a cohesive IDE experience out of the box, but various packages can collaborate to provide it:

  • On the backend, any package that uses atom-languageclient, or any language server configured for use with generic-lsp, can provide any of the services listed below.
  • On the frontend, any package that consumes the services listed below can give the user a UI for the given feature.

The services

In general, a backend provides a service and a frontend consumes it. Here are the major services that are provided by atom-languageclient and similar sources, along with the packages in PPM that can consume them:

  • intentions:list: Pops up a small menu at a given point in the editor.
  • symbol.provider: Shows a filterable list of symbols for the current file or for the entire project. Can also support go-to-reference behavior.
    • Consumed by symbols-view-redux (eventually built-in; I've added support for this service to my fork of atom-languageclient)
  • autocomplete-provider: Lets providers offer context-specific completions for what the user is typing.
    • Consumed by autocomplete-plus (built-in)
  • code-actions: Offers a list of code actions (automatic refactors/reformats) for a given buffer context.
    • Consumed by none (atom-ide-code-actions is not standalone)
    • (The intentions package can fill most of this gap; I’ve added that to my fork of atom-languageclient)
  • code-format.range: Allows a provider to reformat an arbitrary section of a buffer
  • code-highlight: Allows a provider to provide a list of buffer ranges for the UI to bring attention to; used for things like “highlight references to X”
    • Note: very similar to find-references, but the LSP spec says they're purposefully separate because this one “is allowed to be more fuzzy
    • Consumed by none (atom-ide-code-highlight is not standalone)
  • definitions: Provides “go to definition” functionality
  • find-references: The opposite of definitions; given a symbol, returns all the ranges where that symbol is referenced
  • outline-view: Shows a hierarchical/filterable symbol view in a sidebar for a given buffer

The services listed above are “pull”-style services: the frontend initiates all interaction. Several others are “push”-style services in which the backend triggers all UI updates. These services invert the provider/consumer relationship: the UI package will provide a function that the backend can call with data whenever appropriate.

  • linter-indie: Shows diagnostic messages — linting and other code suggestions.
    • Provided by linter (which also exposes more traditional “pull”-style linting services)
  • datatip: Shows documentation for a given token when the user hovers over it (or puts the cursor inside of it).
  • signature-help: Shows the signature of a method while the cursor is inside of the method’s arguments.

I’ve omitted atom-ide-ui here because (a) it’s not currently working in Pulsar, though nobody has really investigated why; and (b) it’s an opinionated monolith. The two services that have no standalone consumers have implementations inside of atom-ide-ui that we could consult if we wanted to implement our own versions.

The vast majority of atom-ide-ui got broken into smaller atom-ide-* packages by atom-community; users can install those packages piecemeal or just install atom-ide-base to get it all at once.

Other LSP capabilities that Pulsar could support

  • Call hierarchy is in the LSP Spec and seems to be implemented in atom-languageclient.
  • Rename requests — renaming a symbol across all references in a project — is in the LSP Spec and seems to be implemented in atom-languageclient.
    • I took a first pass at a package that implemented the refactor service described in atom-languageclient, and it manages to implement rename requests perfectly. I might publish this in the package repo if I can write some specs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment