Skip to content

Effect-TS/language-service

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

87 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

language-service

This package implements a TypeScript language service plugin that allows additional refactors and diagnostics with your VSCode editor (or any editor that supports TypeScript's LSP).

Installation

  1. npm install @effect/language-service in your project
  2. inside your tsconfig.json, you should add the plugin configuration as follows:
{
  "compilerOptions": {
    "plugins": [
      {
        "name": "@effect/language-service"
      }
    ]
  }
}
  1. Ensure that you set your editor to use your workspace TypeScript version.

    • In VSCode you can do this by pressing "F1" and typing "TypeScript: Select TypeScript version". Then select "Use workspace version".
    • In JetBrains you may have to disable the Vue language service, and chose the workspace version of TypeScript in the settings from the dropdown.

And you're done! You'll now be able to use a set of refactor and diagnostics that targets Effect!

Options

Few options can be provided alongside the initialization of the Language Service Plugin.

{
  "compilerOptions": {
    "plugins": [
      {
        "name": "@effect/language-service",
        "diagnostics": true, // controls Effect diagnostics (on by default)
        "quickinfo": true // controls quickinfo over Effect (on by default)
      }
    ]
  }
}

Provided functionalities

Quickinfo

  • Show the extended type of the current Effect

Diagnostics

  • Better error readability when you're missing errors or service types in your Effect definitions
  • Detect floating Effects that are not yielded or run
  • Detect wrong usage of yield inside Effect gen

Refactors

  • Transform an async function definition, into an Effect by using Effect.gen.
  • Transform an async function definition, into an Effect by using Effect.gen, and generating a tagged error for each promise call.
  • Function calls to pipe: Transform a set of function calls to a pipe() call.
  • Pipe to datafirst: Transform a pipe() call into a series of datafirst function calls (where available).
  • Toggle return type signature: With a single refactor, adds or removes type annotations from the definition.

About

No description, website, or topics provided.

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published