Coder Social home page Coder Social logo

marcoroth / stimulus-lsp Goto Github PK

View Code? Open in Web Editor NEW
196.0 3.0 10.0 2.34 MB

Intelligent Stimulus tooling for Visual Studio Code and Neovim

Home Page: https://hotwire.io/ecosystem/tooling/stimulus-lsp

License: MIT License

TypeScript 99.10% Shell 0.18% JavaScript 0.73%
hotwire language-server language-server-protocol lsp stimulus stimulusjs hacktoberfest

stimulus-lsp's Introduction

Stimulus LSP

Intelligent Stimulus tooling for Visual Studio Code

Functionality

Currently, this Language Server only works for HTML, though its utility extends to various file types such as ERB, PHP, or Blade files.

Completions

  • Data Attributes
  • Completions for controller identifiers
  • Completions for controller actions
  • Completions for controller targets
  • Completions for controller values
  • Completions for controller classes

Diagnostics

HTML Files

  • Missing controllers (stimulus.controller.invalid)
  • Missing controller actions (stimulus.action.invalid)
  • Missing controller targets (stimulus.controller.target.missing)
  • Missing controller values (stimulus.controller.value.missing)
  • Invalid action descriptors (stimulus.action.invalid)
  • Data attributes format mismatches (stimulus.attribute.mismatch)
  • Controller values type mismatches (stimulus.controller.value.type_mismatch)

JavaScript Files/Stimulus Controller Files

  • Controller value definition default value type mismatch (stimulus.controller.value_definition.default_value.type_mismatch)
  • Unknown value definition type (stimulus.controller.value_definition.unknown_type)
  • Controller parsing errors (stimulus.controller.parse_error)
  • Import from deprecated packages (stimulus.package.deprecated.import)

Quick-Fixes

  • Create a controller with the given identifier (stimulus.controller.create)
  • Update controller identifier with did you mean suggestion (stimulus.controller.update)
  • Register a controller definition from your project or a NPM package (stimulus.controller.register)
  • Update controller action name with did you mean suggestion (stimulus.controller.action.update)
  • Implement a missing controller action on controller (stimulus.controller.action.implement)
  • Create a default config file at .stimulus-lsp/config.json (stimulus.config.create)
  • Ignore diagnostics for a HTML attribute by adding it to the ignoredAttributes config (stimulus.config.attribute.ignore)
  • Ignore diagnostics for a Stimulus controller identifier by adding it to the ignoredControllerIdentifiers config (stimulus.config.controller.ignore)

Structure

.
├── package.json // The extension manifest.
|
├── client // Language Client
│   └── src
│      └── extension.ts // Language Client entry point
|
└── server // Language Server
    └── src
        └── server.ts // Language Server entry point

Running the extension locally

  • Run yarn install in this folder. This installs all necessary npm modules in both the client and server folder
  • Open VS Code on this folder.
  • Press Ctrl+Shift+B to compile the client and server.
  • Switch to the Debug viewlet.
  • Select Launch Client from the drop down.
  • Run the launch config.
  • If you want to debug the server as well use the launch configuration Attach to Server
  • In the [Extension Development Host] instance of VSCode, open a HTML file.
    • Type <div data-controller="|">, place your cursor where the | is, hit Ctrl+Space and you should see completions.

Install instructions: Neovim

Install instructions can be found at nvim-lspconfig

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.